diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-05 23:56:56 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-05 23:56:56 +0200 |
| commit | af2c6fd85e13139be3e3b2329a51c3a35acb3c40 (patch) | |
| tree | 02114279d6517ffc12b9920cc1d843937bff5a10 /app/views | |
| parent | a0a495d804319c3f7ad179baba7b87b41f1dc1f3 (diff) | |
Search assets and events, and order events by when they happen
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/assets/index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/events/index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/nodes/_node_list.html.erb | 17 | ||||
| -rw-r--r-- | app/views/shared/_search_form.html.erb | 15 |
4 files changed, 23 insertions, 13 deletions
diff --git a/app/views/assets/index.html.erb b/app/views/assets/index.html.erb index af11f54f..d2c5d6cc 100644 --- a/app/views/assets/index.html.erb +++ b/app/views/assets/index.html.erb | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | :label => t(".create_asset"), | 4 | :label => t(".create_asset"), |
| 5 | :options => [[t(".create_asset"), new_asset_path]] %> | 5 | :options => [[t(".create_asset"), new_asset_path]] %> |
| 6 | 6 | ||
| 7 | <%= render "shared/search_form", :placeholder => t(".search_placeholder") %> | ||
| 8 | |||
| 7 | <%= will_paginate @assets %> | 9 | <%= will_paginate @assets %> |
| 8 | 10 | ||
| 9 | <table class="assets_table"> | 11 | <table class="assets_table"> |
diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index c4f0a7f9..14790526 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | :label => t(".create_event"), | 4 | :label => t(".create_event"), |
| 5 | :options => [[t(".create_event"), new_event_path]] %> | 5 | :options => [[t(".create_event"), new_event_path]] %> |
| 6 | 6 | ||
| 7 | <%= render "shared/search_form", :placeholder => t(".search_placeholder") %> | ||
| 8 | |||
| 7 | <%= will_paginate @events %> | 9 | <%= will_paginate @events %> |
| 8 | 10 | ||
| 9 | <table class="events_table"> | 11 | <table class="events_table"> |
diff --git a/app/views/nodes/_node_list.html.erb b/app/views/nodes/_node_list.html.erb index f3101058..55f396b7 100644 --- a/app/views/nodes/_node_list.html.erb +++ b/app/views/nodes/_node_list.html.erb | |||
| @@ -1,16 +1,7 @@ | |||
| 1 | <%= form_tag url_for(controller: params[:controller], action: params[:action]), method: :get, class: "node_search_form" do %> | 1 | <%= render "shared/search_form", |
| 2 | <% Array(params[:kinds]).each do |kind| %> | 2 | :placeholder => t(".search_placeholder"), |
| 3 | <%= hidden_field_tag "kinds[]", kind %> | 3 | :hidden => Array(params[:kinds]).map { |k| ["kinds[]", k] } + |
| 4 | <% end %> | 4 | (params[:tags].present? ? [["tags", params[:tags]]] : []) %> |
| 5 | <%= hidden_field_tag :tags, params[:tags] if params[:tags].present? %> | ||
| 6 | <%= text_field_tag :q, params[:q], placeholder: t(".search_placeholder") %> | ||
| 7 | <%= button_tag type: "submit", class: "action_button" do %> | ||
| 8 | <%= icon("search", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.search") %> | ||
| 9 | <% end %> | ||
| 10 | <% if params[:q].present? || params[:kinds].present? || params[:tags].present? %> | ||
| 11 | <%= link_to t("admin.common.reset"), url_for(controller: params[:controller], action: params[:action]) %> | ||
| 12 | <% end %> | ||
| 13 | <% end %> | ||
| 14 | 5 | ||
| 15 | <%= will_paginate @nodes %> | 6 | <%= will_paginate @nodes %> |
| 16 | <table class="node_table"> | 7 | <table class="node_table"> |
diff --git a/app/views/shared/_search_form.html.erb b/app/views/shared/_search_form.html.erb new file mode 100644 index 00000000..bff6dfaa --- /dev/null +++ b/app/views/shared/_search_form.html.erb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | <%= form_tag url_for(:controller => params[:controller], :action => params[:action]), | ||
| 2 | :method => :get, :class => "search_form" do %> | ||
| 3 | <% Array(local_assigns[:hidden]).each do |field_name, value| %> | ||
| 4 | <%= hidden_field_tag field_name, value %> | ||
| 5 | <% end %> | ||
| 6 | <%= text_field_tag :q, params[:q], :placeholder => placeholder %> | ||
| 7 | <%= button_tag :type => "submit", :class => "action_button" do %> | ||
| 8 | <%= icon("search", library: "tabler", "aria-hidden": true) %> | ||
| 9 | <%= t("admin.common.search") %> | ||
| 10 | <% end %> | ||
| 11 | <% if params[:q].present? || Array(local_assigns[:hidden]).any? %> | ||
| 12 | <%= link_to t("admin.common.reset"), | ||
| 13 | url_for(:controller => params[:controller], :action => params[:action]) %> | ||
| 14 | <% end %> | ||
| 15 | <% end %> | ||
