modify news url about category

This commit is contained in:
Ruling-Mac 2015-07-28 17:13:44 +08:00
parent 4276840113
commit 499f389da5
1 changed files with 6 additions and 4 deletions

View File

@ -112,14 +112,18 @@ class NewsController < ApplicationController
page = Page.where(:module => "news").first rescue nil
ma = ModuleApp.find_by_key("news") rescue nil
current_categories = OrbitHelper.widget_categories
categories = ma.categories.enabled.collect do |cat|
if current_categories.include?(cat.id.to_s)
{
"name" => cat.title,
"category-link" => "/#{I18n.locale.to_s + page.url}/?category=#{cat.to_param}"
}
end
end
categories.unshift({"name" => t("news.all"), "category-link" => "/#{I18n.locale.to_s + page.url}/"})
categories.delete(nil)
categories = {"name" => t("news.all"), "category-link" => "/#{I18n.locale.to_s + page.url}/"} if categories.count != 1
anns = news.collect do |a|
if a.image_description.blank?
@ -141,8 +145,6 @@ class NewsController < ApplicationController
subtitle = a.subtitle.truncate(200)
end
{
"title" => HTMLEntities.new.encode(a.title),
"subtitle" => subtitle,