Fix announcement pagination in front-end
This commit is contained in:
parent
ebf3a2eae4
commit
9ae140204f
|
@ -30,7 +30,11 @@ class PagesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_from_link
|
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
|
end
|
||||||
|
|
||||||
def show_from_link
|
def show_from_link
|
||||||
|
|
|
@ -100,7 +100,7 @@ module ParserBackEnd
|
||||||
ret = ''
|
ret = ''
|
||||||
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
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 << "<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>"
|
ret << "'></div>"
|
||||||
else
|
else
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
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 << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||||
ret << "/#{id}" if id
|
ret << "/#{id}" if id
|
||||||
ret << "?inner=true&page_id=#{page.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>"
|
ret << "'></div>"
|
||||||
else
|
else
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil
|
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
|
def index
|
||||||
|
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
if params[:bulletin_category_id]
|
if params[: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)
|
@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
|
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)
|
@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
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
|
|
||||||
@current_category = BulletinCategory.from_id(params[:bulletin_category_id]) rescue nil
|
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -28,6 +28,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<%= paginate @bulletins %>
|
<%= paginate @bulletins, :params => {:inner => 'false'} %>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ Rails.application.routes.draw do
|
||||||
resources :tags
|
resources :tags
|
||||||
end
|
end
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
root :to => "bulletins#index"
|
|
||||||
resources :bulletins
|
resources :bulletins
|
||||||
end
|
end
|
||||||
namespace :widget do
|
namespace :widget do
|
||||||
|
|
Reference in New Issue