Skip to content
Snippets Groups Projects
Commit 048e3fb9 authored by Giovanne Marcelo's avatar Giovanne Marcelo
Browse files

Fix-pagination

parent a0ad2833
No related branches found
No related tags found
No related merge requests found
Showing
with 114 additions and 81 deletions
......@@ -3,7 +3,7 @@ class Management::UsersController < ManagementController
before_action :set_roles, only: [:new, :edit]
def index
@users = User.includes(:roles).all
@users = User.includes(:roles).all.order(:name).page(params[:page]).per(params[:limit])
end
# GET /users/1
......@@ -79,6 +79,7 @@ class Management::UsersController < ManagementController
@curators << user unless !(user.roles[0].name == "curator")
end
end
@curators = Kaminari.paginate_array(@curators).page(params[:page]).per(params[:limit])
end
def admins
......@@ -89,6 +90,7 @@ class Management::UsersController < ManagementController
@admins << user unless !(user.roles[0].name == "admin")
end
end
@admins = Kaminari.paginate_array(@admins).page(params[:page]).per(params[:limit])
end
private
......
<li>
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
<li>
<li class='disabled'>
<%= content_tag :a, raw(t 'views.pagination.truncate') %>
</li>
<li>
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
</li>
<li>
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
</li>
<% if page.current? %>
<li class='ls-active'>
<%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
</li>
<% else %>
<li>
<%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
</li>
<% end %>
<%= paginator.render do -%>
<ul class="ls-pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
<% end -%>
<li>
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
</li>
<h1 class="ls-title-intro ls-ico-users">Carrossel</h1>
<h1 class="ls-title-intro ls-ico-star">Carrossel</h1>
<ol class="ls-breadcrumb">
<li><%= link_to 'Carrosséis', management_carousels_path %></li>
......
<h1 class="ls-title-intro ls-ico-users">Carrossel</h1>
<h1 class="ls-title-intro ls-ico-star">Carrossel</h1>
<a href="<%= new_management_carousel_path %>" class="ls-btn-primary" aria-expanded="false" role="combobox">Cadastrar
......
<h1 class="ls-title-intro ls-ico-users">Carrossel</h1>
<h1 class="ls-title-intro ls-ico-star">Carrossel</h1>
<ol class="ls-breadcrumb">
<li><%= link_to 'Carrosséis', management_carousels_path %></li>
......
<h1 class="ls-title-intro ls-ico-stats">Denúncias</h1>
<h1 class="ls-title-intro ls-ico-bullhorn">Denúncias</h1>
<div class="ls-box-filter">
......
<h1 class="ls-title-intro ls-ico-stats">Denúncias</h1>
<h1 class="ls-title-intro ls-ico-bullhorn">Denúncias</h1>
<div class="ls-box-filter">
......@@ -123,4 +123,4 @@
</div>
</div>
\ No newline at end of file
</div>
<h1 class="ls-title-intro ls-ico-users">Instituições</h1>
<h1 class="ls-title-intro ls-ico-list2">Instituições</h1>
<a href="<%= new_management_institution_path %>" class="ls-btn-primary" aria-expanded="false" role="combobox">Cadastrar nova</a>
......
<h1 class="ls-title-intro ls-ico-users">Instituição</h1>
<h1 class="ls-title-intro ls-ico-list2">Instituição</h1>
<ol class="ls-breadcrumb">
<li><%= link_to 'Instituição', management_institutions_path %></li>
......
......@@ -83,29 +83,27 @@
</table>
<div class="ls-pagination-filter">
<ul class="ls-pagination">
<li><a href="#">« Anterior</a></li>
<li class="ls-active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#" class="hidden-xs">4</a></li>
<li><a href="#" class="hidden-xs">5</a></li>
<li><a href="#">Próximo »</a></li>
</ul>
<div class="ls-filter-view">
<label for="">
Exibir
<div class="ls-custom-select ls-field-sm">
<select name="" id="">
<option value="10">10</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
ítens por página
</label>
</div>
<%= paginate @admins, :theme => 'management_theme', :window => 2 %>
<div class="ls-filter-view">
<label for="">
Exibir &nbsp
<div class="ls-custom-select ls-field-sm">
<%= form_tag ("admins"), method: :get, id: "limit_form" do %>
<%= select_tag :limit, options_for_select([25, 50, 100, 150], selected: params[:limit] || 25) %>
<%end%>
</div>
&nbsp itens por página.
</label>
</div>
</div>
<% end %>
<script type="text/javascript" >
$(function(){
$('#limit').change(
function() {
$('#limit_form').submit();
});
});
</script>
......@@ -83,29 +83,27 @@
</table>
<div class="ls-pagination-filter">
<ul class="ls-pagination">
<li><a href="#">« Anterior</a></li>
<li class="ls-active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#" class="hidden-xs">4</a></li>
<li><a href="#" class="hidden-xs">5</a></li>
<li><a href="#">Próximo »</a></li>
</ul>
<div class="ls-filter-view">
<label for="">
Exibir
<div class="ls-custom-select ls-field-sm">
<select name="" id="">
<option value="10">10</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
ítens por página
</label>
</div>
<%= paginate @curators, :theme => 'management_theme', :window => 2 %>
<div class="ls-filter-view">
<label for="">
Exibir &nbsp
<div class="ls-custom-select ls-field-sm">
<%= form_tag ("curators"), method: :get, id: "limit_form" do %>
<%= select_tag :limit, options_for_select([25, 50, 100, 150], selected: params[:limit] || 25) %>
<%end%>
</div>
&nbsp itens por página.
</label>
</div>
</div>
<% end %>
<script type="text/javascript" >
$(function(){
$('#limit').change(
function() {
$('#limit_form').submit();
});
});
</script>
......@@ -87,28 +87,26 @@
</table>
<div class="ls-pagination-filter">
<ul class="ls-pagination">
<li><a href="#">« Anterior</a></li>
<li class="ls-active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#" class="hidden-xs">4</a></li>
<li><a href="#" class="hidden-xs">5</a></li>
<li><a href="#">Próximo »</a></li>
</ul>
<%= paginate @users, :theme => 'management_theme', :window => 2 %>
<div class="ls-filter-view">
<label for="">
Exibir
Exibir &nbsp
<div class="ls-custom-select ls-field-sm">
<select name="" id="">
<option value="10">10</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
<%= form_tag ("users"), method: :get, id: "limit_form" do %>
<%= select_tag :limit, options_for_select([25, 50, 100, 150], selected: params[:limit] || 25) %>
<%end%>
</div>
ítens por página
&nbsp itens por página.
</label>
</div>
</div>
<script type="text/javascript" >
$(function(){
$('#limit').change(
function() {
$('#limit_form').submit();
});
});
</script>
......@@ -13,9 +13,9 @@
<li><%= link_to "Acessos", accesses_management_statistics_path, class: 'ls-submenu-item' %></li>
</ul>
</li>
<li><%= link_to "Instituições", management_institutions_path, class: 'ls-submenu-item' %></li>
<li><%= link_to "Instituições", management_institutions_path, class: 'ls-ico-list2' %></li>
<li class="ls-submenu">
<a href="#" class="ls-ico-stats">Usuários e permissões</a>
<a href="#" class="ls-ico-user">Usuários e permissões</a>
<ul role="menu">
<li><%= link_to "Usuários", management_users_path, class: 'ls-submenu-item' %></li>
<li><%= link_to "Curadores", curators_management_users_path, class: 'ls-submenu-item' %></li>
......@@ -23,10 +23,9 @@
</ul>
</li>
<li><%= link_to "Denúncias", management_complaints_path, class: 'ls-ico-bullhorn' %>
<li>
<li> <%= link_to "Voltar ao Portal", root_path, class: 'ls-ico-chevron-left' %> </li>
</ul>
<li> <%= link_to "Voltar ao Portal", root_path %> </li>
</nav>
......@@ -4,7 +4,6 @@
</a>
<nav class="ls-dropdown-nav ls-user-menu">
<ul>
<li><%= link_to "Voltar para o Portal", root_path %></li>
<li><%= link_to "Conta", me_users_path%></li>
<li><%= link_to "Sair", destroy_user_session_path, method: 'delete' %></li>
</ul>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment