Remove i18n_variable for page_content
This commit is contained in:
parent
e33afc0822
commit
4a6b9fbe64
|
@ -141,6 +141,21 @@ namespace :migrate do
|
|||
end
|
||||
p 'End NewsBulletinLink'
|
||||
|
||||
p '====================================================='
|
||||
p '====================================================='
|
||||
|
||||
p 'Start PageContext'
|
||||
page_contexts = PageContext.admin_manager_all
|
||||
i = 1
|
||||
page_contexts.each do |page_context|
|
||||
p "#{i}/#{page_contexts.size} - #{page_context.id}"
|
||||
context = I18nVariable.first(:conditions => {:language_value_id => page_context.id, :language_value_type => page_context.class})
|
||||
page_context.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
|
||||
page_context.save(:validate => false)
|
||||
i += 1
|
||||
end
|
||||
p 'End PageContext'
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class PageContext
|
|||
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :context, localize: true
|
||||
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
|
@ -26,7 +26,7 @@ class PageContext
|
|||
ObjectAuthTitlesOptions = %W{Edit}
|
||||
|
||||
def pp_object
|
||||
page.i18n_variable[I18n.locale]
|
||||
page.title
|
||||
end
|
||||
|
||||
def is_top?
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div id="post-body-content">
|
||||
<div class="title">
|
||||
<%= f.label :name %>
|
||||
<%= @page_context.page.i18n_variable[I18n.locale] %>
|
||||
<%= @page_context.page.title %>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
|
@ -23,9 +23,9 @@
|
|||
|
||||
<div class="title">
|
||||
<%= f.label :context %>
|
||||
<%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %>
|
||||
<%= f.fields_for :context_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 => (@page_context.context_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<tr id="<%= dom_id page_context %>" class="with_action">
|
||||
<td>
|
||||
<%= page_context.page.path %></br>
|
||||
<%= page_context.page.i18n_variable[I18n.locale] %>
|
||||
<%= page_context.page.title %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<%if is_manager? || is_admin? || page_context.authed_users(:edit).include?(current_user)%>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<tr id="<%= dom_id view_page_context %>" class="with_action">
|
||||
<td>
|
||||
<%= view_page_context.page.i18n_variable[I18n.locale] %>
|
||||
<%= view_page_context.page.title %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('view_page_context.show'), panel_page_content_back_end_page_context_path(view_page_context) %></li>
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
<ul>
|
||||
<li>
|
||||
<b><%= t('page_content.name') %></b>
|
||||
<%= @page_context.page.i18n_variable[I18n.locale] %>
|
||||
<%= @page_context.page.title %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('page_content.context') %></b>
|
||||
<%= @page_context.context[I18n.locale].html_safe %>
|
||||
<%= @page_context.context.html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('page_content.張貼者') %></b>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<p id="notice"><%= flash_messages %></p>
|
||||
|
||||
<div class="view_count pull-right"><%= dislpay_view_count(@page_context) %></div>
|
||||
<h1 class="h1"><%= @page_context.page.i18n_variable[I18n.locale] rescue nil %></h1>
|
||||
<h1 class="h1"><%= @page_context.page.title rescue nil %></h1>
|
||||
|
||||
<div class="page_content"><%= @page_context.context[I18n.locale].html_safe rescue nil %></div>
|
||||
<div class="page_content"><%= @page_context.context.html_safe rescue nil %></div>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue