demarches-normaliennes/app/assets/javascripts/admin.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-07-20 11:38:19 +02:00
$(document).on('page:load', init_admin);
$(document).ready(init_admin);
function init_admin(){
destroy_action();
on_change_type_de_champ_select();
}
2016-02-09 12:23:49 +01:00
function destroy_action(){
$(".delete").on('click', function(){
$(this).hide();
$(this).closest('td').find(".confirm").show();
2016-02-09 12:23:49 +01:00
});
$(".cancel").on('click', function(){
$(this).closest('td').find(".delete").show();
$(this).closest('td').find(".confirm").hide();
});
$("#liste_gestionnaire #libelle").on('click', function(){
setTimeout(destroy_action, 500);
2016-02-09 12:23:49 +01:00
});
2016-07-20 11:38:19 +02:00
}
function on_change_type_de_champ_select (){
$("select.form-control.type_champ").on('change', function(e){
2016-08-09 16:21:39 +02:00
parent = $(this).parent().parent();
parent.removeClass('header_section');
parent.children(".drop_down_list").removeClass('show_inline');
switch(this.value){
case 'header_section':
parent.addClass('header_section');
break;
case 'drop_down_list':
parent.children(".drop_down_list").addClass('show_inline');
break;
2016-07-20 11:38:19 +02:00
}
})
}