From 3d293f64199d5130c154d46beef750fa2cf40acc Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 26 Apr 2012 16:42:28 +0800 Subject: [PATCH] Fix for quick edit file and link in announcement Change submit_button into ajax_for_submit --- app/assets/javascripts/ajax_form.js | 2 +- app/assets/javascripts/bulletin_form.js.erb | 5 ++- app/assets/javascripts/new_admin.js | 4 ++- app/views/admin/assets/_edit.html.erb | 2 +- app/views/admin/assets/_new.html.erb | 2 +- .../bulletins/_bulletin_file_qe.html.erb | 8 ++--- .../bulletins/_list_bulletin_file.html.erb | 29 ++++++++-------- .../bulletins/_list_bulletin_link.html.erb | 34 ++++++++----------- .../bulletins/_quick_edit_files.html.erb | 2 +- .../back_end/bulletins/index.html.erb | 6 ++++ 10 files changed, 49 insertions(+), 45 deletions(-) diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js index c026e518e..d9b5abfec 100644 --- a/app/assets/javascripts/ajax_form.js +++ b/app/assets/javascripts/ajax_form.js @@ -1,4 +1,4 @@ -$('#submit_button').live('click', function(){ +$(document).on('click', '#ajax_form_submit', function(){ $('#ajaxForm').ajaxSubmit({ beforeSubmit: function(a,f,o) { o.dataType = 'script'; diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index abb908b4e..01685c3dc 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -6,10 +6,9 @@ $('.bulletin_files_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); -$('.action a.remove_existing_record').live('click', function(){ +$(document).on('click', '.action a.remove_existing_record', function(){ $(this).next('.should_destroy').attr('value', 1); - //$("#bulletin_" + $(this).prev().attr('value')).hide(); - $("tr#bulletin_" + $(this).prev().attr('value')).hide(); + $("tr #" + $(this).prev().attr('value')).hide(); }); $('.quick_edit_cancel').live('click', function(){ diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 45bfcbbc1..f20267cd9 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -6,6 +6,7 @@ // //= require jquery //= require jquery_ujs +//= require jquery.form //= require bootstrap //= require jquery.isotope.min //= require jquery.tinyscrollbar.min @@ -13,4 +14,5 @@ //= require tinymce-jquery //= require tinymce_orbit //= require orbit-bar-search -//= require side_bar_history \ No newline at end of file +//= require side_bar_history +//= require ajax_form \ No newline at end of file diff --git a/app/views/admin/assets/_edit.html.erb b/app/views/admin/assets/_edit.html.erb index 33f8131cb..a747d4f24 100644 --- a/app/views/admin/assets/_edit.html.erb +++ b/app/views/admin/assets/_edit.html.erb @@ -9,7 +9,7 @@ <%= link_back %> <%= f.submit t(:edit) %> <% else %> - <%= t(:edit) %> + <%= t(:edit) %> <% end %> <% end %> diff --git a/app/views/admin/assets/_new.html.erb b/app/views/admin/assets/_new.html.erb index 49e638c8c..85d3c2e55 100644 --- a/app/views/admin/assets/_new.html.erb +++ b/app/views/admin/assets/_new.html.erb @@ -9,7 +9,7 @@ <%= link_back %> <%= f.submit t(:create) %> <% else %> - <%= t(:create) %> + <%= t(:create) %> <% end %> <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb index 4e47024c6..23229b5da 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb @@ -1,6 +1,6 @@ <% # encoding: utf-8 %> - <%= form_for(@bulletin_file, :remote => true, :url => @file_url) do |f| %> + <%= form_for @bulletin_file, :url => @file_url, :html => {:id => 'ajaxForm', :multipart => true} do |f| %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb index c884d0ad8..f340b00fe 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb @@ -1,18 +1,19 @@ - - <%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %> - <%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %> - - - - <%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %> - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %> - <% end %> - - - + + <%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %> + <%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %> + + + + <%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %> + <%= f.hidden_field :id %> + <%= hidden_field_tag :tr, (dom_id list_bulletin_file) %> + + <%= f.hidden_field :_destroy, :value => nil , :class => 'should_destroy' %> + <% end %> + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb index 33cb94986..462d357b8 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb @@ -1,19 +1,15 @@ - - - <%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %> - <%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %> - - - - <%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %> - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %> - <% end %> - - - - - - - \ No newline at end of file + + <%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %> + <%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %> + + + + <%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %> + <%= f.hidden_field :id %> + <%= hidden_field_tag :tr, (dom_id list_bulletin_link) %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb index 8360ad42a..8daa6a266 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb @@ -1,7 +1,7 @@
- +
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 78532f00f..89872e5e8 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -14,6 +14,12 @@ <%= render :partial => "bulletin_link_qe" %> + +
+ +
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
Chinese