forked from saurabh/personal-project
Pagination
This commit is contained in:
parent
884f4a0e82
commit
ee08037aad
|
@ -5,7 +5,7 @@ class Admin::ProjectsController < OrbitMemberController
|
|||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
def index
|
||||
@projects = Project.all
|
||||
@projects = Project.order_by(:period_start_date=>'desc',:year=>'desc').page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class PersonalProjectsController < ApplicationController
|
||||
def index
|
||||
projects = Project.where(:is_hidden=>false).all
|
||||
projects = Project.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
project_list = projects.collect do |project|
|
||||
{
|
||||
"duration" => project.duration,
|
||||
|
@ -20,7 +20,8 @@ class PersonalProjectsController < ApplicationController
|
|||
"th_job_title" => t('personal_project.job_title'),
|
||||
"th_participator" => t("personal_project.participator"),
|
||||
"th_authors" => t('users.name')
|
||||
}
|
||||
},
|
||||
"total_pages" => projects.total_pages
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_projects" class="sort-holder">
|
||||
<%= render :partial => 'project', :collection => @projects %>
|
||||
<%= render 'project' %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -19,5 +19,6 @@
|
|||
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_project_setting_path, :class => 'btn btn-primary pull-right' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= content_tag :div, paginate(@projects), class: "pagination pagination-centered" %>
|
||||
</div>
|
||||
</div>
|
|
@ -14,6 +14,7 @@ module PersonalProject
|
|||
|
||||
frontend_enabled
|
||||
icon_class_no_sidebar "icons-user"
|
||||
data_count 1..10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue