From b9cf5263f67b2653c4bfefec8cfa7c5530105015 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 26 Jul 2012 02:27:43 +0800 Subject: [PATCH] Remove i18n_variable for announcement --- app/controllers/orbit_backend_controller.rb | 24 ++---- lib/tasks/migrate.rake | 83 +++++++++++++++++++ .../back_end/approvals_controller.rb | 2 +- .../announcement/back_end/bulletins_helper.rb | 4 +- .../app/models/announcement_tag.rb | 2 +- .../announcement/app/models/bulletin.rb | 36 ++------ .../app/models/bulletin_category.rb | 11 +-- .../announcement/app/models/bulletin_file.rb | 34 +------- .../announcement/app/models/bulletin_link.rb | 4 +- .../announcement/app/models/bulletin_tag.rb | 14 ---- .../app/models/unit_list_for_anc.rb | 3 +- .../_bulletin_category.html.erb | 2 +- .../bulletin_categorys/_form.html.erb | 4 +- .../_quick_edit_qe.html.erb | 4 +- .../back_end/bulletins/_bulletin.html.erb | 2 +- .../bulletins/_bulletin_file_qe.html.erb | 8 +- .../bulletins/_bulletin_link_qe.html.erb | 6 +- .../back_end/bulletins/_file.html.erb | 2 +- .../bulletins/_filter_categories.html.erb | 2 +- .../back_end/bulletins/_form.html.erb | 12 +-- .../bulletins/_form_bulletin_file.html.erb | 8 +- .../bulletins/_form_bulletin_link.html.erb | 4 +- .../bulletins/_list_bulletin_file.html.erb | 4 +- .../bulletins/_list_bulletin_link.html.erb | 4 +- .../bulletins/_quick_edit_basic.html.erb | 6 +- .../back_end/bulletins/show.html.erb | 12 +-- .../front_end/bulletins/index.html.erb | 6 +- .../front_end/bulletins/show.html.erb | 8 +- .../widget/bulletins/_bulletins.html.erb | 2 +- .../widget/bulletins/_index.html.erb | 4 +- .../widget/bulletins/_web_links.html.erb | 2 +- .../widget/bulletins/bulletins_list.html.erb | 2 +- .../bulletins/bulletins_side_bar.html.erb | 2 +- 33 files changed, 163 insertions(+), 160 deletions(-) create mode 100644 lib/tasks/migrate.rake delete mode 100644 vendor/built_in_modules/announcement/app/models/bulletin_tag.rb diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index feefc98e..6bc42ec9 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -39,11 +39,10 @@ class OrbitBackendController< ApplicationController options = [options] if !options.class.eql?(Array) options.each do |option| if object_class.fields.include?(option) - case object_class.fields[option].type.to_s - when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time' - (objects = objects.order_by(option, params[:direction])) rescue nil - when 'Object' - objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option) + if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil? + objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option) + else + (objects = objects.order_by(option, params[:direction])) rescue nil end elsif object_class.relations.include?(option) case object_class.relations[option].macro @@ -92,20 +91,11 @@ class OrbitBackendController< ApplicationController end def get_string_value_from_object(object) - s = object[I18n.locale] rescue nil - s = object.i18n_variable unless s rescue nil + s = object.name_translations[I18n.locale.to_s] unless s rescue nil + s = object.title_translations[I18n.locale.to_s] unless s rescue nil s = object.name unless s rescue nil s = object.title unless s rescue nil - if s - case s.class.to_s - when "String" - s.downcase rescue '' - when "I18nVariable" - s[I18n.locale].downcase rescue '' - else - nil - end - end + s.downcase rescue '' end def get_objects_from_referenced_objects(object_class, objects, option) diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake new file mode 100644 index 00000000..b8858ad8 --- /dev/null +++ b/lib/tasks/migrate.rake @@ -0,0 +1,83 @@ +# encoding: utf-8 + +namespace :migrate do + + task :i18n => :environment do + + p 'Start Bulletin' + bulletins = Bulletin.admin_manager_all + i = 1 + bulletins.each do |bulletin| + p "#{i}/#{bulletins.size} - #{bulletin.id}" + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => bulletin.id, :language_value_type => bulletin.class}) + bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => bulletin.id, :language_value_type => bulletin.class}) + bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle + text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => bulletin.id, :language_value_type => bulletin.class}) + bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text + bulletin.save(:validate => false) + i += 1 + end + p 'End Bulletin' + + p '=====================================================' + + p 'Start BulletinCategory' + categories = BulletinCategory.admin_manager_all + i = 1 + categories.each do |category| + p "#{i}/#{categories.size} - #{category.id}" + title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class}) + category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + category.save(:validate => false) + i += 1 + end + p 'End BulletinCategory' + + p '=====================================================' + + p 'Start BulletinFile' + files = BulletinFile.all + i = 1 + files.each do |file| + p "#{i}/#{files.size} - #{file.id}" + description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class}) + file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description + title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class}) + file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + file.save(:validate => false) + i += 1 + end + p 'End BulletinFile' + + p '=====================================================' + + p 'Start BulletinLink' + links = BulletinLink.all + i = 1 + links.each do |link| + p "#{i}/#{links.size} - #{link.id}" + title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class}) + link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + link.save(:validate => false) + i += 1 + end + p 'End BulletinLink' + + p '=====================================================' + + p 'Start UnitListForAnc' + units = UnitListForAnc.all + i = 1 + units.each do |unit| + p "#{i}/#{units.size} - #{unit.id}" + title = I18nVariable.first(:conditions => {:language_value_id => unit.id, :language_value_type => unit.class}) + unit.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + unit.save(:validate => false) + i += 1 + end + p 'End UnitListForAnc' + + end + +end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb index 0246ab7c..f787ff28 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb @@ -26,7 +26,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle def setting @sys_users = User.all(conditions: {admin: false}).includes(:avatar) @bulletin_categorys = BulletinCategory.all - @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] } + @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.title,bc.id] } if params.has_key? :category @bulletin_category = BulletinCategory.find params[:category][:id] else diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index 3f57fd3a..5de4a826 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -14,9 +14,9 @@ module Panel::Announcement::BackEnd::BulletinsHelper def show_bulletin_title_at_index (bulletin) if bulletin.is_checked? - link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue '' + link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue '' else - bulletin.title[I18n.locale] + bulletin.title end end diff --git a/vendor/built_in_modules/announcement/app/models/announcement_tag.rb b/vendor/built_in_modules/announcement/app/models/announcement_tag.rb index 630779d1..594c221d 100644 --- a/vendor/built_in_modules/announcement/app/models/announcement_tag.rb +++ b/vendor/built_in_modules/announcement/app/models/announcement_tag.rb @@ -3,7 +3,7 @@ class AnnouncementTag < Tag has_and_belongs_to_many :bulletins field :order,:default => 0 - def get_visible_bulletins(sort = :name) + def get_visible_bulletins(sort = :title) date_now = Time.now self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort) end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index a6b0e55f..e7ff24dc 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -15,9 +15,10 @@ class Bulletin is_impressionable :counter_cache => { :column_name => :view_count } - 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 + field :title, localize: true + field :subtitle, localize: true + field :text, localize: true + has_and_belongs_to_many :tags, :class_name => "AnnouncementTag" field :postdate , :type => DateTime @@ -55,9 +56,9 @@ class Bulletin accepts_nested_attributes_for :bulletin_files, :allow_destroy => true accepts_nested_attributes_for :bulletin_links, :allow_destroy => true - validates_presence_of :title + validates :title, :presence => true - before_save :set_key,:check_deadline,:update_status + before_save :check_deadline,:update_status after_save :save_bulletin_links after_save :save_bulletin_files @@ -157,19 +158,6 @@ end end end end - - - def title - @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def subtitle - @subtitle ||= I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def text - @text ||= I18nVariable.first(:conditions => {:key => 'text', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end def self.filter(bulletins) bulletins.each do |bulletin| @@ -191,18 +179,6 @@ end end - def set_key - if title && title.new_record? - title.key = 'title' - end - if subtitle && subtitle.new_record? - subtitle.key = 'subtitle' - end - if text && text.new_record? - text.key = 'text' - end - end - def update_status if !self.is_pending if !self.is_checked 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 2f25c888..7de9bb2c 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -13,18 +13,15 @@ class BulletinCategory PAYMENT_TYPES = [ "List", "Picture" ] APP_NAME = 'Announcement' - field :key + field :disable, type: Boolean, :default => false field :display - field :disable,type: Boolean,:default => false - - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :key + field :title, localize: true has_many :bulletins - - def pp_object - i18n_variable[I18n.locale] + name end def self.from_id(id) diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb index a30ec131..2912fc97 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb @@ -4,37 +4,11 @@ class BulletinFile include Mongoid::Timestamps mount_uploader :file, AssetUploader - - # field :filetitle - # field :description - has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - - # field :to_save, :type => Boolean - field :should_destroy, :type => Boolean + + field :description, localize: true + field :should_destroy, :type => Boolean + field :title, localize: true belongs_to :bulletin - # embedded_in :bulletin - - before_save :set_key - - def filetitle - @filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def description - @description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - protected - - def set_key - if filetitle && filetitle.new_record? - filetitle.key = 'filetitle' - end - if description && description.new_record? - description.key = 'description' - end - end end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb index 30363182..47a44789 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb @@ -4,9 +4,7 @@ class BulletinLink include Mongoid::Timestamps field :url - # field :name - - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true field :should_destroy, :type => Boolean diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_tag.rb b/vendor/built_in_modules/announcement/app/models/bulletin_tag.rb deleted file mode 100644 index 40664262..00000000 --- a/vendor/built_in_modules/announcement/app/models/bulletin_tag.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AnnouncementTag < Tag - - has_and_belongs_to_many :bulletins - - - def get_visible_bulletins(sort = :name) - date_now = Time.now - self.bulletins.all.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort) - end - - def bulletins - Bulletin.all.any_in(:_id => bulletin_ids) - end -end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb index 5261f6a2..179e9588 100644 --- a/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb +++ b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb @@ -5,8 +5,7 @@ class UnitListForAnc field :order field :ut_code field :up_ut_code - - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true + field :title, localize: true end \ No newline at end of file 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 index 58a9a5f9..a0f021a8 100644 --- 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 @@ -15,6 +15,6 @@ <% @site_valid_locales.each do |locale| %> - <%= bulletin_category.i18n_variable[locale] rescue nil %> + <%= bulletin_category.title_translations[locale] rescue nil %> <% end %> 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 1fbf5e2e..0de7d2e8 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 @@ -10,12 +10,12 @@
- <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
- <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (@bulletin_category.title_translations[locale] rescue nil) %>
<% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb index cb32d861..9e774709 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb @@ -7,12 +7,12 @@ <%= f.text_field :key %>
- <%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %> + <%= f.fields_for :title_translations 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' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin_category.title_translations[locale] rescue nil) %>
<% 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 index edff4d2d..54506779 100644 --- 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 @@ -28,7 +28,7 @@
- <%= bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %> + <%= bulletin.bulletin_category.title rescue nil %> <%= show_bulletin_title_at_index bulletin%>
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 index 23229b5d..547736ff 100644 --- 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 @@ -13,23 +13,23 @@
- <%= f.fields_for :filetitle, (@bulletin_file.new_record? ? @bulletin_file.build_filetitle : @bulletin_file.filetitle ) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
- <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@bulletin_file.title_translations[locale] rescue nil) %>
<% end %> <% end %> - <%= f.fields_for :description, (@bulletin_file.new_record? ? @bulletin_file.build_description : @bulletin_file.description ) do |f| %> + <%= f.fields_for :description_translations do |f| %> <% @site_valid_locales.each do |locale| %>
- <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@bulletin_file.description_translations[locale] rescue nil) %>
<% end %> 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 fd013f56..c89ba8a5 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 @@ -14,13 +14,13 @@ - <%= f.fields_for :i18n_variable, (@bulletin_link.new_record? ? @bulletin_link.build_i18n_variable : @bulletin_link.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
- <%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> + <%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}" %>
<%#= f.text_field locale, :class => 'input-xxlarge' %> - <%= f.text_field locale %> + <%= f.text_field locale, :class => 'control-label', :value => (@bulletin_link.title_translations[locale] rescue nil) %>
<% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb index 53717848..c1885287 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb @@ -11,7 +11,7 @@ <%= f.file_field :file %> <%= f.label :file_title %> - <%= f.text_field :filetitle %> + <%= f.text_field :title %> <%= f.label :file_description %> <%= f.text_field :description %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb index 7856f74b..b0727501 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb @@ -1,6 +1,6 @@
<% @bulletin_categories.each do |category| -%> - <%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> + <%= link_to category.title, panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> <% end -%>
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %> \ 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 73d088b7..f58cfe2b 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 @@ -121,10 +121,10 @@
<%#= f.label :unit_list_for_anc%> - <%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %> <%= f.label :category,t('announcement.bulletin.category')%> - <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>