Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Show search bar even when no results in entries

Zach Gollwitzer3ef67faf7e83
diff --git a/app/views/account/entries/index.html.erb b/app/views/account/entries/index.html.erb
index 30e02686..19df9200 100644
--- a/app/views/account/entries/index.html.erb
+++ b/app/views/account/entries/index.html.erb
@@ -21,31 +21,30 @@
</div>
</div>
- <% if @entries.empty? %>
- <p class="text-gray-500 text-sm p-4"><%= t(".no_entries") %></p>
- <% else %>
-
- <div>
- <%= form_with url: account_entries_path(@account),
+ <div>
+ <%= form_with url: account_entries_path(@account),
id: "entries-search",
scope: :q,
method: :get,
data: { controller: "auto-submit-form" } do |form| %>
- <div class="flex gap-2 mb-4">
- <div class="grow">
- <div class="flex items-center px-3 py-2 gap-2 border border-gray-200 rounded-lg focus-within:ring-gray-100 focus-within:border-gray-900">
- <%= lucide_icon("search", class: "w-5 h-5 text-gray-500") %>
- <%= form.search_field :search,
+ <div class="flex gap-2 mb-4">
+ <div class="grow">
+ <div class="flex items-center px-3 py-2 gap-2 border border-gray-200 rounded-lg focus-within:ring-gray-100 focus-within:border-gray-900">
+ <%= lucide_icon("search", class: "w-5 h-5 text-gray-500") %>
+ <%= form.search_field :search,
placeholder: "Search entries by name",
value: @q[:search],
class: "form-field__input placeholder:text-sm placeholder:text-gray-500",
"data-auto-submit-form-target": "auto" %>
- </div>
</div>
</div>
- <% end %>
- </div>
+ </div>
+ <% end %>
+ </div>
+ <% if @entries.empty? %>
+ <p class="text-gray-500 text-sm p-4"><%= t(".no_entries") %></p>
+ <% else %>
<%= tag.div id: dom_id(@account, "entries_bulk_select"),
data: {
controller: "bulk-select",
diff --git a/config/locales/views/account/entries/en.yml b/config/locales/views/account/entries/en.yml
index b4b4cb93..e117e90d 100644
--- a/config/locales/views/account/entries/en.yml
+++ b/config/locales/views/account/entries/en.yml
@@ -16,7 +16,7 @@ en:
new: New
new_balance: New balance
new_transaction: New transaction
- no_entries: No entries yet
+ no_entries: No entries found
title: Activity
loading:
loading: Loading entries...