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]
|
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@projects = Project.all
|
@projects = Project.order_by(:period_start_date=>'desc',:year=>'desc').page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class PersonalProjectsController < ApplicationController
|
class PersonalProjectsController < ApplicationController
|
||||||
def index
|
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|
|
project_list = projects.collect do |project|
|
||||||
{
|
{
|
||||||
"duration" => project.duration,
|
"duration" => project.duration,
|
||||||
|
@ -20,7 +20,8 @@ class PersonalProjectsController < ApplicationController
|
||||||
"th_job_title" => t('personal_project.job_title'),
|
"th_job_title" => t('personal_project.job_title'),
|
||||||
"th_participator" => t("personal_project.participator"),
|
"th_participator" => t("personal_project.participator"),
|
||||||
"th_authors" => t('users.name')
|
"th_authors" => t('users.name')
|
||||||
}
|
},
|
||||||
|
"total_pages" => projects.total_pages
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbody_projects" class="sort-holder">
|
<tbody id="tbody_projects" class="sort-holder">
|
||||||
<%= render :partial => 'project', :collection => @projects %>
|
<%= render 'project' %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</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' %>
|
<%= 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>
|
||||||
<div class="pagination pagination-centered">
|
<div class="pagination pagination-centered">
|
||||||
|
<%= content_tag :div, paginate(@projects), class: "pagination pagination-centered" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -14,6 +14,7 @@ module PersonalProject
|
||||||
|
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
icon_class_no_sidebar "icons-user"
|
icon_class_no_sidebar "icons-user"
|
||||||
|
data_count 1..10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue