Fix announcement page error.

This commit is contained in:
BoHung Chiu 2020-11-17 21:55:15 +08:00
parent b7c36af497
commit dd67af744d
1 changed files with 4 additions and 4 deletions

View File

@ -244,7 +244,7 @@ class Admin::AnnouncementsController < OrbitAdminController
bulletin.save bulletin.save
build_email(bulletin,I18n.locale) build_email(bulletin,I18n.locale)
create_feed_cache(bulletin) create_feed_cache(bulletin)
redirect_to params['referer_url'] redirect_to admin_announcements_path
end end
def approve_bulletin def approve_bulletin
@ -324,19 +324,19 @@ class Admin::AnnouncementsController < OrbitAdminController
now_bulletin_page = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]) now_bulletin_page = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil])
.order_by(sort).map(&:id).map.with_index.select{|v,i| v==bulletin.id}[0][1] rescue nil .order_by(sort).map(&:id).map.with_index.select{|v,i| v==bulletin.id}[0][1] rescue nil
now_bulletin_page = now_bulletin_page.nil? ? 0 : ((now_bulletin_page+1).to_f/10).ceil now_bulletin_page = now_bulletin_page.nil? ? 0 : ((now_bulletin_page+1).to_f/10).ceil
redirect_to "/zh_tw/admin/announcements?page=#{now_bulletin_page}" redirect_to admin_announcements_path(:page=>now_bulletin_page)
end end
def destroy def destroy
@bulletin.destroy @bulletin.destroy
redirect_to "/admin/announcements" redirect_to admin_announcements_path
end end
def delete def delete
if params[:ids] if params[:ids]
Bulletin.any_in(:uid => params[:ids]).destroy_all Bulletin.any_in(:uid => params[:ids]).destroy_all
end end
redirect_to "/admin/announcements" redirect_to admin_announcements_path
end end
def preview def preview