Remove i18n_variable for announcement
This commit is contained in:
parent
d589a1b522
commit
e2ebd48b22
|
@ -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)
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,9 +16,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
|
||||
|
@ -56,9 +57,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
|
||||
|
@ -180,19 +181,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|
|
||||
|
@ -214,18 +202,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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -15,6 +15,6 @@
|
|||
</div>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
|
||||
<td><%= bulletin_category.title_translations[locale] rescue nil %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= 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| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<%= f.text_field :key %>
|
||||
</div>
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td><%= bulletin.bulletin_category.title rescue nil %></td>
|
||||
<td>
|
||||
<%= show_bulletin_title_at_index bulletin%>
|
||||
<div class="quick-edit">
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<%= 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| %>
|
||||
<div class="control-group">
|
||||
<label for="file-<%= locale %>" class="control-label">Name <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= 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) %>
|
||||
</div>
|
||||
</div>
|
||||
<% 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| %>
|
||||
<div class="control-group">
|
||||
<label for="file-<%= locale %>" class="control-label">Description <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= 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) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<%= 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| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}" %>
|
||||
<div class="controls">
|
||||
<%#= 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) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @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 -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
|
@ -121,10 +121,10 @@
|
|||
<div id="post-body-content" class="clear">
|
||||
|
||||
<%#= 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" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
@ -142,18 +142,18 @@
|
|||
|
||||
<div class="title">
|
||||
<%= f.label :title ,t('announcement.bulletin.title')%>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@bulletin.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :text ,t('announcement.bulletin.text')%>
|
||||
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@bulletin.text_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :filetitle, (form_bulletin_file.new_record? ? form_bulletin_file.build_filetitle : form_bulletin_file.filetitle ) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_bulletin_file.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -41,11 +41,11 @@
|
|||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :description, (form_bulletin_file.new_record? ? form_bulletin_file.build_description : form_bulletin_file.description ) do |f| %>
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_bulletin_file.description_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :i18n_variable, (form_bulletin_link.new_record? ? form_bulletin_link.build_i18n_variable : form_bulletin_link.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge", :value => (form_bulletin_link.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
<tr id="<%= dom_id list_bulletin_file %>">
|
||||
<td><%= 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 %></td>
|
||||
<td><%= 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 %></td>
|
||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.title_translations['zh_tw'], list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.title_translations['zh_tw'] %></td>
|
||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.title_translations['en'], list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.title_translations['zh_tw'] %></td>
|
||||
<td>
|
||||
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<tr id="<%= dom_id list_bulletin_link %>">
|
||||
<td><%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_bulletin_link.title_translations['zh_tw'], list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_bulletin_link.title_translations['en'], list_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td>
|
||||
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(list_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||
<span class="action">
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :bulletin_category_id, @bulletin_categories.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %>
|
||||
<%= f.select :bulletin_category_id, @bulletin_categories.collect {|t| [ t.title, t.id ]}, {}, :class => 'input-large' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :title, bulletin.title do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<ul>
|
||||
<li>
|
||||
<b><%= t('announcement.category') %></b>
|
||||
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %>
|
||||
<%= @bulletin.bulletin_category.title rescue nil %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.postdate') %></b>
|
||||
|
@ -9,7 +9,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.title') %></b>
|
||||
<%= @bulletin.title[I18n.locale] %>
|
||||
<%= @bulletin.title %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
|
||||
|
@ -17,23 +17,23 @@
|
|||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.subtitle') %></b>
|
||||
<%= @bulletin.subtitle[I18n.locale].html_safe %>
|
||||
<%= @bulletin.subtitle.html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.text') %></b>
|
||||
<%= @bulletin.text[I18n.locale].html_safe %>
|
||||
<%= @bulletin.text.html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<b><%= t('announcement.link') %></b>
|
||||
<% @bulletin.bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.file') %></b>
|
||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<%= flash_messages %>
|
||||
|
||||
<% if @current_category %>
|
||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] %></h1>
|
||||
<h1 class="h1"><%= @current_category.title %></h1>
|
||||
<% else %>
|
||||
<h1 class="h1"><%= t('announcement.announcement') %></h1>
|
||||
<% end %>
|
||||
|
@ -22,8 +22,8 @@
|
|||
<% end %>
|
||||
<% @bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<td><%= post.bulletin_category.title rescue nil %></td>
|
||||
<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
||||
</td>
|
||||
<td><%= display_date_time(post.postdate) %></td>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<h1 class="h1"><%= @bulletin.title[I18n.locale] %></h1>
|
||||
<h1 class="h1"><%= @bulletin.title %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
|
||||
</div>
|
||||
<div class="news_paragraph">
|
||||
<%= @bulletin.text[I18n.locale].html_safe %>
|
||||
<%= @bulletin.text.html_safe %>
|
||||
</div>
|
||||
<div class="linkAndFile">
|
||||
<% if @bulletin.bulletin_links.size > 0 %>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<i class="icons-link"></i>
|
||||
<div class="showLink">
|
||||
<% @bulletin.bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,7 +30,7 @@
|
|||
<i class="icons-paperclip"></i>
|
||||
<div class="showFile">
|
||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% @bulletins.each do |bulletin| %>
|
||||
<li>
|
||||
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id) %>
|
||||
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
<% @bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<td><%= post.bulletin_category.title rescue nil %></td>
|
||||
<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
</td>
|
||||
<td><%= display_date_time(post.postdate) %></td>
|
||||
</tr>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% @web_links.each do |web_link| %>
|
||||
<li>
|
||||
<%= link_to web_link.name[I18n.locale], web_link.url %>
|
||||
<%= link_to web_link.title, web_link.url %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="news_next">next</div>
|
||||
<ul class="news_list">
|
||||
<% tag.bulletins.each do |post| %>
|
||||
<li><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %></li>
|
||||
<li><%= link_to post.title, panel_announcement_front_end_bulletin_path(post) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<ul class="list">
|
||||
<% @bulletin_categorys.each do |category| %>
|
||||
<li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
|
||||
<%= link_to category.title, panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
Reference in New Issue