Intalled pagy and applyed to admin/users index
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
@import "pagy.tailwind.css";
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
|
||||
@layer components {
|
||||
.btn {
|
||||
@apply px-4 py-2 font-semibold text-white transition-colors duration-100 bg-opacity-100 shadow bg-hsrm-gray-light hover:bg-opacity-75 ;
|
||||
|
||||
21
app/assets/stylesheets/pagy.tailwind.css
Normal file
21
app/assets/stylesheets/pagy.tailwind.css
Normal file
@@ -0,0 +1,21 @@
|
||||
.pagy {
|
||||
@apply flex pt-2 space-x-1 font-semibold text-gray-500;
|
||||
a:not(.gap) {
|
||||
@apply block px-3 py-1 bg-gray-200 shadow-lg;
|
||||
&:hover {
|
||||
@apply bg-gray-300;
|
||||
}
|
||||
&:not([href]) { /* disabled links */
|
||||
@apply text-gray-300 bg-gray-100 cursor-default;
|
||||
}
|
||||
&.current {
|
||||
@apply text-white bg-hsrm-red;
|
||||
}
|
||||
}
|
||||
label {
|
||||
@apply inline-block whitespace-nowrap bg-gray-200 px-3 py-0.5;
|
||||
input {
|
||||
@apply bg-gray-100 border-none rounded-md;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ class Admin::UsersController < ApplicationController
|
||||
|
||||
def index
|
||||
@users = User.all.order(:lastname, :firstname)
|
||||
@pagy, @records = pagy(@users, limit: 20)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
include Pagy::Backend
|
||||
|
||||
before_action :set_current_request_details
|
||||
before_action :authenticate_user!
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module ApplicationHelper
|
||||
include Pagy::Frontend
|
||||
|
||||
def icon(name, options = {})
|
||||
options[:title] ||= name.underscore.humanize
|
||||
options[:aria] = true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%= turbo_frame_tag dom_id(user) do %>
|
||||
<tr id="<%= dom_id user %>" class="bg-role-<%= user.role %>-light odd:bg-opacity-25 even:bg-opacity-15 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30"">
|
||||
<td class="p-2 py-3 text-center">
|
||||
<%= link_to admin_user_path(user) do %>
|
||||
<%= link_to admin_user_path(user), target: "_top" do %>
|
||||
<span class="badge badge-xl text-role-<%= user.role %> bg-role-<%= user.role %>-light rounded-lg shadow">
|
||||
<%= user.id %>
|
||||
</span>
|
||||
@@ -19,15 +19,15 @@
|
||||
<%= user.role %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-2 py-3 flex space-x-2 justify-center">
|
||||
<td class="flex justify-center p-2 py-3 space-x-2">
|
||||
<%= link_to do %>
|
||||
<span class="badge block w-28 bg-gray-300 hover:bg-role-user-light hover:texft-black">User</span>
|
||||
<span class="block bg-gray-300 badge w-28 hover:bg-role-user-light hover:texft-black">User</span>
|
||||
<% end unless user.user? %>
|
||||
<%= link_to do %>
|
||||
<span class="badge block w-28 bg-gray-300 hover:bg-role-operator-light hover:texft-black">Operator</span>
|
||||
<span class="block bg-gray-300 badge w-28 hover:bg-role-operator-light hover:texft-black">Operator</span>
|
||||
<% end unless user.operator? %>
|
||||
<%= link_to do %>
|
||||
<span class="badge block w-28 bg-gray-300 hover:bg-role-admin-light hover:texft-black">Admin</span>
|
||||
<span class="block bg-gray-300 badge w-28 hover:bg-role-admin-light hover:texft-black">Admin</span>
|
||||
<% end unless user.admin? %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
<div class="w-full">
|
||||
<% content_for :title, "Current Print Jobs" %>
|
||||
<div class="flex items-center justify-between py-4">
|
||||
<h1 class="text-4xl font-bold text-hsrm-gray">Benutzerliste</h1>
|
||||
<%= link_to "Filter", "#", class: "px-3 py-2 bg-hsrm-red drop-shadow-lg transition-colors hover:bg-hsrm-red-light text-white block font-medium" %>
|
||||
<%= turbo_frame_tag "admin_user" do %>
|
||||
<div class="w-full">
|
||||
<% content_for :title, "Current Print Jobs" %>
|
||||
<div class="flex items-center justify-between py-4">
|
||||
<h1 class="text-4xl font-bold text-hsrm-gray">Benutzerliste</h1>
|
||||
<%= link_to "Filter", "#", class: "px-3 py-2 bg-hsrm-red drop-shadow-lg transition-colors hover:bg-hsrm-red-light text-white block font-medium" %>
|
||||
</div>
|
||||
<div class="min-w-full overflow-auto shadow-lg">
|
||||
<table class="w-full py-8 table-auto">
|
||||
<thead class="font-semibold tracking-wide bg-gray-200 border-b-2 border-gray-300 text text-hsrm-gray">
|
||||
<tr>
|
||||
<th class="w-1 p-2 py-3 text-center">ID</th>
|
||||
<th class="w-1 p-2 py-3 text-left">Name</th>
|
||||
<th class="p-2 py-3 text-left">E-Mail-Adresse</th>
|
||||
<th class="w-1 p-2 py-3 text-center">Rolle</th>
|
||||
<th class="w-1 p-2 py-3 text-center">Rolle ändern zu</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='jobs' class="divide-y divivde-gray-300">
|
||||
<%= render partial: "user_tr", collection: @records, as: :user %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%== pagy_nav(@pagy) %>
|
||||
</div>
|
||||
<div class="min-w-full overflow-auto shadow-lg">
|
||||
<table class="w-full py-8 table-auto">
|
||||
<thead class="font-semibold tracking-wide bg-gray-200 border-b-2 border-gray-300 text text-hsrm-gray">
|
||||
<tr>
|
||||
<th class="w-1 p-2 py-3 text-center">ID</th>
|
||||
<th class="w-1 p-2 py-3 text-left">Name</th>
|
||||
<th class="p-2 py-3 text-left">E-Mail-Adresse</th>
|
||||
<th class="w-1 p-2 py-3 text-center">Rolle</th>
|
||||
<th class="w-1 p-2 py-3 text-center">Rolle ändern zu</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='jobs' class="divide-y divivde-gray-300">
|
||||
<%= render partial: "user_tr", collection: @users, as: :user %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user