From 751d3b1220097543fe67272487f9b75cd5c9c8d0 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 27 Dec 2012 16:52:58 +0800 Subject: [PATCH] Announcement widget: remove I18n.locale Add part_id in url --- lib/parsers/parser_common.rb | 2 +- .../front_end/bulletins_controller.rb | 2 +- .../widget/bulletins/_index.html.erb | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index c3af57d1..794fb4fd 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -212,7 +212,7 @@ module ParserCommon else "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" 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 << "
" when 'public_r_tag' ret << "" diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index 456d57d9..2fe0f711 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -64,7 +64,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController preview_content else @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) impressionist(@bulletin) get_categorys diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb index 95ab7f4f..8d53872b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb @@ -31,7 +31,7 @@
<%= image_tag(post.send(wf[0]).url) %>
<% elsif wf[1] == 'text' %> <%#= 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' %> <% if post.is_top? %> <%= t(:top) %> @@ -72,14 +72,14 @@ <% @widget_fields.each do |wf| %> <% 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' %> <%= display_date(post.send(wf[0])) %> <% elsif wf[1] == 'category' %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <% elsif wf[1] == 'text' %> <%#= 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' %> <% if post.is_top? %> <%= t(:top) %> @@ -120,14 +120,14 @@ <% @widget_fields.each do |wf| %> <% 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' %> <%= display_date(post.send(wf[0])) %> <% elsif wf[1] == 'category' %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <% elsif wf[1] == 'text' %> <%#= 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' %> <% if post.is_top? %> <%= t(:top) %> @@ -170,14 +170,14 @@ <% @widget_fields.each do |wf| %> <% 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' %> <%= display_date(post.send(wf[0])) %> <% elsif wf[1] == 'category' %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <% elsif wf[1] == 'text' %> <%#= 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' %> <% if post.is_top? %> <%= t(:top) %> @@ -218,14 +218,14 @@ <% @widget_fields.each do |wf| %> <% 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' %> <%= display_date(post.send(wf[0])) %> <% elsif wf[1] == 'category' %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <% elsif wf[1] == 'text' %> <%#= 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' %> <% if post.is_top? %> <%= t(:top) %>