Remove I18n.locale for announcement front-end

Fix counter in back-end edit
This commit is contained in:
chris 2012-12-28 15:34:04 +08:00
parent 4d965d754b
commit 61b0f94c04
2 changed files with 16 additions and 16 deletions

View File

@ -248,7 +248,7 @@ module ParserCommon
when 'this_year' when 'this_year'
res << display_visitors_this_year.to_s res << display_visitors_this_year.to_s
end end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res) fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{counter['id']}' class='#{counter['class']}'>#{res}</div>")
counter.swap(fragment) counter.swap(fragment)
end end
end end

View File

@ -23,16 +23,16 @@
<td> <td>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'img' %> <% elsif ff[1] == 'img' %>
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div> <div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -67,14 +67,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> <%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -109,14 +109,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -153,14 +153,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -195,14 +195,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>