From b8b3ed598275a1905a0579e3166b467a59145e68 Mon Sep 17 00:00:00 2001 From: MareStare Date: Tue, 4 Mar 2025 04:58:35 +0000 Subject: [PATCH] Update the slime HTML templates with new `data` attributes --- .../templates/filter/_form.html.slime | 4 ++-- .../templates/layout/_header.html.slime | 8 +++++--- .../templates/profile/artist_link/_form.html.slime | 2 +- .../templates/search/_form.html.slime | 13 ++++++++++++- .../templates/tag/_tag_editor.html.slime | 5 ++--- lib/philomena_web/templates/tag/index.html.slime | 14 ++++++++++++-- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/lib/philomena_web/templates/filter/_form.html.slime b/lib/philomena_web/templates/filter/_form.html.slime index 95eca5dd..54b913ba 100644 --- a/lib/philomena_web/templates/filter/_form.html.slime +++ b/lib/philomena_web/templates/filter/_form.html.slime @@ -26,7 +26,7 @@ .field = label f, :spoilered_complex_str, "Complex Spoiler Filter" br - = textarea f, :spoilered_complex_str, class: "input input--wide", autocapitalize: "none", data: [autocomplete: "true", autocomplete_min_length: 3, autocomplete_mode: "search"] + = textarea f, :spoilered_complex_str, class: "input input--wide", autocapitalize: "none", autocomplete: "off", data: [autocomplete: "multi-tags"] br = error_tag f, :spoilered_complex_str .fieldlabel @@ -51,7 +51,7 @@ .field = label f, :hidden_complex_str, "Complex Hide Filter" br - = textarea f, :hidden_complex_str, class: "input input--wide", autocapitalize: "none", data: [autocomplete: "true", autocomplete_min_length: 3, autocomplete_mode: "search"] + = textarea f, :hidden_complex_str, class: "input input--wide", autocapitalize: "none", autocomplete: "off", data: [autocomplete: "multi-tags"] br = error_tag f, :hidden_complex_str .fieldlabel diff --git a/lib/philomena_web/templates/layout/_header.html.slime b/lib/philomena_web/templates/layout/_header.html.slime index b839e6b8..80a84975 100644 --- a/lib/philomena_web/templates/layout/_header.html.slime +++ b/lib/philomena_web/templates/layout/_header.html.slime @@ -23,9 +23,11 @@ header.header value=@conn.params["q"] placeholder="Search" autocapitalize="none" - data-autocomplete="true" - data-autocomplete-min-length="3" - data-autocomplete-mode="search" + autocomplete=if(@conn.cookies["enable_search_ac"], do: "on", else: "off") + inputmode="search" + data-autocomplete="multi-tags" + data-autocomplete-condition="enable_search_ac" + data-autocomplete-history-id="search-history" ] = if present?(@conn.params["sf"]) do diff --git a/lib/philomena_web/templates/profile/artist_link/_form.html.slime b/lib/philomena_web/templates/profile/artist_link/_form.html.slime index 00ea7cd7..e999f2ed 100644 --- a/lib/philomena_web/templates/profile/artist_link/_form.html.slime +++ b/lib/philomena_web/templates/profile/artist_link/_form.html.slime @@ -10,7 +10,7 @@ ' Artist Link validation is intended for artists. Validating your link will give you control over your content on the site, allowing you to create a a> href="/commissions" commissions ' listing and request takedowns or DNPs. Do not request a link if the source contains no artwork which you have created. - = text_input f, :tag_name, value: assigns[:tag_name], class: "input", autocomplete: "off", placeholder: "artist:your-name", data: [autocomplete: "true", autocomplete_min_length: "3", autocomplete_source: "/autocomplete/tags?term="] + = text_input f, :tag_name, value: assigns[:tag_name], class: "input", autocomplete: "off", placeholder: "artist:your-name", data: [autocomplete: "single-tag"] = error_tag f, :tag .field diff --git a/lib/philomena_web/templates/search/_form.html.slime b/lib/philomena_web/templates/search/_form.html.slime index adb789bf..0eafd0d8 100644 --- a/lib/philomena_web/templates/search/_form.html.slime +++ b/lib/philomena_web/templates/search/_form.html.slime @@ -1,7 +1,18 @@ h1 Search = form_for :search, ~p"/search", [id: "searchform", method: "get", class: "js-search-form", enforce_utf8: false], fn f -> - = text_input f, :q, class: "input input--wide js-search-field", placeholder: "Search terms are chained with commas", autocapitalize: "none", name: "q", value: @conn.params["q"], data: [autocomplete: "true", autocomplete_min_length: 3, autocomplete_mode: "search"] + = text_input f, :q, class: "input input--wide js-search-field", + placeholder: "Search terms are chained with commas", + autocapitalize: "none", + name: "q", + value: @conn.params["q"], + autocomplete: if(@conn.cookies["enable_search_ac"], do: "on", else: "off"), + inputmode: "search", + data: [ \ + autocomplete: "multi-tags", + autocomplete_condition: "enable_search_ac", + autocomplete_history_id: "search-history", + ] .block .block__header.flex diff --git a/lib/philomena_web/templates/tag/_tag_editor.html.slime b/lib/philomena_web/templates/tag/_tag_editor.html.slime index 821ff12d..3cb3e078 100644 --- a/lib/philomena_web/templates/tag/_tag_editor.html.slime +++ b/lib/philomena_web/templates/tag/_tag_editor.html.slime @@ -16,9 +16,8 @@ elixir: placeholder="add a tag" autocomplete="off" autocapitalize="none" - data-autocomplete="true" - data-autocomplete-min-length="3" - data-autocomplete-source="/autocomplete/tags?term=" + data-autocomplete="single-tag" + data-autocomplete-max-suggestions=5 ] button.button.button--state-primary.button--bold[ class="js-taginput-show" diff --git a/lib/philomena_web/templates/tag/index.html.slime b/lib/philomena_web/templates/tag/index.html.slime index 89931cea..e4584234 100644 --- a/lib/philomena_web/templates/tag/index.html.slime +++ b/lib/philomena_web/templates/tag/index.html.slime @@ -2,7 +2,17 @@ h1 Tags = form_for :tags, ~p"/tags", [method: "get", class: "hform", enforce_utf8: false], fn f -> .field - = text_input f, :tq, name: :tq, value: @conn.params["tq"] || "*", class: "input hform__text", placeholder: "Search tags", autocapitalize: "none" + = text_input f, :tq, name: :tq, value: @conn.params["tq"] || "*", + class: "input hform__text", + placeholder: "Search tags", + autocapitalize: "none", + autocomplete: if(@conn.cookies["enable_search_ac"], do: "on", else: "off"), + inputmode: "search", + data: [ \ + autocomplete: "multi-tags", + autocomplete_condition: "enable_search_ac", + ] + = submit "Search", class: "hform__button button" .fieldlabel @@ -31,7 +41,7 @@ h2 Search Results .block.block--fixed.block--danger ' Oops, there was an error parsing your query! Check for mistakes like mismatched parentheses. The error was: pre = assigns[:error] - + - true -> p ' No tags found!