From 1146506063d6cffd87e274342062b030aba25c37 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 20 Feb 2012 15:56:17 +0800 Subject: [PATCH] Fix bug when no bulletins or web_links --- app/views/layouts/module_widget.html.erb | 4 ++-- .../panel/announcement/widget/bulletins_controller.rb | 6 +++--- .../widget/bulletins/bulletins_and_web_links.html.erb | 4 ++-- .../announcement/widget/bulletins/reload_bulletins.js.erb | 2 +- .../announcement/widget/bulletins/reload_web_links.js.erb | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/layouts/module_widget.html.erb b/app/views/layouts/module_widget.html.erb index e010355e..254ac4e9 100644 --- a/app/views/layouts/module_widget.html.erb +++ b/app/views/layouts/module_widget.html.erb @@ -4,8 +4,8 @@ - <%= stylesheet_link_tag "widget" %> - <%= javascript_include_tag "widget" %> + <%#= stylesheet_link_tag "module_widget" %> + <%= javascript_include_tag "module_widget" %> <%= csrf_meta_tag %> 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 a8ca336e..c75eeef7 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 @@ -33,18 +33,18 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController def bulletins_and_web_links @tags = AnnouncementTag.all @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] - @bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(1) rescue nil + @bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil end def reload_bulletins @selected_tag = AnnouncementTag.find(params[:tag_id]) - @bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(1) rescue nil + @bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil end def reload_web_links @selected_tag = AnnouncementTag.find(params[:tag_id]) - @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil + @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) 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 0d1bc047..c8006636 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 @@ -6,12 +6,12 @@
\ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_bulletins.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_bulletins.js.erb index ec119715..3ee82c10 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_bulletins.js.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_bulletins.js.erb @@ -1 +1 @@ -$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' %>") \ No newline at end of file +$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>") \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_web_links.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_web_links.js.erb index d1abb2d7..55f1bc96 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_web_links.js.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/reload_web_links.js.erb @@ -1 +1 @@ -$('#bulletins_web_links_web_links').html("<%= j render 'web_links' %>") \ No newline at end of file +$('#bulletins_web_links_web_links').html("<%= j render 'web_links' id @web_links %>") \ No newline at end of file