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" %>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.main-forms .add-on').tooltip();
|
||||
$(document).on('click', '#add_file', function(){
|
||||
$('.main-forms').find('.add-on').tooltip().end().on('click', '.trigger, .delete_file, .remove_existing_record', function() {
|
||||
if($(this).hasClass('trigger')) {
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_journal_paper_files", "g");
|
||||
var on = $('.language-nav li.active').index();
|
||||
|
@ -315,16 +314,14 @@
|
|||
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
||||
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
||||
});
|
||||
formTip();
|
||||
});
|
||||
$(document).on('click', '.delete_file', function(){
|
||||
formTip();
|
||||
} else if($(this).hasClass('delete_file')) {
|
||||
$(this).parents('.input-prepend').remove();
|
||||
});
|
||||
$(document).on('click', '.remove_existing_record', function(){
|
||||
} else if($(this).hasClass('remove_existing_record')) {
|
||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||
$(this).children('.should_destroy').attr('value', 1);
|
||||
$(this).parents('.start-line').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue