fix error
This commit is contained in:
parent
e4b1761651
commit
cccf18ba4c
|
@ -16,18 +16,22 @@ class Admin::EventNewsController < OrbitAdminController
|
|||
@tags = @module_app.tags
|
||||
@table_fields = [:status, :category, :title, "event_news.event_date", "event_news.start_date", "event_news.end_date", :last_modified]
|
||||
@current_user = current_user
|
||||
if params[:sort].blank?
|
||||
params[:sort] = 'event_date'
|
||||
params[:order] = 'desc'
|
||||
end
|
||||
if EventNewsSetting.first.is_display_edit_only && !current_user.is_admin? && !current_user.is_manager?(@module_app)
|
||||
current_user_is_sub_manager = !current_user.is_manager?(@module_app) && (current_user.is_sub_manager?(@module_app) || current_user.is_sub_manager_with_role?(@module_app)) rescue false
|
||||
if current_user_is_sub_manager
|
||||
@categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue []
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@event_news = EventNews.where(:category_id.ne=>nil, :create_user_id=>current_user.id,:is_preview.in=>[false,nil])
|
||||
.order_by(sort || :event_date)
|
||||
.order_by(sort)
|
||||
.with_categories(filters("category"))
|
||||
.with_tags(filters("tag"))
|
||||
.with_status(filters("status"))
|
||||
else
|
||||
@event_news = EventNews.where(:category_id.ne=>nil, :uid=>nil).order_by(sort || :event_date)
|
||||
@event_news = EventNews.where(:category_id.ne=>nil, :uid=>nil).order_by(sort)
|
||||
@categories = @module_app.categories.enabled
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
end
|
||||
|
@ -35,7 +39,7 @@ class Admin::EventNewsController < OrbitAdminController
|
|||
@categories = @module_app.categories.enabled
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@event_news = EventNews.where(:category_id.ne=>nil, :is_preview.in=>[false,nil])
|
||||
.order_by(sort || :event_date)
|
||||
.order_by(sort)
|
||||
.with_categories(filters("category"))
|
||||
.with_tags(filters("tag"))
|
||||
.with_status(filters("status"))
|
||||
|
@ -325,7 +329,7 @@ class Admin::EventNewsController < OrbitAdminController
|
|||
now_event_news_page = EventNews.where(:title.ne => "",:is_preview.in=>[false,nil])
|
||||
.order_by(sort).map(&:id).map.with_index.select{|v,i| v==event_news.id}[0][1] rescue nil
|
||||
now_event_news_page = now_event_news_page.nil? ? 0 : ((now_event_news_page+1).to_f/10).ceil
|
||||
redirect_to "/zh_tw/admin/event_news?page=#{now_event_news_page}"
|
||||
redirect_to admin_event_news_index_path(:page=>now_bulletin_page)
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
Loading…
Reference in New Issue