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]
|
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@researchs = Research.all
|
@researchs = Research.order_by(:year=>'desc').page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
class PersonalResearchesController < ApplicationController
|
class PersonalResearchesController < ApplicationController
|
||||||
def index
|
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|
|
research_list = researchs.collect do |research|
|
||||||
{
|
{
|
||||||
"member" => research.member_profile.name,
|
"member" => research.member_profile.name,
|
||||||
"year" => research.year,
|
"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,
|
"research_title" => research.research_title,
|
||||||
"link_to_show" => OrbitHelper.url_to_show(research.to_param)
|
"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_publication_date" => t('personal_research.publication_date'),
|
||||||
"th_research_title" => t('personal_research.research_title'),
|
"th_research_title" => t('personal_research.research_title'),
|
||||||
"th_detail" => t('detail')
|
"th_detail" => t('detail')
|
||||||
}
|
},
|
||||||
|
"total_pages" => researchs.total_pages
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ class PersonalResearchesController < ApplicationController
|
||||||
"extracted_chapters" => research.extracted_chapters,
|
"extracted_chapters" => research.extracted_chapters,
|
||||||
"year" => research.year,
|
"year" => research.year,
|
||||||
"language" => t(research.language),
|
"language" => t(research.language),
|
||||||
"publish_date" => research.publish_date.strftime("%Y.%m"),
|
"publish_date" => (research.publish_date.strftime("%Y.%m") rescue ""),
|
||||||
"keywords" => research.keywords,
|
"keywords" => research.keywords,
|
||||||
"url" => research.url,
|
"url" => research.url,
|
||||||
"note" => research.note,
|
"note" => research.note,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% @researchs.each do |research| %>
|
<% @researchs.each do |research| %>
|
||||||
<tr id="<%= dom_id research %>" class="<%= research.is_hidden ? "checkHide" : "" %>">
|
<tr id="<%= dom_id research %>" class="<%= research.is_hidden ? "checkHide" : "" %>">
|
||||||
<td><%= research.year %></td>
|
<td><%= research.year %></td>
|
||||||
<td><%= research.publish_date.strftime("%Y.%m") %></td>
|
<td><%= research.publish_date.strftime("%Y.%m") rescue "" %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
|
<%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
|
|
|
@ -8,6 +8,15 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbody_researchs" class="sort-holder">
|
<tbody id="tbody_researchs" class="sort-holder">
|
||||||
<%= render :partial => 'research', :collection => @researchs %>
|
<%= render 'research' %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</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
|
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