two major fix for site setting and bulletin controller

This commit is contained in:
Harry Bomrah 2013-11-08 16:34:26 +08:00 committed by saurabhbhatia
parent 9e432a5a93
commit ed569601c3
2 changed files with 9 additions and 6 deletions

View File

@ -21,12 +21,16 @@ class Admin::PagesController < Admin::ItemsController
end end
def update def update
if params[:page][:category]
if params[:page][:category][0] == "" if params[:page][:category][0] == ""
params[:page][:category] = [] params[:page][:category] = []
end end
end
if params[:page][:tag]
if params[:page][:tag][0] == "" if params[:page][:tag][0] == ""
params[:page][:tag] = [] params[:page][:tag] = []
end end
end
@item = Page.find(params[:id]) @item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank? if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )

View File

@ -26,7 +26,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
end end
def index def index
@bulletins = get_bulletins_for_index
end end
def get_bulletins_for_index def get_bulletins_for_index
@ -47,7 +47,6 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
# @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:category_id.in=>params[:category_id],:tagged_ids.in=>params[:tag_id]) # @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:category_id.in=>params[:category_id],:tagged_ids.in=>params[:tag_id])
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
debugger
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:category_id.in => params[:category_id]).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:category_id.in => params[:category_id]).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil