.form
  = form_for @filter, @route, fn f ->
    = if @filter.action do
      #error_explanation
        ' Oops, something went wrong! Please check the errors below.

    .field
      = text_input f, :name, class: "input input--wide", placeholder: "Name"
      = error_tag f, :name
    .fieldlabel
      ' This is a friendly name for this filter - it should be short and descriptive.
    .field
      = textarea f, :description, class: "input input--wide", placeholder: "Description"
      = error_tag f, :description
    .fieldlabel
      ' Here you can describe your filter in a bit more detail.


    .field
      = label f, :spoilered_tag_list, "Spoilered Tags"
      br
      = render PhilomenaWeb.TagView, "_tag_editor.html", f: f, name: :spoilered_tag_list, type: "edit"
      = error_tag f, :spoilered_tag_list
    .fieldlabel
      ' These tags will spoiler the images they're associated with.
    .field
      = label f, :spoilered_complex_str, "Complex Spoiler Filter"
      br
      = textarea f, :spoilered_complex_str, class: "input input--wide",  autocapitalize: "none"
      br
      = error_tag f, :spoilered_complex_str
    .fieldlabel
      p
        ' Use the search syntax here to specify an additional filter.
        ' For multiple filters, separate with a newline (or use the OR operator). Search fields excepting
        code<> faved_by
        ' are supported. See the search syntax guide
        ' for more information.
      p
        strong> WARNING:
        ' This filter is applied along with your tag filters. Tag filters may spoiler images that you mean to filter more precisely here. Double-check to make sure they don't interfere.


    .field
      = label f, :hidden_tag_list, "Hidden Tags"
      br
      = render PhilomenaWeb.TagView, "_tag_editor.html", f: f, name: :hidden_tag_list, type: "edit"
      = error_tag f, :hidden_tag_list
    .fieldlabel
      ' These tags will hide images entirely from the site; if you go directly to an image, it will spoiler it.
    .field
      = label f, :hidden_complex_str, "Complex Hide Filter"
      br
      = textarea f, :hidden_complex_str, class: "input input--wide",  autocapitalize: "none"
      br
      = error_tag f, :hidden_complex_str
    .fieldlabel
      p
        ' Use the search syntax here to specify an additional filter.
        ' For multiple filters, separate with a newline (or use the OR operator). Search fields excepting
        code<> faved_by
        ' are supported. See the search syntax guide
        ' for more information.
      p
        strong> WARNING:
        ' This filter is applied along with your tag filters. Tag filters may hide images that you mean to filter more precisely here. Double-check to make sure they don't interfere.

    = cond do
      - is_nil(input_value(f, :id)) ->
        .field
          = checkbox f, :public, class: "checkbox"
          = label f, :public

        .fieldlabel
          strong You probably do not want to check this unless you know what you are doing - it cannot be changed later
          | . Public filters can be shared with other users and used by them; if you make changes to a filter, it will update all users of that filter.

      - input_value(f, :public) == true ->
        .fieldlabel
          strong Changes made to this filter will affect anyone else using this filter! Check your changes, and make sure your changes don't change the filter's intent.

      - true ->

    = submit "Save Filter", class: "button"
