Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cria possibilidade de criar avaliações conceituais em lote #147

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/assets/javascripts/beta_function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$(document).ready( function() {
let beta_title = 'Este recurso ainda está em processo de desenvolvimento e pode apresentar problemas'
let img_src = $('#image-beta').attr('src');
$(".fa-file-text-o").closest('h2').after(`<img src="${img_src}" class="beta-badge" style="margin-bottom: 9px; margin-left: 5px" title="${beta_title}">`);
})
38 changes: 38 additions & 0 deletions app/assets/javascripts/views/conceptual_exams_in_batchs/new.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$(function() {
'use strict';
const flashMessages = new FlashMessages();

$('#conceptual_exam_classroom_id').on('change', function () {
flashMessages.pop('');
$('#conceptual_exam_step_id').select2('val', '');

populateSteps();
});

function populateSteps() {
let classroom_id = $('#conceptual_exam_classroom_id').select2('val');

if (!_.isEmpty(classroom_id)) {
$.ajax({
url: Routes.get_steps_conceptual_exams_in_batchs_pt_br_path({
classroom_id: classroom_id,
format: 'json'
}),
success: handleFetchStepsSuccess,
error: handleFetchStepsError
});
}
}

function handleFetchStepsSuccess(data) {
let steps = _.map(data.conceptual_exams_in_batchs, function(step) {
return { id: step.table.id, name: step.table.name, text: step.table.text };
});

$('#conceptual_exam_step_id').select2({ data: steps })
}

function handleFetchStepsError() {
flashMessages.error('Ocorreu um erro ao buscar as etapas da turma.');
}
});
Loading
Loading