update homepage news

This commit is contained in:
nccu 2014-11-12 18:04:20 +08:00
parent 709b5a7ccb
commit 0e14737f1e
2 changed files with 5 additions and 3 deletions

View File

@ -98,7 +98,9 @@ class NewsController < ApplicationController
end
def widget
news = NewsBulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.order_by(:created_at=>'desc').filter_by_widget_categories.filter_by_tags(OrbitHelper.widget_tags)
params = OrbitHelper.params
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
news = NewsBulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_widget_categories.filter_by_tags(OrbitHelper.widget_tags)
page = Page.where(:module => "news").first rescue nil
ma = ModuleApp.find_by_key("news") rescue nil
categories = ma.categories.enabled.collect do |cat|
@ -184,7 +186,7 @@ class NewsController < ApplicationController
"department-link" => "/#{I18n.locale.to_s + page.url}/?department=#{(department.to_param rescue "")}",
"update_user" => update_user,
"updated_at" => news.updated_at.strftime('%Y-%m-%d %H:%M'),
"body" =>news.text,
"body" => news.text == "" ? "Content unavailable for this language." : news.text,
"image" => news.image.url,
"view_count" =>news.view_count
},

View File

@ -10,7 +10,7 @@ module News
categorizable
authorizable
frontend_enabled
data_count 1..10
data_count 1..12
side_bar do
head_label_i18n 'news.news', icon_class: "icons-book-2"