diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index fcd5f205f..aba0e8143 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -207,31 +207,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # PUT /bulletins/1.xml def update - if params[:bulletin_link] - - @bulletin_link = BulletinLink.find(params[:id]) - @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) - - respond_to do |format| - if @bulletin_link.update_attributes(params[:bulletin_link]) - # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - format.js { render 'update_bulletin_link' } - end - end - - elsif params[:bulletin_file] - - @bulletin_file = BulletinFile.find(params[:id]) - @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) - respond_to do |format| - - if @bulletin_file.update_attributes(params[:bulletin_file]) - # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - format.js { render 'update_bulletin_file' } - end - end - - else @bulletin = Bulletin.find(params[:id]) @@ -362,10 +337,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def clean_values if params[:bulletin] params[:bulletin][:bulletin_links_attributes].each_with_index do |link, index| - params[:bulletin][:bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title'].blank? + params[:bulletin][:bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title_translations'].blank? end rescue nil params[:bulletin][:bulletin_files_attributes].each_with_index do |link, index| - params[:bulletin][:bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title'].blank? + params[:bulletin][:bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title_translations'].blank? end rescue nil end end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 42407007b..85d1b6542 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -51,7 +51,7 @@ class Bulletin validates :title, :at_least_one => true - before_save :check_deadline, :update_avliable_language, :clean_values + before_save :check_deadline, :update_avliable_language, :clean_values#, :save_bulletin_links, :save_bulletin_files searchable do text :titles do diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 021820087..77ac7c9e5 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -253,39 +253,16 @@

<%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %>

<%= t("sys.preview_only_for_img") %>

-
- - - - - - - - - - - - - - - - - - - -
File NameChineseEnglish
File Name
-
- - <%# @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %> + <% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %> <%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %> - <%#= f.fields_for :bulletin_files do |f| %> - <%#= render :partial => 'form_bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %> - <%# end %> - <%# end %> + <%= f.fields_for :bulletin_files, bulletin_file do |f| %> + <%= render :partial => 'form_bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb index 24214877a..a1697b2aa 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb @@ -59,16 +59,16 @@ - - <% if form_bulletin_file.new_record? %> - - <% else %> - <%= f.hidden_field :id %> - <%= hidden_field_tag :tr, (dom_id form_bulletin_file) %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - <% end %> - + + <% if form_bulletin_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + <%= hidden_field_tag :tr, (dom_id form_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/_form_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb index 1ff3907fd..c0b7f710a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb @@ -41,7 +41,7 @@ <%= f.hidden_field :id %> <%= hidden_field_tag :tr, (dom_id form_bulletin_link) %> - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> <% end %>