From 7f9a7edc98a2ed93d8edff9099dfb9606266d49e Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 28 Feb 2012 04:24:09 +0800 Subject: [PATCH] Changes in bulletins widget and front-end, add categories to link --- Gemfile | 2 +- Gemfile.lock | 3 --- app/controllers/pages_controller.rb | 6 +++++- .../panel/announcement/front_end/bulletins/index.html.erb | 2 +- .../panel/announcement/widget/bulletins/_bulletins.html.erb | 2 +- .../panel/announcement/widget/bulletins/index.html.erb | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index eb1f5434f..9eca91862 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'rubyzip' gem 'sinatra' gem 'sprockets' gem 'tinymce-rails' -gem 'therubyracer' +# gem 'therubyracer' # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index d6960e2be..18f66fbf0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -179,8 +179,6 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) - therubyracer (0.9.9) - libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -236,7 +234,6 @@ DEPENDENCIES sinatra spork sprockets - therubyracer tinymce-rails uglifier watchr diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 07d7261c1..1cd4463c6 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -45,7 +45,11 @@ class PagesController < ApplicationController def get_item module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) + if params[:category_id] + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) + else + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) + end end end 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 c5c9abb43..d31050552 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 @@ -15,7 +15,7 @@ <% @bulletins.each do |post| %> <%= post.bulletin_category.i18n_variable[I18n.locale] %> - <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %> + <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> <%= post.postdate %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb index f10ab8643..416114748 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb @@ -1,6 +1,6 @@ <% @bulletins.each do |bulletin| %>
  • - <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin) %> + <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id) %>
  • <% end %> 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 0d334f26c..bb61a7a7b 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 @@ -10,7 +10,7 @@ <% @bulletins.each do |post| %>
  • <%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
    -

    <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %>

    +

    <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>

    <%= post.subtitle[I18n.locale] %>

  • <% end %>