From bc596614fbda9fd6fef73c33c93ba8f60f8c9fc1 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Mon, 19 Aug 2013 10:12:28 +0800 Subject: [PATCH] fixed pagnination errors for ask,qa,survey module --- .../panel/ask/back_end/ask_questions_controller.rb | 2 +- vendor/built_in_modules/ask/app/models/ask_question.rb | 2 ++ .../panel/ask/back_end/ask_questions/_sort_headers.html.erb | 6 ------ .../views/panel/ask/back_end/ask_questions/index.html.erb | 2 +- .../app/controllers/panel/faq/back_end/qas_controller.rb | 2 +- vendor/built_in_modules/faq/app/models/qa.rb | 1 + .../app/views/panel/faq/back_end/qas/_sort_headers.html.erb | 5 ----- .../faq/app/views/panel/faq/back_end/qas/index.html.erb | 2 +- vendor/built_in_modules/survey/app/models/survey.rb | 2 ++ .../panel/survey/back_end/surveys/_sort_headers.html.erb | 6 ------ .../app/views/panel/survey/back_end/surveys/index.html.erb | 1 - 11 files changed, 9 insertions(+), 22 deletions(-) diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb index 9d31ab73..b9c670d1 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb @@ -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 diff --git a/vendor/built_in_modules/ask/app/models/ask_question.rb b/vendor/built_in_modules/ask/app/models/ask_question.rb index 13989acc..495609ac 100644 --- a/vendor/built_in_modules/ask/app/models/ask_question.rb +++ b/vendor/built_in_modules/ask/app/models/ask_question.rb @@ -15,4 +15,6 @@ class AskQuestion belongs_to :ask_category has_one :ask_reply, dependent: :destroy + + paginates_per 10 end diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/_sort_headers.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/_sort_headers.html.erb index 247365ee..e69de29b 100644 --- a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/_sort_headers.html.erb +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/_sort_headers.html.erb @@ -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 %> diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/index.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/index.html.erb index ff6d9315..c8591692 100644 --- a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/index.html.erb +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/index.html.erb @@ -18,6 +18,6 @@
- <%= paginate @ask_questions %> + <%= paginate @all_ask_questions %>
diff --git a/vendor/built_in_modules/faq/app/controllers/panel/faq/back_end/qas_controller.rb b/vendor/built_in_modules/faq/app/controllers/panel/faq/back_end/qas_controller.rb index 8cf359a6..07dd41a8 100644 --- a/vendor/built_in_modules/faq/app/controllers/panel/faq/back_end/qas_controller.rb +++ b/vendor/built_in_modules/faq/app/controllers/panel/faq/back_end/qas_controller.rb @@ -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| diff --git a/vendor/built_in_modules/faq/app/models/qa.rb b/vendor/built_in_modules/faq/app/models/qa.rb index 085db491..9ff023cd 100644 --- a/vendor/built_in_modules/faq/app/models/qa.rb +++ b/vendor/built_in_modules/faq/app/models/qa.rb @@ -62,4 +62,5 @@ class Qa self.tagged_ids.delete('') end + paginates_per 10 end \ No newline at end of file diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb index 71b0a8b9..e69de29b 100644 --- a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb +++ b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb @@ -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 %> \ No newline at end of file diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/index.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/index.html.erb index 30714cdc..d4b96215 100644 --- a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/index.html.erb +++ b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/index.html.erb @@ -17,6 +17,6 @@
<%= 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) %>
- <%= 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} %>
diff --git a/vendor/built_in_modules/survey/app/models/survey.rb b/vendor/built_in_modules/survey/app/models/survey.rb index 4f271eee..579f091a 100644 --- a/vendor/built_in_modules/survey/app/models/survey.rb +++ b/vendor/built_in_modules/survey/app/models/survey.rb @@ -136,4 +136,6 @@ class Survey end end + paginates_per 10 + end \ No newline at end of file diff --git a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_sort_headers.html.erb b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_sort_headers.html.erb index 9b556368..e69de29b 100644 --- a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_sort_headers.html.erb +++ b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_sort_headers.html.erb @@ -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 %> \ No newline at end of file diff --git a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/index.html.erb b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/index.html.erb index 2144c19a..15c19d90 100644 --- a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/index.html.erb +++ b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/index.html.erb @@ -19,6 +19,5 @@
<%= 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) %>
- <%= paginate @surveys %>
\ No newline at end of file