Announcement widget: remove I18n.locale

Add part_id in url
This commit is contained in:
chris 2012-12-27 16:52:58 +08:00
parent 269e5b033f
commit 751d3b1220
3 changed files with 11 additions and 11 deletions

View File

@ -212,7 +212,7 @@ module ParserCommon
else else
"/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
end end
options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}" options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"
ret << "<div class='dymanic_load widget' path='#{url + options}'></div>" ret << "<div class='dymanic_load widget' path='#{url + options}'></div>"
when 'public_r_tag' when 'public_r_tag'
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"

View File

@ -64,7 +64,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
preview_content preview_content
else else
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first @bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if !@bulletin.disable? and !@bulletin.is_rejected if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s) if @bulletin.enabled_for_lang(I18n.locale.to_s)
impressionist(@bulletin) impressionist(@bulletin)
get_categorys get_categorys

View File

@ -31,7 +31,7 @@
<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 wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %> <%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %> <% elsif wf[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -72,14 +72,14 @@
<% @widget_fields.each do |wf| %> <% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>"> <span class="<%= wf[1] %>">
<% if wf[1] == 'title' %> <% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[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("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %> <%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %> <% elsif wf[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -120,14 +120,14 @@
<% @widget_fields.each do |wf| %> <% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>"> <span class="<%= wf[1] %>">
<% if wf[1] == 'title' %> <% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[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("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %> <%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %> <% elsif wf[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -170,14 +170,14 @@
<% @widget_fields.each do |wf| %> <% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>"> <span class="<%= wf[1] %>">
<% if wf[1] == 'title' %> <% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[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("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %> <%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %> <% elsif wf[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -218,14 +218,14 @@
<% @widget_fields.each do |wf| %> <% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>"> <span class="<%= wf[1] %>">
<% if wf[1] == 'title' %> <% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[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("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %> <%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %> <% elsif wf[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>