From 304bf0d445216e9c24d383a9bd389d67e3427617 Mon Sep 17 00:00:00 2001 From: Spen Date: Fri, 10 Jan 2014 17:46:12 +0800 Subject: [PATCH] fix new ui announcement widget_style "bulletins_and_web_links" --- .../announcement/widget/bulletins_controller.rb | 12 ++++++++++-- .../bulletins/bulletins_and_web_links.html.erb | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 4dd7f7af..2bebdd00 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -98,9 +98,17 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => @selected_tag.id.to_s, :is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :postdate).page(params[:page]).per(@page_num) rescue nil - if @part.widget_style == 'bulletins_and_web_links' + if @part.widget_style == 'bulletins_and_links' @ModuleApp_w = ModuleApp.first(:conditions => {:key=>'web_resource'}) - @link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_id => @ModuleApp_w.id}) + + @link_module_tag = ModuleTag.first(:conditions => {:name => @selected_tag.name, :module_app_id => @ModuleApp_w.id}) + + if !@link_module_tag.blank? + @link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :tag_lease_id => @link_module_tag.id}) + else + @link_selected_tag = @link_module_tag + end + @web_links = WebLink.where(:tagged_ids => @link_selected_tag.id.to_s, :is_hidden => false).desc(:is_top,:created_at).available_for_lang(I18n.locale).page(params[:page]).per(@page_num) rescue nil end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb index d883c929..87e6c676 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb @@ -16,7 +16,7 @@ - <% if @part.widget_style == 'bulletins_and_web_links' %> + <% if @part.widget_style == 'bulletins_and_links' %>