Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: 1631 #1633

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions app/views/account/entries/_pagination.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<%# locals: (pagy:, current_path: nil) %>
<nav class="flex w-full items-center justify-between">
<div class="flex items-center gap-1">
<div>
<% if pagy.prev %>
<%= link_to account_entries_path(account_id: @account.id, page: pagy.prev, tab: params[:tab], per_page: params[:per_page]),
class: "inline-flex items-center p-2 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700" do %>
<%= lucide_icon("chevron-left", class: "w-5 h-5 text-gray-500") %>
<% end %>
<% else %>
<div class="inline-flex items-center p-2 text-sm font-medium hover:border-gray-300">
<%= lucide_icon("chevron-left", class: "w-5 h-5 text-gray-200") %>
</div>
<% end %>
</div>
<div class="rounded-xl p-1 bg-gray-25">
<% pagy.series.each do |series_item| %>
<% if series_item.is_a?(Integer) %>
<%= link_to account_entries_path(account_id: @account.id, page: series_item, tab: params[:tab], per_page: params[:per_page]),
class: "rounded-md px-2 py-1 inline-flex items-center text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700" do %>
<%= series_item %>
<% end %>
<% elsif series_item.is_a?(String) %>
<%= link_to account_entries_path(account_id: @account.id, page: series_item, tab: params[:tab], per_page: params[:per_page]),
class: "rounded-md px-2 py-1 bg-white border border-alpha-black-25 shadow-xs inline-flex items-center text-sm font-medium text-gray-900" do %>
<%= series_item %>
<% end %>
<% elsif series_item == :gap %>
<span class="inline-flex items-center px-2 py-1 text-sm font-medium text-gray-500">...</span>
<% end %>
<% end %>
</div>
<div>
<% if pagy.next %>
<%= link_to account_entries_path(account_id: @account.id, page: pagy.next, tab: params[:tab], per_page: params[:per_page]),
class: "inline-flex items-center p-2 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700" do %>
<%= lucide_icon("chevron-right", class: "w-5 h-5 text-gray-500") %>
<% end %>
<% else %>
<div class="inline-flex items-center p-2 text-sm font-medium hover:border-gray-300">
<%= lucide_icon("chevron-right", class: "w-5 h-5 text-gray-200") %>
</div>
<% end %>
</div>
</div>
<div class="flex items-center gap-4">
<%= form_with url: account_entries_path(account_id: @account.id),
method: :get,
class: "flex items-center gap-4",
data: {
controller: "auto-submit-form",
turbo_frame: dom_id(@account, "entries") } do |f| %>
<%= f.hidden_field :account_id, value: @account.id %>
<%= f.hidden_field :tab, value: params[:tab] if params[:tab].present? %>
<% if params.dig(:q, :search).present? %>
<%= f.hidden_field "q[search]", value: params.dig(:q, :search) %>
<% end %>
<%= f.label :per_page, t("application.pagination.rows_per_page"), class: "text-sm text-gray-500" %>
<%= f.select :per_page,
options_for_select(["10", "20", "30", "50"], pagy.limit),
{},
class: "py-1.5 pr-8 text-sm text-gray-900 font-medium border border-gray-200 rounded-lg focus:border-gray-900 focus:ring-gray-900 focus-visible:ring-gray-900",
data: { "auto-submit-form-target": "auto" } %>
<% end %>
</div>
</nav>
Loading