Fix announcement pagination in front-end
This commit is contained in:
parent
0b1f83c042
commit
4dd9b7ffa4
|
@ -30,7 +30,11 @@ class PagesController < ApplicationController
|
|||
end
|
||||
|
||||
def index_from_link
|
||||
redirect_to "/#{@item.full_name}"
|
||||
if params[:page]
|
||||
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
|
||||
else
|
||||
redirect_to "/#{@item.full_name}"
|
||||
end
|
||||
end
|
||||
|
||||
def show_from_link
|
||||
|
|
|
@ -100,7 +100,7 @@ module ParserBackEnd
|
|||
ret = ''
|
||||
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
|
||||
ret << "&bulletin_category_id=#{page.category}" if page[:category]
|
||||
ret << "&category_id=#{page.category}" if page[:category]
|
||||
ret << "'></div>"
|
||||
else
|
||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
||||
|
|
|
@ -127,7 +127,7 @@ module ParserFrontEnd
|
|||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||
ret << "/#{id}" if id
|
||||
ret << "?inner=true&page_id=#{page.id}"
|
||||
ret << "&bulletin_category_id=#{page.category}" if page[:category]
|
||||
ret << "&category_id=#{page.category}" if page[:category]
|
||||
ret << "'></div>"
|
||||
else
|
||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil
|
||||
|
|
|
@ -11,15 +11,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
|
|||
def index
|
||||
|
||||
date_now = Time.now
|
||||
if params[:bulletin_category_id]
|
||||
@bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
if params[:category_id]
|
||||
@bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
else
|
||||
@bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
@current_category = BulletinCategory.from_id(params[:bulletin_category_id]) rescue nil
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -29,5 +29,5 @@
|
|||
|
||||
</table>
|
||||
|
||||
<%= paginate @bulletins %>
|
||||
<%= paginate @bulletins, :params => {:inner => 'false'} %>
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ Rails.application.routes.draw do
|
|||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
root :to => "bulletins#index"
|
||||
resources :bulletins
|
||||
end
|
||||
namespace :widget do
|
||||
|
|
Loading…
Reference in New Issue