diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 2c8cafc..0b824fc 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -114,7 +114,7 @@ class NewsController < ApplicationController ma = ModuleApp.find_by_key("news") rescue nil current_categories = OrbitHelper.widget_categories - categories = ma.categories.enabled.collect do |cat| + categories_for_url = ma.categories.enabled.collect do |cat| if current_categories.include?(cat.id.to_s) { "name" => cat.title, @@ -122,8 +122,17 @@ class NewsController < ApplicationController } end end - categories.delete(nil) - categories = {"name" => t("news.all"), "category-link" => "/#{I18n.locale.to_s + page.url}/"} if categories.count != 1 + categories_for_url.delete(nil) + categories_for_url = {"name" => "ALL", "category-link" => "/#{I18n.locale.to_s + page.url}/"} if categories_for_url.count != 1 + + categories = ma.categories.enabled.collect do |cat| + { + "name" => cat.title, + "category-link" => "/#{I18n.locale.to_s + page.url}/?category=#{cat.to_param}" + } + end + + categories.unshift({"name" => t("news.all"), "category-link" => "/#{I18n.locale.to_s + page.url}/"}) anns = news.collect do |a| if a.image_description.blank? @@ -159,6 +168,7 @@ class NewsController < ApplicationController { "news" => anns, "categories" => categories, + "categories_for_url" => categories_for_url, "extras" => { "more_url"=>OrbitHelper.widget_more_url, "title-head" => t('news.table.title'),