From 42519d9f78e358d11209447f3fc6e0cfbead9450 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Mar 2012 18:04:11 +0800 Subject: [PATCH] fix announcement & links --- app/assets/javascripts/bootstrap.js | 7 +- app/assets/javascripts/bulletin_form.js.erb | 7 +- .../back_end/bulletin_categorys_controller.rb | 2 +- .../back_end/bulletin_files_controller.rb | 48 +++++ .../back_end/bulletin_links_controller.rb | 49 +++++ .../back_end/bulletins_controller.rb | 172 ++++++++++++++---- .../bulletin_categorys/_form.html.erb | 10 +- .../bulletin_categorys/_quick_edit.html.erb | 13 -- .../bulletins/_bulletin_file_qe.html.erb | 51 ++++++ .../bulletins/_bulletin_link2.html.erb | 17 -- .../bulletins/_bulletin_link_qe.html.erb | 30 +-- .../back_end/bulletins/_form.html.erb | 19 +- ....html.erb => _form_bulletin_file.html.erb} | 12 +- ....html.erb => _form_bulletin_link.html.erb} | 10 +- .../bulletins/_list_bulletin_file.html.erb | 21 +++ .../bulletins/_list_bulletin_link.html.erb | 19 ++ .../bulletins/_quick_edit_files.html.erb | 46 +---- .../bulletins/_quick_edit_links.html.erb | 45 +---- .../bulletins/create_bulletin_file.js.erb | 2 + .../bulletins/create_bulletin_link.js.erb | 2 + .../back_end/bulletins/edit.html.erb | 2 +- .../back_end/bulletins/file_quick_add.js.erb | 1 + .../back_end/bulletins/file_quick_edit.js.erb | 1 + .../back_end/bulletins/index.html.erb | 13 ++ .../back_end/bulletins/link_quick_add.js.erb | 1 + .../back_end/bulletins/link_quick_edit.js.erb | 3 +- .../back_end/bulletins/new.html.erb | 4 +- .../bulletins/update_bulletin_file.js.erb | 2 + .../bulletins/update_bulletin_link.js.erb | 2 + .../announcement/config/routes.rb | 12 ++ .../back_end/page_contexts/_form.html.erb | 3 +- .../back_end/page_contexts/edit.html.erb | 2 +- .../back_end/web_link_categorys_controller.rb | 13 -- .../back_end/web_links_controller.rb | 4 +- .../_web_link_category.html.erb | 2 +- .../back_end/web_links/_form.html.erb | 29 +-- .../back_end/web_links/destroy.js.erb | 2 +- .../back_end/web_links/edit.html.erb | 13 +- .../back_end/web_links/new.html.erb | 19 +- .../web_resource/config/routes.rb | 4 +- 40 files changed, 446 insertions(+), 268 deletions(-) create mode 100644 vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb create mode 100644 vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb delete mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb delete mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb rename vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/{_bulletin_file.html.erb => _form_bulletin_file.html.erb} (66%) rename vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/{_bulletin_link.html.erb => _form_bulletin_link.html.erb} (59%) create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_file.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_link.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_add.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_edit.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_add.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_file.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_link.js.erb diff --git a/app/assets/javascripts/bootstrap.js b/app/assets/javascripts/bootstrap.js index b822d62b..116cfe61 100644 --- a/app/assets/javascripts/bootstrap.js +++ b/app/assets/javascripts/bootstrap.js @@ -68,8 +68,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ - - + !function( $ ){ "use strict" @@ -130,6 +129,7 @@ var that = this this.isShown = false + //alert(this.isShown+":"+this.$element.attr('class')) $('body').removeClass('modal-open') @@ -138,7 +138,7 @@ this.$element .trigger('hide') .removeClass('in') - + $.support.transition && this.$element.hasClass('fade') ? hideWithTransition.call(this) : hideModal.call(this) @@ -146,7 +146,6 @@ } - /* MODAL PRIVATE METHODS * ===================== */ diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index a427667d..0efd4b25 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,9 +1,9 @@ -$('.bulletin_links_block a.remove_existing_record').live('click', function(){ +$('.bulletin_links_block a.delete').live('click', function(){ //$(this).parents('.list_item').remove(); $(this).parents('tr.list_item').remove(); }); -$('.bulletin_files_block a.remove_existing_record').live('click', function(){ +$('.bulletin_files_block a.delete').live('click', function(){ //$(this).parents('.list_item').remove(); $(this).parents('tr.list_item').remove(); }); @@ -11,5 +11,6 @@ $('.bulletin_files_block a.remove_existing_record').live('click', function(){ $('.action a.remove_existing_record').live('click', function(){ $(this).next('.should_destroy').attr('value', 1); //$("#bulletin_" + $(this).prev().attr('value')).hide(); - $("tr#bulletin_" + $(this).prev().attr('value')).hide(); + $("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); + $("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); }); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index 92bf922f..f55ad6e3 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -94,7 +94,7 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon respond_to do |format| if @bulletin_category.update_attributes(params[:bulletin_category]) # format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) } - format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) } + # format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) } # format.xml { head :ok } format.js else diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb new file mode 100644 index 00000000..223e2ba5 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb @@ -0,0 +1,48 @@ +class Panel::Announcement::BackEnd::BulletinFilesController < ApplicationController + + layout 'new_admin' + + def index + @bulletin_files = BulletinFile.all + + respond_to do |format| + format.html # index.html.erb + # format.xml { render :xml => @bulletins } + format.js + end + + end + + # POST /bulletins + # POST /bulletins.xml + def create + @bulletin_file = BulletinFile.new(params[:bulletin_file]) + + respond_to do |format| + if @bulletin_file.save + format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js + else + format.html { render :action => "new" } + format.js { render action: "new" } + end + end + end + + # PUT /bulletins/1 + # PUT /bulletins/1.xml + def update + @bulletin_file = BulletinFile.find(params[:id]) + + respond_to do |format| + if @bulletin_file.update_attributes(params[:bulletin_file]) + format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js + else + format.html { render :action => "edit" } + format.js { render :action => "edit" } + end + end + end + +end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb new file mode 100644 index 00000000..59f164d9 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb @@ -0,0 +1,49 @@ +class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController + + layout 'new_admin' + + def index + @bulletin_links = BulletinLink.all + + respond_to do |format| + format.html # index.html.erb + # format.xml { render :xml => @bulletins } + format.js + end + + end + + # POST /bulletins + # POST /bulletins.xml + def create + @bulletin_link = BulletinLink.new(params[:bulletin_link]) + # @bulletin_link.bulletin_id = params[:bulletin_link][:bulletin_id] + + respond_to do |format| + if @bulletin_link.save + format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js + else + format.html { render :action => "new" } + format.js { render action: "new" } + end + end + end + + # PUT /bulletins/1 + # PUT /bulletins/1.xml + def update + @bulletin_link = BulletinLink.find(params[:id]) + + respond_to do |format| + if @bulletin_link.update_attributes(params[:bulletin_link]) + format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js + else + format.html { render :action => "edit" } + format.js { render :action => "edit" } + end + end + end + +end 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 0eda0723..afcf58b7 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 @@ -14,9 +14,15 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletins = Bulletin.search(params[:search], params[:category_id]) # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) - @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all + @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.limit(1).desc("postdate") @bulletin_categories = BulletinCategory.all - + + @bulletin_link = BulletinLink.new + @link_url = panel_announcement_back_end_bulletins_path + + @bulletin_file = BulletinFile.new + @file_url = panel_announcement_back_end_bulletins_path + respond_to do |format| format.html # index.html.erb format.js @@ -78,30 +84,58 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # POST /bulletins # POST /bulletins.xml def create - @bulletin = Bulletin.new(params[:bulletin]) - @bulletin.create_user_id = current_user.id - @bulletin.update_user_id = current_user.id + if params[:bulletin_link] + + @bulletin_link = BulletinLink.new(params[:bulletin_link]) - respond_to do |format| - if @bulletin.save - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('announcement.create_bulletin_success')) } - format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) } - format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } - else - format.html { render :action => "new" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - end - end + respond_to do |format| + if @bulletin_link.save + format.js { render 'create_bulletin_link' } + end + end + + elsif params[:bulletin_file] + + @bulletin_file = BulletinFile.new(params[:bulletin_file]) + + respond_to do |format| + if @bulletin_file.save + format.js { render 'create_bulletin_file' } + end + end + + else + + @bulletin = Bulletin.new(params[:bulletin]) + + @bulletin.create_user_id = current_user.id + @bulletin.update_user_id = current_user.id + + respond_to do |format| + if @bulletin.save + # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('announcement.create_bulletin_success')) } + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) } + format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } + format.js + else + format.html { render :action => "new" } + format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } + end + end + + end + end def link_quick_add # debugger - - @bulletin = Bulletin.find(params[:bulletin_id]) - + + @bulletin_link = BulletinLink.new @link_url = panel_announcement_back_end_bulletins_path + @bulletin_link.bulletin_id = params[:bulletin_id] + respond_to do |format| format.js end @@ -110,10 +144,39 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def link_quick_edit # debugger + @bulletin_link = BulletinLink.find(params[:bulletin_id]) - @bulletin = Bulletin.find(params[:bulletin_id]) + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) - @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + # @bulletin = Bulletin.find(params[:bulletin_id]) + + # @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + + respond_to do |format| + format.js + end + + end + + def file_quick_add + # debugger + + @bulletin_file = BulletinFile.new + @file_url = panel_announcement_back_end_bulletins_path + + @bulletin_file.bulletin_id = params[:bulletin_id] + + respond_to do |format| + format.js + end + + end + + def file_quick_edit + # debugger + @bulletin_file = BulletinFile.find(params[:bulletin_id]) + + @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) respond_to do |format| format.js @@ -124,28 +187,61 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # PUT /bulletins/1 # PUT /bulletins/1.xml def update - @bulletin = Bulletin.find(params[:id]) - @bulletin.update_user_id = current_user.id + if params[:bulletin_link] - # @bulletin.image.clear if params[:bulletin][:image_del] == '1' - # if params[:bulletin][:image_del] == '1' - # @bulletin.remove_image! - # @bulletin.image_del = nil - # params[:bulletin][:image_del] = nil - # end + @bulletin_link = BulletinLink.find(params[:id]) + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) - respond_to do |format| - if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } - format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } - format.js { render 'toggle_enable' } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - end + 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]) + + @bulletin.update_user_id = current_user.id + + # @bulletin.image.clear if params[:bulletin][:image_del] == '1' + # if params[:bulletin][:image_del] == '1' + # @bulletin.remove_image! + # @bulletin.image_del = nil + # params[:bulletin][:image_del] = nil + # end + + respond_to do |format| + if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save + # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } + format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } + end + end + end + + end # DELETE /bulletins/1 diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb index 1ce7f629..df0dc38c 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb @@ -23,14 +23,14 @@
- <%= f.label :display %> - <%= f.radio_button :display, "List" %>List - <%= f.radio_button :display, "Picture" %>Picture -
顯示方式是設定在前台頁面時,資訊所呈現的樣式 + <%#= f.label :display %> + <%#= f.radio_button :display, "List" List%> + <%#= f.radio_button :display, "Picture" Picture%> + <%#
顯示方式是設定在前台頁面時,資訊所呈現的樣式 %>
- <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> + <%= f.submit t('submit'), :class=>'btn btn-primary' %>
<% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb deleted file mode 100644 index 14a72951..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb +++ /dev/null @@ -1,13 +0,0 @@ - - - - <%= t(:quick_edit) %> - <%= form_for bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(bulletin_category), :html => {:class => 'form-horizontal'} do |f| %> - <%= render :partial => "quick_edit_qe", :locals => { :f => f, :bulletin_category => bulletin_category } %> -
- <%= f.submit t(:submit), :class => 'btn btn-primary' %> - <%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %> -
- <% 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 new file mode 100644 index 00000000..4e47024c --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb @@ -0,0 +1,51 @@ +<% # encoding: utf-8 %> + + <%= form_for(@bulletin_file, :remote => true, :url => @file_url) do |f| %> + + + + + + + + <% end %> + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb deleted file mode 100644 index a3bc5243..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - "> - <%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %> - <%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %> - - - - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - - - - - - - \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb index 7208f73c..b9006352 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb @@ -1,39 +1,41 @@ <% # encoding: utf-8 %> - <%= form_for(@bulletin.bulletin_links, :remote => true, :url => @link_url) do |f| %> + <%= form_for(@bulletin_link, :remote => true, :url => @link_url) do |f| %> - -
- <%= f.label :image, t('announcement.image') %>
- <%= f.file_field :image %> - <% if @bulletin.image.file %> - <%= check_box_tag 'bulletin[image_del]' %> - <%= t('announcement.刪除已上傳檔案') %> - <% end %> -
@@ -200,7 +192,7 @@ <% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %> <%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %> <%= f.fields_for :bulletin_links, bulletin_link do |f| %> - <%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %> + <%= render :partial => 'form_bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %> <% end %> <% end %> @@ -246,7 +238,7 @@ <% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %> <%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %> <%= f.fields_for :bulletin_files, bulletin_file do |f| %> - <%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %> + <%= render :partial => 'form_bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %> <% end %> <% end %> @@ -263,7 +255,8 @@
- <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> + <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %>
@@ -277,13 +270,13 @@ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_bulletin_links", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id)); + $(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id)); }); $('#add_bulletin_file a.add').live('click', function(){ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_bulletin_files", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); + $(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); });