fix autocomplete and fetch controller paths

This commit is contained in:
byte[] 2021-02-09 17:37:54 -05:00
parent f56ce27780
commit f6c8d57bdf
6 changed files with 10 additions and 8 deletions

View file

@ -44,7 +44,7 @@ function fetchAndPersistTags(tagIds) {
const ids = tagIds.slice(0, 40);
const remaining = tagIds.slice(41);
fetch(`/tags/fetch?ids[]=${ids.join('&ids[]=')}`)
fetch(`/fetch/tags?ids[]=${ids.join('&ids[]=')}`)
.then(response => response.json())
.then(data => data.tags.forEach(tag => persistTag(tag)))
.then(() => fetchAndPersistTags(remaining));

View file

@ -1,4 +1,4 @@
defmodule PhilomenaWeb.Tag.AutocompleteController do
defmodule PhilomenaWeb.Autocomplete.TagController do
use PhilomenaWeb, :controller
alias Philomena.Elasticsearch

View file

@ -1,4 +1,4 @@
defmodule PhilomenaWeb.Tag.FetchController do
defmodule PhilomenaWeb.Fetch.TagController do
use PhilomenaWeb, :controller
alias Philomena.Tags.Tag

View file

@ -446,9 +446,11 @@ defmodule PhilomenaWeb.Router do
resources "/favorites", Image.FavoriteController, only: [:index]
end
scope "/tags", Tag, as: :tag do
resources "/autocomplete", AutocompleteController, only: [:show], singleton: true
resources "/fetch", FetchController, only: [:index]
scope "/autocomplete", Autocomplete, as: :autocomplete do
resources "/tags", TagController, only: [:show], singleton: true
end
scope "/fetch", Fetch, as: :fetch do
resources "/tags", TagController, only: [:index]
end
resources "/tags", TagController, only: [:index, :show] do

View file

@ -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: [ac: "true", ac_min_length: "3", ac_source: "/tags/autocomplete?term="]
= text_input f, :tag_name, value: assigns[:tag_name], class: "input", autocomplete: "off", placeholder: "artist:your-name", data: [ac: "true", ac_min_length: "3", ac_source: "/autocomplete/tags?term="]
= error_tag f, :tag
.field

View file

@ -9,7 +9,7 @@ elixir:
.js-tag-block class="fancy-tag-#{@type}"
= textarea @f, @name, html_options
.js-taginput.input.input--wide.tagsinput.hidden class="js-taginput-fancy" data-click-focus=".js-taginput-input.js-taginput-#{@name}"
input.input class="js-taginput-input js-taginput-#{@name}" id="taginput-fancy-#{@name}" type="text" placeholder="add a tag" autocomplete="off" autocapitalize="none" data-ac="true" data-ac-min-length="3" data-ac-source="/tags/autocomplete?term="
input.input class="js-taginput-input js-taginput-#{@name}" id="taginput-fancy-#{@name}" type="text" placeholder="add a tag" autocomplete="off" autocapitalize="none" data-ac="true" data-ac-min-length="3" data-ac-source="/autocomplete/tags?term="
button.button.button--state-primary.button--bold class="js-taginput-show" data-click-show=".js-taginput-fancy,.js-taginput-hide" data-click-hide=".js-taginput-plain,.js-taginput-show" data-click-focus=".js-taginput-input.js-taginput-#{@name}"
= hidden_input :fuck_ie, :fuck_ie, value: "fuck_ie"
' Fancy Editor