diff --git a/app/javascript/elements/search_input.js b/app/javascript/elements/search_input.js index a5b98d21..e07e6a5c 100644 --- a/app/javascript/elements/search_input.js +++ b/app/javascript/elements/search_input.js @@ -1,18 +1,5 @@ export default class extends HTMLElement { connectedCallback () { - this.input.addEventListener('focus', () => { - if (this.title) { - this.titleContainer.classList.add('max-md:hidden') - } - }) - - this.input.addEventListener('blur', (e) => { - if (this.title && !e.target.value) { - this.title.classList.remove('hidden') - this.titleContainer.classList.remove('max-md:hidden') - } - }) - this.button.addEventListener('click', (event) => { if (!this.input.value && document.activeElement !== this.input) { event.preventDefault() @@ -30,30 +17,12 @@ export default class extends HTMLElement { onBeforeCache = () => { this.input.value = this.input.getAttribute('value') || '' - - if (this.title) { - this.titleContainer.classList.remove('max-md:hidden') - } } get input () { return this.querySelector('input') } - get title () { - return document.querySelector(this.dataset.title) - } - - get titleContainer () { - const parent = this.title.parentElement - - if (parent && !parent.contains(this)) { - return parent - } - - return this.title - } - get button () { return this.querySelector('button') } diff --git a/app/views/shared/_search_input.html.erb b/app/views/shared/_search_input.html.erb index 47df5992..73f82406 100644 --- a/app/views/shared/_search_input.html.erb +++ b/app/views/shared/_search_input.html.erb @@ -14,7 +14,7 @@ <% end %> - + <% end %> -
+
<% unless show_dropzone %> <%= render 'templates/dashboard_dropzone', style: 'height: 114px' %> <% end %> <%= render 'templates/dashboard_folder_dropzone', style: 'height: 114px' %> -
+
<% if has_archived || @pagy.count.nil? || @pagy.count > 0 || @template_folders.present? %>
<%= render 'dashboard/toggle_view', selected: 'templates' %> @@ -22,7 +22,7 @@ <%= t('document_templates_html') %>
-
+
<% if params[:q].present? || @pagy.count.nil? || @pagy.count > 1 || @template_folders.present? %> <%= render 'shared/search_input' %> <% end %> diff --git a/app/views/templates_shared/index.html.erb b/app/views/templates_shared/index.html.erb index f3b80916..3148c22e 100644 --- a/app/views/templates_shared/index.html.erb +++ b/app/views/templates_shared/index.html.erb @@ -4,15 +4,15 @@ <%= @is_archived ? t('back_to_active') : t('home') %> <% end %>
-
-

+
+

<%= svg_icon('folder', class: 'w-9 h-9 flex-shrink-0') %> <%= t('shared') %> <% if @is_archived %> <%= t('archived') %> <% end %>

-
+
<% if params[:q].present? || @pagy.count.nil? || @pagy.count > 1 %> <%= render 'shared/search_input' %> <% end %>