From ca735e43ce9521425b6925062edb4c2f7353d280 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Feb 2012 15:23:27 +0800 Subject: [PATCH] announcement_category edit --- app/assets/javascripts/bulletin_form.js.erb | 4 ++ config/routes.rb | 1 - .../back_end/bulletin_categorys_controller.rb | 57 +++++++++++++++---- .../back_end/bulletins_controller.rb | 17 +++--- .../announcement/app/models/bulletin.rb | 29 +++++++--- .../app/models/bulletin_category.rb | 5 +- .../announcement/app/models/bulletin_link.rb | 13 +++++ .../_bulletin_category.html.erb | 13 +++++ .../bulletin_categorys/_form.html.erb | 52 ++++++++++------- .../bulletin_categorys/_form1.html.erb | 35 ++++++++++++ .../back_end/bulletin_categorys/create.js.erb | 2 + .../bulletin_categorys/destroy.js.erb | 1 + .../back_end/bulletin_categorys/edit.js.erb | 1 + .../bulletin_categorys/index.html.erb | 28 ++++----- .../back_end/bulletin_categorys/new.js.erb | 1 + .../bulletin_categorys/quick_edit.js.erb | 3 + .../back_end/bulletin_categorys/update.js.erb | 4 ++ .../bulletins/_bulletin_link.html.erb | 21 +++++++ .../back_end/bulletins/_bulletins.html.erb | 18 ++++++ .../back_end/bulletins/_form.html.erb | 54 ++++++++++-------- .../back_end/bulletins/destroy.js.erb | 1 + .../back_end/bulletins/index.html.erb | 26 ++------- .../back_end/bulletins/show.html.erb | 6 +- .../front_end/bulletins/show.html.erb | 12 ++-- .../announcement/config/routes.rb | 4 +- 25 files changed, 286 insertions(+), 122 deletions(-) create mode 100644 vendor/built_in_modules/announcement/app/models/bulletin_link.rb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form1.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/create.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/edit.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/update.js.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/destroy.js.erb diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index abde957f..5002cfae 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,3 +1,7 @@ +$('.bulletin_urls_block a.delete').live('click', function(){ + $(this).parents('.list_item').remove(); +}); + $('.bulletin_files_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); diff --git a/config/routes.rb b/config/routes.rb index f2b4cc17..2946c901 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,6 @@ PrototypeR4::Application.routes.draw do match '/site/public_key', :to => CentralServerExchangeApp match '/site/update', :to => GithubApp match '/purchase/:type', :to => CentralServerExchangeApp - # routes for admin namespace :admin do 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 fb06768f..3bb7d54b 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 @@ -4,10 +4,14 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon def index @bulletin_categorys = BulletinCategory.all - + @bulletin_category = BulletinCategory.new(:display => 'List') + + @url = panel_announcement_back_end_bulletin_categorys_path + respond_to do |format| format.html # index.html.erb - format.xml { render :xml => @bulletins } + # format.xml { render :xml => @bulletins } + format.js end end @@ -18,25 +22,47 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon respond_to do |format| format.html # show.html.erb - format.xml { render :xml => @bulletin_category } + # format.xml { render :xml => @bulletin_category } + format.js end end # GET /bulletins/new # GET /bulletins/new.xml def new - @bulletin_category = BulletinCategory.new + @bulletin_category = BulletinCategory.new(:display => 'List') respond_to do |format| format.html # new.html.erb - format.xml { render :xml => @bulletin_category } + # format.xml { render :xml => @bulletin_category } + format.js end end + def quick_edit + # debugger + + @bulletin_category = BulletinCategory.find(params[:bulletin_category_id]) + + @url = panel_announcement_back_end_bulletin_category_path(@bulletin_category) + + respond_to do |format| + format.js + end + + end + # GET /bulletins/1/edit def edit @bulletin_category = BulletinCategory.find(params[:id]) - @i18n_variable = @bulletin_category.i18n_variable + @i18n_variable = @bulletin_category.i18n_variable + + @url = panel_announcement_back_end_bulletin_category_path(@bulletin_category) + + respond_to do |format| + format.html + format.js + end end # POST /bulletins @@ -46,12 +72,14 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon respond_to do |format| if @bulletin_category.save - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin_category), :notice => t('announcement.create_bulletin_success')) } + # format.html { redirect_to @bulletin_category, notice: 'Entry was successfully created.' } format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('announcement.create_bulletin_category_success')) } - format.xml { render :xml => @bulletin_category, :status => :created, :location => @bulletin_category } + # format.xml { render :xml => @bulletin_category, :status => :created, :location => @bulletin_category } + format.js else format.html { render :action => "new" } - format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity } + # format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity } + format.js { render action: "new" } end end end @@ -60,15 +88,19 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon # PUT /bulletins/1.xml def update @bulletin_category = BulletinCategory.find(params[:id]) + + @url = panel_announcement_back_end_bulletin_category_path(@bulletin_category) 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.xml { head :ok } + # format.xml { head :ok } + format.js else format.html { render :action => "edit" } - format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity } + format.js { render :action => "edit" } + # format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity } end end end @@ -81,7 +113,8 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon respond_to do |format| format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) } - format.xml { head :ok } + # format.xml { head :ok } + format.js 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 d2f17eeb..c28e7e54 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 @@ -120,19 +120,20 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController respond_to do |format| format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - format.xml { head :ok } + # format.xml { head :ok } + format.js end end - def top_edit + # def top_edit - Bulletin.where(id: params[:id]).update_all( is_top: true ) - respond_to do |format| - format.html { redirect_to(panel_announcement_back_end_bulletins_url) } - format.xml { head :ok } - end + # Bulletin.where(id: params[:id]).update_all( is_top: true ) + # respond_to do |format| + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + # format.xml { head :ok } + # end - end + # end protected diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index ad1a81bc..c65e65f7 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -6,15 +6,15 @@ class Bulletin include Mongoid::MultiParameterAttributes # field :category_id, :type => Integer - # field :title - has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - # field :subtitle - # field :text + field :title + # has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + # has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + # has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + field :subtitle + field :text field :postdate , :type => Date field :deadline , :type => Date - field :url + # field :url field :create_user_id field :update_user_id @@ -24,15 +24,18 @@ class Bulletin belongs_to :bulletin_category - # embeds_many :bulletin_files + embeds_many :bulletin_links, :cascade_callbacks => true embeds_many :bulletin_files, :cascade_callbacks => true # has_many :bulletin_files, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :bulletin_files, :allow_destroy => true + accepts_nested_attributes_for :bulletin_links, :allow_destroy => true - validates_presence_of :title_variable + # validates_presence_of :title_variable + validates_presence_of :title + after_save :save_bulletin_links after_save :save_bulletin_files @@ -79,6 +82,14 @@ class Bulletin self.is_top end + def save_bulletin_links + self.bulletin_links.each do |t| + if t.should_destroy + t.destroy + end + end + end + def save_bulletin_files self.bulletin_files.each do |t| if t.should_destroy diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index bff246d1..f5da3ad7 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -5,8 +5,11 @@ class BulletinCategory include Mongoid::Timestamps # include Mongoid::MultiParameterAttributes + PAYMENT_TYPES = [ "List", "Picture" ] + field :key - # field :name + field :display + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_many :bulletins diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb new file mode 100644 index 00000000..a999d45d --- /dev/null +++ b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb @@ -0,0 +1,13 @@ +class BulletinLink + + include Mongoid::Document + include Mongoid::Timestamps + + field :url + field :name + + field :should_destroy, :type => Boolean + + embedded_in :bulletin + +end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb new file mode 100644 index 00000000..57998770 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -0,0 +1,13 @@ + + + <%= bulletin_category.key %> + <% @site_valid_locales.each do |locale| %> + <%= bulletin_category.i18n_variable[locale] rescue nil %> + <% end %> + <%= bulletin_category.display %> + + <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | + <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | + <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> + + \ No newline at end of file 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 68c12afd..d7bfac7b 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 @@ -1,29 +1,37 @@ +<% # encoding: utf-8 %> -
- - - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - - - - - <% end %> - <% end %> - - -
<%= t('bulletin_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field :key %> - <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= f.text_field locale, :style => "width:130px" %>
-
+<%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %> +<%#= form_for(@bulletin_category, :remote => true, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category)) do |f| %> + +
+ <%= f.label :key %>
+ <%= f.text_field :key %> +
+ +
+ <%= f.label :name %>
+ <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> + <%= f.text_field locale, :style => "width:130px" %> + <% end %> + <% end %> +
+ +
+ <%= f.label :display %>
+ <%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %> + + <%= f.radio_button :display, "List" %>List + <%#= f.label :display, 'list', :value => '1', :checked => @a %> + <%= f.radio_button :display, "Picture" %>Picture + <%#= f.label :display, 'picture', :value => '2', :checked => @b %> +
顯示方式是設定在前台頁面時,資訊所呈現的樣式 +
<%= f.submit %>
+<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form1.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form1.html.erb new file mode 100644 index 00000000..1499192b --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form1.html.erb @@ -0,0 +1,35 @@ +<% # encoding: utf-8 %> + + + +
+ <%= f.label :key %>
+ <%= f.text_field :key %> +
+ +
+ <%= f.label :name %>
+ <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> + <%= f.text_field locale, :style => "width:130px" %> + <% end %> + <% end %> +
+ +
+ <%= f.label :display %>
+ <%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %> + + <%= f.radio_button :display, "List" %>List + <%#= f.label :display, 'list', :value => '1', :checked => @a %> + <%= f.radio_button :display, "Picture" %>Picture + <%#= f.label :display, 'picture', :value => '2', :checked => @b %> +
顯示方式是設定在前台頁面時,資訊所呈現的樣式 +
+ +
+ <%= f.submit %> +
+ + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/create.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/create.js.erb new file mode 100644 index 00000000..e914aacd --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/create.js.erb @@ -0,0 +1,2 @@ +$('<%= j render :partial => 'bulletin_category', :collection => [@bulletin_category] %>').appendTo('#bulletin_categorys').hide().fadeIn(); +$("#new_bulletin_category")[0].reset(); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb new file mode 100644 index 00000000..882b13d2 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @bulletin_category %>").remove(); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/edit.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/edit.js.erb new file mode 100644 index 00000000..eaff01fa --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/edit.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index ee7fbd6d..87a2993c 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -5,7 +5,7 @@

<% end -%> @@ -17,28 +17,28 @@


- +
<% @site_valid_locales.each do |locale| %> <% end %> + -<% @bulletin_categorys.each do |post| %> - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - -<% end %> +<%# @bulletin_categorys.each do |post| %> + <%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %> +<%# end %>
<%= t('bulletin_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('bulletin_category.display') %> <%= t('bulletin.action') %>
<%= post.key %><%= post.i18n_variable[locale] rescue nil %> - <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(post) %> | - <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(post), :confirm => t('announcement.sure?'), :method => :delete %> -
+
+
+

+

Add New

+
<%= render :partial => "form" %>
+ + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.js.erb new file mode 100644 index 00000000..40061b9f --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb new file mode 100644 index 00000000..7db1d0f8 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb @@ -0,0 +1,3 @@ +$.each($(".quick_edit"),function(obj){ $(this).remove(); }); +$("#<%= dom_id @bulletin_category %>").append("
<%= j render "form" %>
"); +//$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/update.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/update.js.erb new file mode 100644 index 00000000..728757e3 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/update.js.erb @@ -0,0 +1,4 @@ +$("#<%= dom_id @bulletin_category %>").replaceWith("<%= j render :partial => 'bulletin_category', :collection => [@bulletin_category] %>"); +<% @bulletin_category = BulletinCategory.new(:display => 'List') # reset for new form %> +$(".edit_bulletin_category").replaceWith("<%= j render "form" %>") +$(".new_bulletin_category")[0].reset(); \ No newline at end of file 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/_bulletin_link.html.erb new file mode 100644 index 00000000..44c7ab75 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb @@ -0,0 +1,21 @@ + +
" class='list_item'> +
+ + <%= f.label :link_url %> + <%= f.text_field :url %> + + <%= f.label :link_name %> + <%= f.text_field :name %> + + + <% if bulletin_link.new_record? %> + <%= t(:delete) %> + <% else %> + <%= f.hidden_field :id %> + <%= t(:delete) %> + <%= 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/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb new file mode 100644 index 00000000..f94cac5b --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb @@ -0,0 +1,18 @@ + + + + <%= post.bulletin_category.i18n_variable[I18n.locale] %> + <%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %> + <%= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> + + <%= post.postdate %> + <%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %> + + <%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> | + + <%= link_to t(:set_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %> + <%= link_to t(:cancel_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %> + + | <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(post), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> + + 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 df81381a..b222d77e 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 @@ -18,35 +18,17 @@
<%= f.label :title %>
- <%#= f.text_field :title %> - <%= f.fields_for :title_variable, (@bulletin.new_record? ? @bulletin.build_title_variable : @bulletin.title_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> - <%= f.text_field locale, :style => "width:130px" %> - <% end %> - <% end %> + <%= f.text_field :title %>
<%= f.label :subtitle %>
- <%#= f.text_area :subtitle, :rows => 10, :cols => 40 %> - <%= f.fields_for :subtitle_variable, (@bulletin.new_record? ? @bulletin.build_subtitle_variable : @bulletin.subtitle_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> - <% end %> - <% end %> + <%= f.text_area :subtitle, :rows => 10, :cols => 40 %>
<%= f.label :text %>
- <%#= f.text_area :text, :rows => 10, :cols => 40 %> - <%= f.fields_for :text_variable, (@bulletin.new_record? ? @bulletin.build_text_variable : @bulletin.text_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> - <% end %> - <% end %> + <%= f.text_area :text, :rows => 10, :cols => 40 %>
@@ -62,11 +44,31 @@
- <%= f.label :url %>
- <%= f.text_field :url, :size => 60 %> + <%#= f.label :url %>
+ <%#= f.text_field :url, :size => 60 %>
+ +
@@ -101,6 +103,12 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "bulletin_form" %>