add pagination for personal plugin

This commit is contained in:
Rueshyna 2013-03-08 12:00:44 +08:00 committed by Matt K. Fu
parent d840b82fa9
commit e9ddb85734
6 changed files with 32 additions and 6 deletions

View File

@ -1,8 +1,11 @@
class Panel::PersonalConference::Desktop::ConferenceCoAuthorRelationsController < ApplicationController
def index
page = params[:page]
page ||= 1
@conference_co_author_relations = ConferenceCoAuthorRelation.all
new
@conference_co_author_relations = @conference_co_author_relations.page(page).per(5)
respond_to do |format|
format.html {render layout: false }
end

View File

@ -1,10 +1,12 @@
class Panel::PersonalConference::Desktop::ConferenceCoAuthorsController < ApplicationController
def index
nils, not_nils = ConferenceCoAuthor.where(name_id: current_user.id)\
.asc(:co_author).partition{|p| p.email.nil?}
@conference_co_authors = not_nils + nils
page = params[:page]
page ||= 1
@conference_co_authors = ConferenceCoAuthor.where(name_id: current_user.id).asc(:co_author)
@conference_co_author_relations = ConferenceCoAuthorRelation.all
@conference_co_authors = @conference_co_authors.page(page).per(5)
respond_to do |format|
format.html { render :layout => false}
end

View File

@ -2,6 +2,8 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
def index
@view_by = params[:view]
@writing_conferences = WritingConference.where(create_user_id: current_user.id)
page = params[:page]
page ||= 1
if @view_by.nil?
@writing_conferences = @writing_conferences.asc(:paper_title)
@ -11,6 +13,8 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
@level_types = ConferencePaperType.all
@writing_conferences = @writing_conferences.page(page).per(5)
respond_to do |format|
format.html { render :layout => false}
end
@ -84,9 +88,13 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
end
def conference_type
page = params[:page]
page ||= 1
conference_types = ConferencePaperType.all
all_conference_lists = WritingConference.where(create_user_id: current_user.id)
all_conference_lists = all_conference_lists.asc(:conference_title)
all_conference_lists = all_conference_lists.page(page).per(5)
all_conference_lists = all_conference_lists.map do |j|
[ j.conference_title,
j.conference_paper_type_ids.map do |type|

View File

@ -1,8 +1,11 @@
class Panel::PersonalJournal::Desktop::JournalCoAuthorRelationsController < ApplicationController
def index
page = params[:page]
page ||= 1
@journal_co_author_relations = JournalCoAuthorRelation.all
new
@journal_co_author_relations = @journal_co_author_relations.page(page).per(5)
respond_to do |format|
format.html {render layout: false }
end

View File

@ -1,10 +1,12 @@
class Panel::PersonalJournal::Desktop::JournalCoAuthorsController < ApplicationController
def index
nils, not_nils = JournalCoAuthor.where(name_id: current_user.id)\
.asc(:co_author).partition{|p| p.email.nil?}
@journal_co_authors = not_nils + nils
page = params[:page]
page ||= 1
@journal_co_authors = JournalCoAuthor.where(name_id: current_user.id).asc(:co_author)
@journal_co_author_relations = JournalCoAuthorRelation.all
@journal_co_authors = @journal_co_authors.page(page).per(5)
respond_to do |format|
format.html { render :layout => false}
end

View File

@ -3,6 +3,8 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
@writing_journals = WritingJournal.where(create_user_id: current_user.id)
@level_types = JournalLevelType.all
@view_by = params[:view]
page = params[:page]
page ||= 1
if @view_by.nil?
@writing_journals = @writing_journals.asc(:paper_title)
@ -12,6 +14,8 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
@level_types = ConferencePaperType.all
@writing_journals = @writing_journals.page(page).per(5)
respond_to do |format|
format.html { render :layout => false}
end
@ -85,9 +89,13 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
end
def journal_type
page = params[:page]
page ||= 1
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
all_journal_lists = all_journal_lists.asc(:journal_title)
all_journal_lists = all_journal_lists.page(page).per(5)
all_journal_lists = all_journal_lists.map do |j|
[ j.journal_title,
j.journal_level_type_ids.map do |type|