h1 Editing Tag

p = link "Edit image", to: ~p"/tags/#{@tag}/image/edit"
= if can?(@conn, :alias, @tag) do
  p = link "Edit aliases", to: ~p"/tags/#{@tag}/alias/edit"

= form_for @changeset, ~p"/tags/#{@tag}", [class: "form"], fn f ->
  = if @changeset.action do
    .alert.alert-danger
      p Oops, something went wrong! Please check the errors below.

  h2
    = @tag.name

  .field
    ' Category:
    = select f, :category, tag_categories(), class: "input"

  h4 Description
  .field
    => label f, :short_description, "Short description:"
    = text_input f, :short_description, class: "input input--wide"

  .field
    => label f, :description, "Long description:"
    = textarea f, :description, class: "input input--wide"

  .field
    => label f, :mod_notes, "Mod notes:"
    = textarea f, :mod_notes, class: "input input--wide"

  h4 Implied Tags
  .fieldlabel Tags in this list will be added when this tag is added to an image.
  .field
    = render PhilomenaWeb.TagView, "_tag_editor.html", f: f, name: :implied_tag_list, type: :edit, conn: @conn

  br
  = submit "Save Tag", class: "button button--state-primary"

br
br
= if can?(@conn, :alias, @tag) do
  input.toggle-box#tag-management checked="false" type="checkbox"
  label for="tag-management" Tag Processing
  .toggle-box-container
    .toggle-box-container__content
      = button_to "Rebuild index", ~p"/tags/#{@tag}/reindex", method: "post", class: "button", data: [confirm: "Are you really, really sure?", disable_with: raw("Reindexing&hellip;")]
      p Use this if the tag displays the wrong number of images or returns the wrong search results.

      = button_to "Destroy tag", ~p"/tags/#{@tag}", method: "delete", class: "button button--state-danger", data: [confirm: "Are you really, really sure?", disable_with: raw("Deleting&hellip;")]
      p
        strong Irreversible. Use with extreme caution!
      ul
        li Intended use is removing garbage tags.
        li Will remove tag changes on the tag, but not on images or profiles.
        li Will unset the alias if this tag is an alias target, and will automatically remove any implications that exist to it.
