From ebf3a2eae451ec7e38fcfd1e21533322f90999f3 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 10:57:13 +0800 Subject: [PATCH 1/4] Fix extra loaded js: the widgets only need to render layout when they need js. --- app/controllers/obit_frontend_component_controller.rb | 2 +- .../panel/announcement/widget/bulletins_controller.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/obit_frontend_component_controller.rb b/app/controllers/obit_frontend_component_controller.rb index d0be3a25d..2c44b60c0 100644 --- a/app/controllers/obit_frontend_component_controller.rb +++ b/app/controllers/obit_frontend_component_controller.rb @@ -1,7 +1,7 @@ class ObitFrontendComponentController< ApplicationController before_filter :setup_vars before_filter {|c| c.front_end_available(@app_title)} - layout 'module_widget' + layout :false def setup_vars @app_title = request.fullpath.split('/')[2] 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 6695156a0..333f88e78 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 @@ -28,6 +28,7 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] @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(5) rescue nil + render :layout => 'module_widget' end def reload_bulletins From 9ae140204f62bae987fddd1fb3eb393e1880bd89 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 10:58:31 +0800 Subject: [PATCH 2/4] Fix announcement pagination in front-end --- app/controllers/pages_controller.rb | 6 +++++- lib/parsers/parser_back_end.rb | 2 +- lib/parsers/parser_front_end.rb | 2 +- .../panel/announcement/front_end/bulletins_controller.rb | 6 +++--- .../panel/announcement/front_end/bulletins/index.html.erb | 4 ++-- vendor/built_in_modules/announcement/config/routes.rb | 1 - 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index aa66238d5..8ea353919 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -30,7 +30,11 @@ class PagesController < ApplicationController end def index_from_link - redirect_to "/#{@item.full_name}" + if params[:page] + redirect_to "/#{@item.full_name}?page=#{params[:page]}" + else + redirect_to "/#{@item.full_name}" + end end def show_from_link diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index dea65b6ac..37c22ed18 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -100,7 +100,7 @@ module ParserBackEnd ret = '' if (tag.attributes["main"] == "true" && !page.module_app.nil?) ret << "
" else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 305596ed1..17468e54d 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -127,7 +127,7 @@ module ParserFrontEnd ret << "
" else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil 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 b71a4609a..e840d65f1 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 @@ -11,15 +11,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController def index date_now = Time.now - if params[:bulletin_category_id] - @bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + if params[:category_id] + @bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) else @bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) end get_categorys - @current_category = BulletinCategory.from_id(params[:bulletin_category_id]) rescue nil + @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil end def show diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index d4335e9a4..086794b9a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -28,6 +28,6 @@ <% end %> - -<%= paginate @bulletins %> + +<%= paginate @bulletins, :params => {:inner => 'false'} %> diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index c3a60f74e..a604da850 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -10,7 +10,6 @@ Rails.application.routes.draw do resources :tags end namespace :front_end do - root :to => "bulletins#index" resources :bulletins end namespace :widget do From 826a5a5f20f158237dc49b36e3692183111f31d5 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 14:12:47 +0800 Subject: [PATCH 3/4] Fix link in widget --- .../panel/announcement/widget/bulletins/_web_links.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb index 3a6982dc5..2b65417d3 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb @@ -1,6 +1,6 @@ <% @web_links.each do |web_link| %>
  • - <%= web_link.name[I18n.locale] %> + <%= link_to web_link.name[I18n.locale], web_link.url %>
  • <% end %> From 900855724c4e06984b3291fe4bdae46399f94b24 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 7 Mar 2012 11:37:00 +0800 Subject: [PATCH 4/4] Add bootstrap-orbit.css in front-end --- lib/parsers/parser_front_end.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 17468e54d..99353cc16 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -62,6 +62,7 @@ module ParserFrontEnd c.define_tag 'stylesheets' do |tag| res = '' res << "" + res << "" res << "" res << "" if page.design.reset_css res << " " if page.design.default_css