Pagination
This commit is contained in:
parent
ecf3e35d1e
commit
802ff0b000
|
@ -5,7 +5,7 @@ class Admin::ResearchsController < OrbitMemberController
|
|||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
def index
|
||||
@researchs = Research.all
|
||||
@researchs = Research.order_by(:year=>'desc').page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class PersonalResearchesController < ApplicationController
|
||||
def index
|
||||
researchs = Research.where(:is_hidden=>false).all
|
||||
researchs = Research.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
research_list = researchs.collect do |research|
|
||||
{
|
||||
"member" => research.member_profile.name,
|
||||
"year" => research.year,
|
||||
"publication_date" => research.publish_date.strftime("%Y.%m"),
|
||||
"publication_date" => (research.publish_date.strftime("%Y.%m") rescue ""),
|
||||
"research_title" => research.research_title,
|
||||
"link_to_show" => OrbitHelper.url_to_show(research.to_param)
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ class PersonalResearchesController < ApplicationController
|
|||
"th_publication_date" => t('personal_research.publication_date'),
|
||||
"th_research_title" => t('personal_research.research_title'),
|
||||
"th_detail" => t('detail')
|
||||
}
|
||||
},
|
||||
"total_pages" => researchs.total_pages
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -44,7 +45,7 @@ class PersonalResearchesController < ApplicationController
|
|||
"extracted_chapters" => research.extracted_chapters,
|
||||
"year" => research.year,
|
||||
"language" => t(research.language),
|
||||
"publish_date" => research.publish_date.strftime("%Y.%m"),
|
||||
"publish_date" => (research.publish_date.strftime("%Y.%m") rescue ""),
|
||||
"keywords" => research.keywords,
|
||||
"url" => research.url,
|
||||
"note" => research.note,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% @researchs.each do |research| %>
|
||||
<tr id="<%= dom_id research %>" class="<%= research.is_hidden ? "checkHide" : "" %>">
|
||||
<td><%= research.year %></td>
|
||||
<td><%= research.publish_date.strftime("%Y.%m") %></td>
|
||||
<td><%= research.publish_date.strftime("%Y.%m") rescue "" %></td>
|
||||
<td>
|
||||
<%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
|
||||
<div class="quick-edit">
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_researchs" class="sort-holder">
|
||||
<%= render :partial => 'research', :collection => @researchs %>
|
||||
<%= render 'research' %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<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' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= content_tag :div, paginate(@researchs), class: "pagination pagination-centered" %>
|
||||
</div>
|
||||
</div>
|
|
@ -13,6 +13,7 @@ module PersonalResearch
|
|||
|
||||
frontend_enabled
|
||||
icon_class_no_sidebar "icons-user"
|
||||
data_count 1..10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue