Skip to content

Commit

Permalink
Merge pull request #147 from Loginxtech/create-conceptual-exams-in-batch
Browse files Browse the repository at this point in the history
Cria possibilidade de criar avaliações conceituais em lote
  • Loading branch information
edersoares authored Jun 20, 2024
2 parents 29b7114 + 0feca1b commit 211bc17
Show file tree
Hide file tree
Showing 25 changed files with 932 additions and 1 deletion.
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

0 comments on commit 211bc17

Please sign in to comment.