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 894d82c1..24fee4d2 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(); }); @@ -17,4 +17,6 @@ $('.action a.remove_existing_record').live('click', function(){ $('.quick_edit_cancel').live('click', function(){ tr = $(this).attr('rel'); $('#' + tr).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 c81ed4d1..31f446a0 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)); }); <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb similarity index 66% rename from vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb rename to vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb index ef2d4bc7..65ac2fb8 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb @@ -1,5 +1,5 @@ - " class='list_item'> + " class='list_item'>
@@ -8,7 +8,7 @@
- <%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %> + <%= f.fields_for :filetitle, (form_bulletin_file.new_record? ? form_bulletin_file.build_filetitle : form_bulletin_file.filetitle ) do |f| %> <% @site_valid_locales.each do |locale| %>
@@ -20,7 +20,7 @@ <% end %> - <%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %> + <%= f.fields_for :description, (form_bulletin_file.new_record? ? form_bulletin_file.build_description : form_bulletin_file.description ) do |f| %> <% @site_valid_locales.each do |locale| %>
@@ -33,11 +33,11 @@ - <% if bulletin_file.new_record? %> - + <% if form_bulletin_file.new_record? %> + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb similarity index 59% rename from vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb rename to vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb index c8503083..560e561d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb @@ -1,5 +1,5 @@ - " class='list_item'> + " class='list_item'>
@@ -9,7 +9,7 @@
- <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %> + <%= f.fields_for :i18n_variable, (form_bulletin_link.new_record? ? form_bulletin_link.build_i18n_variable : form_bulletin_link.i18n_variable) do |f| %> <% @site_valid_locales.each do |locale| %>
@@ -25,11 +25,11 @@ - <% if bulletin_link.new_record? %> - + <% if form_bulletin_link.new_record? %> + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> 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 new file mode 100644 index 00000000..c884d0ad --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb @@ -0,0 +1,21 @@ + + + <%= 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 %> + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 00000000..33cb9498 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb @@ -0,0 +1,19 @@ + + + <%= 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 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 e1999aef..8360ad42 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 @@ -11,52 +11,16 @@ - - ADD/新增 + + <%= t('add')%> - - - … - … - - + + <%= render :partial => 'list_bulletin_file', :collection => bulletin.bulletin_files %>
- +
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb index 7981c2bd..5fea2ded 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb @@ -1,7 +1,7 @@ diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_file.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_file.js.erb new file mode 100644 index 00000000..303a804a --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_file.js.erb @@ -0,0 +1,2 @@ +$("#modal-file").modal('hide'); +$('<%= j render :partial => 'list_bulletin_file', :collection => [@bulletin_file] %>').appendTo('#bulletin_files').hide().fadeIn(); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_link.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_link.js.erb new file mode 100644 index 00000000..7d38ed6c --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/create_bulletin_link.js.erb @@ -0,0 +1,2 @@ +$("#modal-link").modal('hide'); +$('<%= j render :partial => 'list_bulletin_link', :collection => [@bulletin_link] %>').appendTo('#bulletin_links').hide().fadeIn(); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb index 56cfd258..ffe288cd 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb @@ -4,4 +4,4 @@ <%= render :partial => 'form', :locals => {:f => f} %> <% end %> -<%= link_back %> +<%#= link_back %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_add.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_add.js.erb new file mode 100644 index 00000000..87ded867 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_add.js.erb @@ -0,0 +1 @@ +$("#modal-file").html("<%= j render "bulletin_file_qe" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_edit.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_edit.js.erb new file mode 100644 index 00000000..87ded867 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/file_quick_edit.js.erb @@ -0,0 +1 @@ +$("#modal-file").html("<%= j render "bulletin_file_qe" %>"); 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 1fa59469..116455c5 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 @@ -2,6 +2,19 @@ <%= render 'bulletins' %>
+ + + +
+ +
+
<%= 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' %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_add.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_add.js.erb new file mode 100644 index 00000000..4e0f8039 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_add.js.erb @@ -0,0 +1 @@ +$("#modal-link").html("<%= j render "bulletin_link_qe" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb index cbe5e3c7..4e0f8039 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb @@ -1,2 +1 @@ -//$.each($(".quick_edit"),function(obj){ $(this).remove(); }); -$("#<%= "bulletin_#{bulletin_link2.id}" %>").append("<%= j render "bulletin_link_qe" %>"); +$("#modal-link").html("<%= j render "bulletin_link_qe" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb index 74e1291a..c05b645b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb @@ -1,5 +1,5 @@ -<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %> +<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path, :html => {:class => 'clear'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> -<%= link_back %> +<%#= link_back %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_file.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_file.js.erb new file mode 100644 index 00000000..bcfedb76 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_file.js.erb @@ -0,0 +1,2 @@ +$("#modal-file").modal('hide'); +$("#<%= dom_id @bulletin_file %>").replaceWith("<%= j render :partial => 'list_bulletin_file', :collection => [@bulletin_file] %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_link.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_link.js.erb new file mode 100644 index 00000000..2f21aec8 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/update_bulletin_link.js.erb @@ -0,0 +1,2 @@ +$("#modal-link").modal('hide'); +$("#<%= dom_id @bulletin_link %>").replaceWith("<%= j render :partial => 'list_bulletin_link', :collection => [@bulletin_link] %>"); diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 14eec7a2..7ac33a90 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -13,10 +13,22 @@ Rails.application.routes.draw do member do get 'load_quick_edit' end + match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add + match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit end + resources :bulletin_categorys, :controller => 'bulletin_categorys' do match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit end + + resources :bulletin_links, :controller => 'bulletin_links' do + match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit + end + + resources :bulletin_files, :controller => 'bulletin_files' do + match "file_quick_edit/:bulletin_file_id" => "bulletin_files#file_quick_edit" ,:as => :file_quick_edit + end + resources :tags end namespace :front_end do diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb index 258aa55c..3c734bb0 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb @@ -23,7 +23,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" %>
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb index 86f2398c..7b969d4e 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb @@ -1,7 +1,7 @@

<%= t('page_content.editing_page_content') %>

-<%= form_for @page_context, :url => panel_page_content_back_end_page_context_path(@page_context) do |f| %> +<%= form_for @page_context, :url => panel_page_content_back_end_page_context_path(@page_context), :html => {:class => 'clear'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb index 0ba3236a..f023995b 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb @@ -35,19 +35,6 @@ class Panel::WebResource::BackEnd::WebLinkCategorysController < ApplicationContr format.js end end - - def quick_edit - # debugger - - @web_link_category = WebLinkCategory.find(params[:web_link_category_id]) - - @url = panel_web_resource_back_end_web_link_category_path(@web_link_category) - - respond_to do |format| - format.js - end - - end # GET /web_links/1/edit def edit diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb index dfe09ce5..064a6d46 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb @@ -64,7 +64,7 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController respond_to do |format| if @web_link.save - format.html { redirect_to(panel_web_resource_back_end_web_links_url, :notice => t('web_resource.create_web_resource_success')) } + format.html { redirect_to(panel_web_resource_back_end_web_links_url) } format.xml { render :xml => @web_link, :status => :created, :location => @web_link } else format.html { render :action => "new" } @@ -84,7 +84,7 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController respond_to do |format| if @web_link.update_attributes(params[:web_link]) - format.html { redirect_to(panel_web_resource_back_end_web_links_url, :notice => t('web_resource.update_web_resource_success')) } + format.html { redirect_to(panel_web_resource_back_end_web_links_url) } format.js { render 'toggle_enable' } format.xml { head :ok } else diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb index 3f6a1a71..9d43b94c 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb @@ -6,7 +6,7 @@
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb index 2abdf4a0..de163012 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb @@ -25,12 +25,12 @@

Tags

-
- <% @tags.each do |tag| %> - <%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%> - <%= tag[I18n.locale] %> - <% end %> -
+
+ <% @tags.each do |tag| %> + <%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <% end %> +
@@ -89,13 +89,16 @@ <% end %> <% end %> + + + + + + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
- - - - -
- <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> -
\ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/destroy.js.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/destroy.js.erb index 05490b09..b0fbcf1f 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/destroy.js.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/destroy.js.erb @@ -1 +1 @@ -$("#<%= dom_id @bulletin %>").remove(); \ No newline at end of file +$("#<%= dom_id @web_link %>").remove(); \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/edit.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/edit.html.erb index 3bf35d16..f70cb1ea 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/edit.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/edit.html.erb @@ -1,16 +1,5 @@ -
-
-
-
-

<%= t('web_resource.editing_web_resource') %>

-<%= form_for @web_link, :url => panel_web_resource_back_end_web_link_path(@web_link) do |f| %> +<%= form_for @web_link, :url => panel_web_resource_back_end_web_link_path(@web_link), :html => {:class => 'clear'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> - -<%= link_back %> -
-
-
-
\ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/new.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/new.html.erb index 5bc81f44..5e29d138 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/new.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/new.html.erb @@ -1,24 +1,9 @@ -
-
-
-
- -<% content_for :secondary do %> - -<% end -%> <%= flash_messages %>

<%= t('web_link.new_web_resource') %>

-<%= form_for @web_link, :url => panel_web_resource_back_end_web_links_path do |f| %> +<%= form_for @web_link, :url => panel_web_resource_back_end_web_links_path, :html => {:class => 'clear'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> -<%= link_back %> +<%#= link_back %> - - -
-
-
\ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/config/routes.rb b/vendor/built_in_modules/web_resource/config/routes.rb index 6783cc99..ca0c5d0d 100644 --- a/vendor/built_in_modules/web_resource/config/routes.rb +++ b/vendor/built_in_modules/web_resource/config/routes.rb @@ -5,9 +5,7 @@ Rails.application.routes.draw do namespace :back_end do root :to => "web_links#index" resources :web_links - resources :web_link_categorys, :controller => 'web_link_categorys' do - match "quick_edit/:web_link_category_id" => "web_link_categorys#quick_edit" ,:as => :quick_edit - end + resources :web_link_categorys resources :tags end namespace :front_end do