Fix announcement pagination in front-end
This commit is contained in:
parent
ebf3a2eae4
commit
9ae140204f
|
@ -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
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<%= paginate @bulletins %>
|
||||
|
||||
<%= paginate @bulletins, :params => {:inner => 'false'} %>
|
||||
|
||||
|
|
|
@ -10,7 +10,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