Fix announcement pagination in front-end

This commit is contained in:
Christophe Vilayphiou 2012-03-01 10:58:31 +08:00
parent 0b1f83c042
commit 4dd9b7ffa4
6 changed files with 12 additions and 9 deletions

View File

@ -30,8 +30,12 @@ class PagesController < ApplicationController
end
def index_from_link
if params[:page]
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
else
redirect_to "/#{@item.full_name}"
end
end
def show_from_link
redirect_to "/#{@item.full_name}?id=#{params[:id]}"

View File

@ -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 }

View File

@ -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

View File

@ -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

View File

@ -29,5 +29,5 @@
</table>
<%= paginate @bulletins %>
<%= paginate @bulletins, :params => {:inner => 'false'} %>

View File

@ -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