forked from saurabh/personal-journal
fix js for form
This commit is contained in:
parent
5215d76382
commit
4a8a0df7da
|
@ -303,9 +303,8 @@
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$('.main-forms').find('.add-on').tooltip().end().on('click', '.trigger, .delete_file, .remove_existing_record', function() {
|
||||||
$('.main-forms .add-on').tooltip();
|
if($(this).hasClass('trigger')) {
|
||||||
$(document).on('click', '#add_file', function(){
|
|
||||||
var new_id = $(this).prev().attr('value');
|
var new_id = $(this).prev().attr('value');
|
||||||
var old_id = new RegExp("new_journal_paper_files", "g");
|
var old_id = new RegExp("new_journal_paper_files", "g");
|
||||||
var on = $('.language-nav li.active').index();
|
var on = $('.language-nav li.active').index();
|
||||||
|
@ -316,15 +315,13 @@
|
||||||
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
||||||
});
|
});
|
||||||
formTip();
|
formTip();
|
||||||
});
|
} else if($(this).hasClass('delete_file')) {
|
||||||
$(document).on('click', '.delete_file', function(){
|
|
||||||
$(this).parents('.input-prepend').remove();
|
$(this).parents('.input-prepend').remove();
|
||||||
});
|
} else if($(this).hasClass('remove_existing_record')) {
|
||||||
$(document).on('click', '.remove_existing_record', function(){
|
|
||||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
$(this).children('.should_destroy').attr('value', 1);
|
$(this).children('.should_destroy').attr('value', 1);
|
||||||
$(this).parents('.start-line').hide();
|
$(this).parents('.start-line').hide();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue