From 3e70634add4debb879934ea0b8c10dd771c8bd0a Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 15 Feb 2012 00:32:20 +0800 Subject: [PATCH] Announcement modifications and tags --- app/assets/javascripts/orbit-1.0.js | 2 +- app/controllers/admin/tags_controller.rb | 48 ++++++++ app/models/i18n_variable.rb | 4 + app/models/module_app.rb | 2 + app/models/tag.rb | 9 ++ app/views/admin/tags/_add.html.erb | 7 ++ app/views/admin/tags/_form.html.erb | 7 ++ app/views/admin/tags/_tag.html.erb | 8 ++ app/views/admin/tags/create.js.erb | 4 + app/views/admin/tags/edit.js.erb | 1 + app/views/admin/tags/index.html.erb | 6 + app/views/admin/tags/update.js.erb | 1 + app/views/kaminari/_first_page.html.erb | 11 ++ app/views/kaminari/_gap.html.erb | 8 ++ app/views/kaminari/_last_page.html.erb | 11 ++ app/views/kaminari/_next_page.html.erb | 11 ++ app/views/kaminari/_page.html.erb | 12 ++ app/views/kaminari/_paginator.html.erb | 23 ++++ app/views/kaminari/_prev_page.html.erb | 11 ++ config/locales/en.yml | 3 + config/routes.rb | 1 + .../back_end/bulletins_controller.rb | 8 +- .../announcement/back_end/tags_controller.rb | 8 ++ .../announcement/app/models/bulletin.rb | 6 +- .../announcement/app/models/bulletin_image.rb | 9 -- .../back_end/bulletins/_bulletin.html.erb | 48 ++++++++ .../back_end/bulletins/_bulletins.html.erb | 18 --- .../back_end/bulletins/_filter.html.erb | 56 +++++++++ .../back_end/bulletins/_form.html.erb | 15 ++- .../back_end/bulletins/_quick_edit.html.erb | 16 +++ .../bulletins/_quick_edit_basic.html.erb | 62 ++++++++++ .../bulletins/_quick_edit_files.html.erb | 62 ++++++++++ .../bulletins/_quick_edit_links.html.erb | 62 ++++++++++ .../bulletins/_quick_edit_picture.html.erb | 19 +++ .../bulletins/_quick_edit_tags.html.erb | 44 +++++++ .../back_end/bulletins/index.html.erb | 108 ++++-------------- .../back_end/bulletins/new.html.erb | 20 +--- .../announcement/config/routes.rb | 7 +- 38 files changed, 615 insertions(+), 143 deletions(-) create mode 100644 app/controllers/admin/tags_controller.rb create mode 100644 app/models/tag.rb create mode 100644 app/views/admin/tags/_add.html.erb create mode 100644 app/views/admin/tags/_form.html.erb create mode 100644 app/views/admin/tags/_tag.html.erb create mode 100644 app/views/admin/tags/create.js.erb create mode 100644 app/views/admin/tags/edit.js.erb create mode 100644 app/views/admin/tags/index.html.erb create mode 100644 app/views/admin/tags/update.js.erb create mode 100644 app/views/kaminari/_first_page.html.erb create mode 100644 app/views/kaminari/_gap.html.erb create mode 100644 app/views/kaminari/_last_page.html.erb create mode 100644 app/views/kaminari/_next_page.html.erb create mode 100644 app/views/kaminari/_page.html.erb create mode 100644 app/views/kaminari/_paginator.html.erb create mode 100644 app/views/kaminari/_prev_page.html.erb create mode 100644 vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/tags_controller.rb delete mode 100644 vendor/built_in_modules/announcement/app/models/bulletin_image.rb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb delete 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/_filter.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_picture.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index 5167c3cd..c7eb13b6 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -16,7 +16,7 @@ $(document).ready(function(){ $(function() { var $role = $('.select-role'); - $('[name="privacy"]').each(function($i) { + $('.privacy').each(function($i) { $(this).click(function() { switch ($i) { case 0: diff --git a/app/controllers/admin/tags_controller.rb b/app/controllers/admin/tags_controller.rb new file mode 100644 index 00000000..ef1e1118 --- /dev/null +++ b/app/controllers/admin/tags_controller.rb @@ -0,0 +1,48 @@ +class Admin::TagsController < ApplicationController + + layout 'new_admin' + before_filter :authenticate_user! + before_filter :is_admin? + before_filter :set_module_app + + def index + get_tags + @module_app_id = @module_app.id rescue nil + end + + def new + + end + + def edit + @tag = Tag.find(params[:id]) + end + + def create + @tag = Tag.create(params[:tag]) + end + + def update + @tag = Tag.find(params[:id]) + @tag.update_attributes(params[:tag]) + end + + def destroy + @tag = Tag.find(params[:id]) + @tag.destroy + respond_to do |format| + format.js { render 'js/remove_element', :locals => {:id => "#{dom_id @tag}"} } + end + end + + protected + + def set_module_app + @module_app ||= ModuleApp.first(:conditions => {:key => @app_title.underscore}) rescue nil + end + + def get_tags + @tags = (@module_app ? @module_app.tags : Tag.all) + end + +end diff --git a/app/models/i18n_variable.rb b/app/models/i18n_variable.rb index 741d7987..563ba791 100644 --- a/app/models/i18n_variable.rb +++ b/app/models/i18n_variable.rb @@ -17,4 +17,8 @@ class I18nVariable end end + def self.from_locale(locale) + I18nVariable.first(:conditions => {:key => locale})[I18n.locale] + end + end diff --git a/app/models/module_app.rb b/app/models/module_app.rb index d98ea206..d96ca636 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -18,6 +18,8 @@ class ModuleApp has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app + has_many :tags + has_one :app_auth,dependent: :delete before_save :set_key diff --git a/app/models/tag.rb b/app/models/tag.rb new file mode 100644 index 00000000..0449896c --- /dev/null +++ b/app/models/tag.rb @@ -0,0 +1,9 @@ +class Tag + + include Mongoid::Document + include Mongoid::Timestamps + + belongs_to :module_app + has_and_belongs_to_many :bulletins + +end diff --git a/app/views/admin/tags/_add.html.erb b/app/views/admin/tags/_add.html.erb new file mode 100644 index 00000000..12194c9f --- /dev/null +++ b/app/views/admin/tags/_add.html.erb @@ -0,0 +1,7 @@ +<%= form_for :tag, :url => admin_tags_path, :remote => true, :html => {:id => 'tag_form'} do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %> + <% end %> + <%= f.hidden_field :module_app_id, :value => @module_app_id %> + <%= f.submit %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/tags/_form.html.erb b/app/views/admin/tags/_form.html.erb new file mode 100644 index 00000000..2ca42363 --- /dev/null +++ b/app/views/admin/tags/_form.html.erb @@ -0,0 +1,7 @@ +<%= form_for tag, :url => admin_tag_path(tag), :remote => true do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %> + <% end %> + <%= f.hidden_field :module_app_id, :value => tag.module_app_id %> + <%= f.submit %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/tags/_tag.html.erb b/app/views/admin/tags/_tag.html.erb new file mode 100644 index 00000000..a103efc4 --- /dev/null +++ b/app/views/admin/tags/_tag.html.erb @@ -0,0 +1,8 @@ +
+ <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.from_locale(locale) %>: + <%= tag[locale] %> + <% end %> + <%= link_to t(:edit), edit_admin_tag_path(tag), :remote => true %> + <%= link_to t(:delete), admin_tag_path(tag), :confirm => t('sure?'), :method => :delete, :remote => true %> +
\ No newline at end of file diff --git a/app/views/admin/tags/create.js.erb b/app/views/admin/tags/create.js.erb new file mode 100644 index 00000000..8c1ca6ad --- /dev/null +++ b/app/views/admin/tags/create.js.erb @@ -0,0 +1,4 @@ +$('#tag_form').each(function(){ + this.reset(); +}); +$('#tags').append("<%= j render :partial => 'tag', :object => @tag %>") \ No newline at end of file diff --git a/app/views/admin/tags/edit.js.erb b/app/views/admin/tags/edit.js.erb new file mode 100644 index 00000000..74fd34ec --- /dev/null +++ b/app/views/admin/tags/edit.js.erb @@ -0,0 +1 @@ +$('#<%= dom_id @tag %>').html("<%= j render :partial => 'form', :locals => {:tag => @tag} %>") \ No newline at end of file diff --git a/app/views/admin/tags/index.html.erb b/app/views/admin/tags/index.html.erb new file mode 100644 index 00000000..5e757313 --- /dev/null +++ b/app/views/admin/tags/index.html.erb @@ -0,0 +1,6 @@ +
+ <%= render :partial => 'tag', :collection => @tags %> +
+------------------------- +
+<%= render 'add' %> \ No newline at end of file diff --git a/app/views/admin/tags/update.js.erb b/app/views/admin/tags/update.js.erb new file mode 100644 index 00000000..1df91e08 --- /dev/null +++ b/app/views/admin/tags/update.js.erb @@ -0,0 +1 @@ +$('#<%= dom_id @tag %>').html("<%= j render :partial => 'tag', :object => @tag %>") \ No newline at end of file diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb new file mode 100644 index 00000000..f147502f --- /dev/null +++ b/app/views/kaminari/_first_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> + diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb new file mode 100644 index 00000000..d1800e18 --- /dev/null +++ b/app/views/kaminari/_gap.html.erb @@ -0,0 +1,8 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<%= raw(t 'views.pagination.truncate') %> diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb new file mode 100644 index 00000000..73ce4d4a --- /dev/null +++ b/app/views/kaminari/_last_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> + diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb new file mode 100644 index 00000000..19008755 --- /dev/null +++ b/app/views/kaminari/_next_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> + diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb new file mode 100644 index 00000000..1683069e --- /dev/null +++ b/app/views/kaminari/_page.html.erb @@ -0,0 +1,12 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless page.current?, page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> + diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb new file mode 100644 index 00000000..aad45ef4 --- /dev/null +++ b/app/views/kaminari/_paginator.html.erb @@ -0,0 +1,23 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb new file mode 100644 index 00000000..4e94c8a6 --- /dev/null +++ b/app/views/kaminari/_prev_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %> + diff --git a/config/locales/en.yml b/config/locales/en.yml index 189ead08..5ca69c37 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -9,6 +9,7 @@ en: add: Add back: Back + cancel: Cancel create: Create delete: Delete disable: Disable @@ -24,6 +25,7 @@ en: nothing: Nothing password: Password show: Show + submit: Submit sure?: Are you sure? update: Update yes_: "Yes" @@ -31,6 +33,7 @@ en: admin: action: Action ad_banner: AD Banner + add: Add add_language: Add language add_drop_down_item: +Add Menu Item admin: Admin diff --git a/config/routes.rb b/config/routes.rb index b4512ae8..ca6a02fb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -81,6 +81,7 @@ PrototypeR4::Application.routes.draw do end resources :sites resources :snippets + resources :tags resources :translations resources :users 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 5423b5d9..6fd4737d 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 @@ -8,11 +8,15 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController def index # @bulletins = Bulletin.all # @bulletins = Bulletin.desc("postdate desc") - get_categorys(params[:bulletin_category_id]) + get_categorys(params[:bulletin_category_id]) # @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id] - @bulletins = Bulletin.search(params[:search],params[:category_id]) + @bulletins = Bulletin.search(params[:search],params[:category_id]) + @bulletin_categories = BulletinCategory.all + + module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}) respond_to do |format| format.html # index.html.erb diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/tags_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/tags_controller.rb new file mode 100644 index 00000000..808d6cc8 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/tags_controller.rb @@ -0,0 +1,8 @@ +class Panel::Announcement::BackEnd::TagsController < Admin::TagsController + + def initialize + super + @app_title = 'announcement' + end + +end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 0f12f179..79ed113c 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -8,6 +8,7 @@ class Bulletin has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + has_and_belongs_to_many :tags field :postdate , :type => Date field :deadline , :type => Date @@ -19,6 +20,8 @@ class Bulletin field :is_hot, :type => Boolean, :default => false field :is_hidden, :type => Boolean, :default => false + field :public, :type => Boolean, :default => true + mount_uploader :image, ImageUploader belongs_to :bulletin_category @@ -30,9 +33,6 @@ class Bulletin accepts_nested_attributes_for :bulletin_files, :allow_destroy => true accepts_nested_attributes_for :bulletin_links, :allow_destroy => true - accepts_nested_attributes_for :title, :allow_destroy => true - accepts_nested_attributes_for :subtitle, :allow_destroy => true - accepts_nested_attributes_for :text, :allow_destroy => true validates_presence_of :title diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_image.rb b/vendor/built_in_modules/announcement/app/models/bulletin_image.rb deleted file mode 100644 index 14e85938..00000000 --- a/vendor/built_in_modules/announcement/app/models/bulletin_image.rb +++ /dev/null @@ -1,9 +0,0 @@ -class BulletinImage < BulletinFile - - field :name - - embedded_in :bulletin - - mount_uploader :file, ImageUploader - -end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb new file mode 100644 index 00000000..a9ab39ae --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -0,0 +1,48 @@ + + + + <% if bulletin.is_top? %> + <%= t(:top) %> + <% end %> + <% if bulletin.is_hot? %> + <%= t(:hot) %> + <% end %> + <% if bulletin.is_hidden? %> + <%= t(:hidden) %> + <% end %> +
+ +
+ + <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> + <%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) %> + <%= bulletin.postdate %> + <%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %> + + <% bulletin.tags.each do |tag| %> + <%= tag[I18n.locale] %> + <% end %> + + rulingcom + + +<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %> + +<% content_for :page_specific_javascript do %> + +<% end %> \ No newline at end of file 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 deleted file mode 100644 index f94cac5b..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb +++ /dev/null @@ -1,18 +0,0 @@ - - - - <%= 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/_filter.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb new file mode 100644 index 00000000..9917cf97 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb @@ -0,0 +1,56 @@ + \ No newline at end of file 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 62be89cc..4c40cf2d 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 @@ -20,7 +20,10 @@ <%= f.label :title %> <%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %> <% @site_valid_locales.each do |locale| %> - <%= f.text_field locale %> + + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale %> + <% end %> <% end %> @@ -29,7 +32,10 @@ <%= f.label :subtitle %> <%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %> <% @site_valid_locales.each do |locale| %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> + + <%= I18nVariable.from_locale(locale) %> + <%= f.text_area locale, :rows => 10, :cols => 40 %> + <% end %> <% end %> @@ -38,7 +44,10 @@ <%= f.label :text %> <%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %> <% @site_valid_locales.each do |locale| %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> + + <%= I18nVariable.from_locale(locale) %> + <%= f.text_area locale, :rows => 10, :cols => 40 %> + <% end %> <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb new file mode 100644 index 00000000..87ebc092 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb @@ -0,0 +1,16 @@ + + + + Quick Edit - Basic / Picture / Tags / Link / File + <%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %> + <%= render :partial => "quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %> + <%= render :partial => "quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %> + <%#= render :partial => "quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %> + <%= render :partial => "quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %> +
+ <%= 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/_quick_edit_basic.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb new file mode 100644 index 00000000..fc101dcd --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb @@ -0,0 +1,62 @@ +
+
+
+ +
+ <%= f.select :bulletin_category_id, @bulletin_categories.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %> +
+
+
+ +
+ <%= f.fields_for :title, bulletin.title do |f| %> + <% @site_valid_locales.each do |locale| %> +
+ <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
+ <%= f.text_field locale, :class => 'input-xxlarge' %> +
+
+ <% end %> + <% end %> +
+ +
+
+ +
+ <%= f.date_select :postdate, {}, :class => 'input-small' %> +
+
+
+ +
+ <%= f.date_select :deadline, {}, :class => 'input-small' %> +
+
+
+
+
+ +
+ + + +
+
+
+
+
+ +
+ + +
+ + + +
+
+
+
+
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 new file mode 100644 index 00000000..724378b0 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb @@ -0,0 +1,62 @@ +
+
+
+ + + + + + + + + + + + + + + + + + + + +
ChineseEnglish
+ ADD/新增 +
+
+ +
+
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 new file mode 100644 index 00000000..b49e492c --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb @@ -0,0 +1,62 @@ + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_picture.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_picture.html.erb new file mode 100644 index 00000000..2592b602 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_picture.html.erb @@ -0,0 +1,19 @@ +
+
+
+ +
+ +
+ + +
+ +
+
+
+
+
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb new file mode 100644 index 00000000..b6c84194 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb @@ -0,0 +1,44 @@ + + +
+
+
+ <% @tags.each do |tag| %> + <%= check_box_tag 'bulletin[tag_ids][]', tag.id, bulletin.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <% end %> +
+
+
\ No newline at end of file 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 ab63bcd3..82bb24f3 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 @@ -39,95 +39,33 @@

-

<%= t('bulletin.list_announcement') %>

- - - - - - - - - - - - - - <% @bulletins.each do |post| %> - <%= render :partial => 'bulletins', :locals => {:post => post} %> - <% end %> -
<%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.postdate') %><%= t('bulletin.deadline') %><%= t('bulletin.action') %>

--> +<%= render 'filter' %> + + + + + + + + + + + + + + + <%= render :partial => 'bulletin', :collection => @bulletins %> + +
+ + + <%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.start_date') %><%= t('bulletin.end_date') %><%= t('bulletin.tags') %><%= t('bulletin.last_modified') %>
- - -