removed code duplication
This commit is contained in:
@ -9,11 +9,8 @@ $(function() {
|
|||||||
var element = $('#dummies').children().first().clone();
|
var element = $('#dummies').children().first().clone();
|
||||||
var html = $('<div>').append(element).html().replace(/index/g, new Date().getTime());
|
var html = $('<div>').append(element).html().replace(/index/g, new Date().getTime());
|
||||||
$('#files').append(html);
|
$('#files').append(html);
|
||||||
$('#files select').chosen({
|
|
||||||
disable_search_threshold: 5,
|
|
||||||
search_contains: true
|
|
||||||
});
|
|
||||||
$('#files li:last select[name*="file_type_id"]').val(getSelectedExecutionEnvironment().file_type_id);
|
$('#files li:last select[name*="file_type_id"]').val(getSelectedExecutionEnvironment().file_type_id);
|
||||||
|
$('#files li:last select').chosen(window.CodeOcean.CHOSEN_OPTIONS);
|
||||||
$('body, html').scrollTo('#add-file');
|
$('body, html').scrollTo('#add-file');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
|
var CHOSEN_OPTIONS = {
|
||||||
|
allow_single_deselect: true,
|
||||||
|
disable_search_threshold: 5,
|
||||||
|
search_contains: true
|
||||||
|
};
|
||||||
|
|
||||||
$('form').on('click', '.toggle-input', function(event) {
|
$('form').on('click', '.toggle-input', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!$(this).hasClass('disabled')) {
|
if (!$(this).hasClass('disabled')) {
|
||||||
@ -14,9 +20,8 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('select:visible').chosen({
|
window.CodeOcean = window.CodeOcean || {};
|
||||||
allow_single_deselect: true,
|
window.CodeOcean.CHOSEN_OPTIONS = CHOSEN_OPTIONS;
|
||||||
disable_search_threshold: 5,
|
|
||||||
search_contains: true
|
$('select:visible').chosen(CHOSEN_OPTIONS);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user