fixed pagnination errors for ask,qa,survey module

This commit is contained in:
saurabhbhatia 2013-08-19 10:12:28 +08:00
parent 88ad59f55a
commit bc596614fb
11 changed files with 9 additions and 22 deletions

View File

@ -12,7 +12,7 @@ class Panel::Ask::BackEnd::AskQuestionsController < OrbitBackendController
def index
@ask_questions = (params[:sort]) ? get_sorted_and_filtered('ask_questions') : get_viewable('ask_questions')
@all_ask_questions = @ask_questions.page params[:page]
respond_to do |format|
format.html
format.js

View File

@ -15,4 +15,6 @@ class AskQuestion
belongs_to :ask_category
has_one :ask_reply, dependent: :destroy
paginates_per 10
end

View File

@ -1,6 +0,0 @@
<%= render_sort_bar(true, delete_panel_ask_back_end_ask_questions_path(direction: params[:direction], sort: params[:sort], sort_options: params[:sort_options]),
['status', 'ask_reply.status','span1', :status],
['ask_category', 'ask_category','span1', :category],
['title', 'title','span3', :title],
['name', 'name','span1', 'mongoid.attributes.ask_question.name'],
['created_at', 'created_at','span1', 'mongoid.attributes.ask_question.created_at']).html_safe %>

View File

@ -18,6 +18,6 @@
<div class="form-actions form-fixed pagination-right">
<div id="ask_questions_pagination" class="paginationFixed">
<%= paginate @ask_questions %>
<%= paginate @all_ask_questions %>
</div>
</div>

View File

@ -36,7 +36,7 @@ class Panel::Faq::BackEnd::QasController < OrbitBackendController
# @qas = Qa.search(params[:category_id])
#@qas = (params[:sort] || @filter) ? get_sorted_and_filtered_qas : Qa.all.page(params[:page]).per(10)
@qas = (params[:sort] || @filter) ? get_sorted_and_filtered("qa",:qa_category_id.in => @qa_category_ids) : get_viewable("qa",:qa_category_id.in => @qa_category_ids)
@all_qas = @qas.page params[:page]
@tags = get_tags
respond_to do |format|

View File

@ -62,4 +62,5 @@ class Qa
self.tagged_ids.delete('')
end
paginates_per 10
end

View File

@ -1,5 +0,0 @@
<%= render_sort_bar(true, delete_panel_faq_back_end_qas_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['status', ['is_top', 'is_hot', 'is_hidden'], 'span1', :status],
['category', 'qa_category', 'span2', :category],
['question', 'title','span3', 'faq.question'],
['tags', 'tags', 'span2', :tags]).html_safe %>

View File

@ -17,6 +17,6 @@
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_faq_back_end_qa_path, :class => 'btn btn-primary pull-right' if (is_manager? rescue nil) %>
<div id="qa_pagination" class="paginationFixed">
<%= paginate @qas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
<%= paginate @all_qas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -136,4 +136,6 @@ class Survey
end
end
paginates_per 10
end

View File

@ -1,6 +0,0 @@
<%= render_sort_bar(true, delete_panel_survey_back_end_surveys_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['title', 'title', 'span3', 'survey.title'],
['postdate', 'postdate','span1', 'survey.postdate'],
['deadline', 'deadline','span1', 'survey.deadline'],
['results_count', 'results_count','span1', 'survey.results_count'],
['update_user', 'update_user','span2', 'survey.update_user']).html_safe %>

View File

@ -19,6 +19,5 @@
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_survey_back_end_survey_path, :class => 'btn btn-primary pull-right' if (is_manager? rescue nil) %>
<div id="survey_pagination" class="paginationFixed">
<%= paginate @surveys %>
</div>
</div>