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