forked from saurabh/personal-journal
24 lines
1.3 KiB
Plaintext
24 lines
1.3 KiB
Plaintext
$(document).ready(function() {
|
|
$('.main-forms .add-on').tooltip();
|
|
$(document).on('click', '#add_file', function(){
|
|
var new_id = $(this).prev().attr('value');
|
|
var old_id = new RegExp("new_journal_paper_files", "g");
|
|
var on = $('.language-nav li.active').index();
|
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :journal_paper_files) rescue "" %>").replace(old_id, new_id));
|
|
$(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(){
|
|
$(this).parents('.input-prepend').remove();
|
|
});
|
|
$(document).on('click', '.remove_existing_record', function(){
|
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
|
$(this).children('.should_destroy').attr('value', 1);
|
|
$(this).parents('.start-line').hide();
|
|
}
|
|
});
|
|
}); |