Pagination
This commit is contained in:
parent
b5aa87fc7e
commit
0a087e1df4
|
@ -5,7 +5,7 @@ class Admin::PatentsController < OrbitMemberController
|
|||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
def index
|
||||
@patents = Patent.all
|
||||
@patents = Patent.order_by(:year=>'desc').page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class PersonalPatentsController < ApplicationController
|
||||
def index
|
||||
patents = Patent.where(:is_hidden=>false).all
|
||||
patents = Patent.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
patent_list = patents.collect do |patent|
|
||||
{
|
||||
"publication_date" => patent.publish_date,
|
||||
|
@ -20,7 +20,8 @@ class PersonalPatentsController < ApplicationController
|
|||
"th_patent_no" => t('personal_patent.patent_no'),
|
||||
"th_patent_country" => t("personal_patent.patent_country"),
|
||||
"th_authors" => t('users.name')
|
||||
}
|
||||
},
|
||||
"total_pages" => patents.total_pages
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_patents" class="sort-holder">
|
||||
<%= render :partial => 'patent', :collection => @patents %>
|
||||
<%= render 'patent' %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -18,5 +18,6 @@
|
|||
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_patent_setting_path, :class => 'btn btn-primary pull-right' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= content_tag :div, paginate(@patents), class: "pagination pagination-centered" %>
|
||||
</div>
|
||||
</div>
|
|
@ -14,6 +14,7 @@ module PersonalPatent
|
|||
|
||||
frontend_enabled
|
||||
icon_class_no_sidebar "icons-user"
|
||||
data_count 1..10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue