Update Bootstrap to v4.1, fix chosen.js and pagedown on multiple sites
This commit is contained in:
@ -14,11 +14,11 @@ $(document).on('turbolinks:load', function() {
|
||||
var alternative_input = parent.find('.alternative-input');
|
||||
|
||||
if (alternative_input.attr('disabled')) {
|
||||
$(this).text($(this).data('text-toggled'));
|
||||
$(this).text($(event.target).data('text-toggled'));
|
||||
original_input.attr('disabled', true).hide();
|
||||
alternative_input.attr('disabled', false).show();
|
||||
} else {
|
||||
$(this).text($(this).data('text-initial'));
|
||||
$(this).text($(event.target).data('text-initial'));
|
||||
alternative_input.attr('disabled', true).hide();
|
||||
original_input.attr('disabled', false).show();
|
||||
}
|
||||
@ -26,5 +26,27 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
|
||||
window.CodeOcean.CHOSEN_OPTIONS = CHOSEN_OPTIONS;
|
||||
$('select:visible').chosen(CHOSEN_OPTIONS);
|
||||
chosen_inputs = $('select').filter(function(){
|
||||
return !$(this).parents('ul').is('#dummies');
|
||||
});
|
||||
|
||||
// enable chosen hook when editing an exercise to update ace code highlighting
|
||||
if ($.isController('exercises') && $('.edit_exercise, .new_exercise').isPresent()) {
|
||||
chosen_inputs.filter(function(){
|
||||
return $(this).attr('id').includes('file_type_id');
|
||||
}).on('change chosen:ready', function(event, parameter) {
|
||||
// Set ACE editor mode (for code highlighting) on change of file type and after initialization
|
||||
editorInstance = $(event.target).closest('.card-body').find('.editor')[0];
|
||||
selectedFileType = event.target.value;
|
||||
CodeOceanEditor.updateEditorModeToFileTypeID(editorInstance, selectedFileType);
|
||||
})
|
||||
}
|
||||
|
||||
chosen_inputs.chosen(CHOSEN_OPTIONS);
|
||||
});
|
||||
|
||||
// Remove some elements before going back to an older site. Otherwise, they might not work.
|
||||
$(document).on('turbolinks:before-cache', function() {
|
||||
$('.chosen-container').remove();
|
||||
$('#wmd-button-row-description').remove();
|
||||
});
|
||||
|
Reference in New Issue
Block a user