Pagination

This commit is contained in:
manson 2014-07-18 14:31:29 +08:00
parent ea5c94a13c
commit c6fe4b9cd3
4 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,7 @@ class Admin::WritingConferencesController < OrbitMemberController
before_action :get_settings,:only => [:new, :edit, :setting] before_action :get_settings,:only => [:new, :edit, :setting]
def index def index
@writing_conferences = WritingConference.all @writing_conferences = WritingConference.order_by(:year=>'desc').page(params[:page]).per(10)
end end
def new def new

View File

@ -1,6 +1,6 @@
class PersonalConferencesController < ApplicationController class PersonalConferencesController < ApplicationController
def index def index
writing_conferences = WritingConference.where(:is_hidden=>false).all writing_conferences = WritingConference.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
writing_conference_list = writing_conferences.collect do |writing_conference| writing_conference_list = writing_conferences.collect do |writing_conference|
{ {
"year" => writing_conference.year, "year" => writing_conference.year,
@ -16,7 +16,8 @@ class PersonalConferencesController < ApplicationController
"th_year" => t('personal_plugins.year'), "th_year" => t('personal_plugins.year'),
"th_title" => t("personal_conference.paper_title"), "th_title" => t("personal_conference.paper_title"),
"th_author" => t('personal_plugins.author') "th_author" => t('personal_plugins.author')
} },
"total_pages" => writing_conferences.total_pages
} }
end end
@ -58,7 +59,7 @@ class PersonalConferencesController < ApplicationController
"location" => writing_conference.location, "location" => writing_conference.location,
"sponsor" => writing_conference.sponsor, "sponsor" => writing_conference.sponsor,
"year" => writing_conference.year, "year" => writing_conference.year,
"language" => t(writing_conference.language), "language" => (t(writing_conference.language) rescue ""),
"keywords" => writing_conference.keywords, "keywords" => writing_conference.keywords,
"abstract" => writing_conference.abstract, "abstract" => writing_conference.abstract,
"publication_date" => writing_conference.publication_date, "publication_date" => writing_conference.publication_date,

View File

@ -7,15 +7,15 @@
</tr> </tr>
</thead> </thead>
<tbody id="tbody_writing_conferences" class="sort-holder"> <tbody id="tbody_writing_conferences" class="sort-holder">
<%= render :partial => 'writing_conference', :collection => @writing_conferences %> <%= render 'writing_conference' %>
</tbody> </tbody>
</table> </table>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_conference_setting_path, :class => 'btn btn-primary pull-right' %> <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_conference_setting_path, :class => 'btn btn-primary pull-right' %>
<%#= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('new_'), new_admin_writing_conference_path, :class => 'btn btn-primary pull-right' %>
</div> </div>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= content_tag :div, paginate(@writing_conferences), class: "pagination pagination-centered" %>
</div> </div>
</div> </div>

View File

@ -13,6 +13,7 @@ module PersonalConference
update_info 'some update_info' update_info 'some update_info'
frontend_enabled frontend_enabled
data_count 1..10
icon_class_no_sidebar "icons-user" icon_class_no_sidebar "icons-user"
end end
end end