<% has_sources = Enum.any?(@image.sources) %> <%= form_for @changeset, ~p"/images/#{@image}/sources", [method: "put", class: "hidden", id: "source-form", data: [remote: "true"]], fn f -> %> <%= if can?(@conn, :edit_metadata, @image) and !@conn.assigns.current_ban do %> <%= if @changeset.action do %>

Oops, something went wrong! Please check the errors below.

<% end %>

The page(s) you found this image on. Images may have a maximum of 10 source URLs. Leave any sources you don't want to use blank.

<%= inputs_for f, :sources, [as: "image[old_sources]", skip_hidden: true], fn fs -> %> <%= hidden_input(fs, :source) %> <% end %> <%= inputs_for f, :sources, [skip_hidden: true], fn fs -> %>
<%= text_input(fs, :source, class: "input flex__grow js-source-url", placeholder: "Source URL") %> <%= error_tag(fs, :source) %>
<% end %>
<%= submit("Save sources", class: "button button--separate-left") %>
<%= render(PhilomenaWeb.CaptchaView, "_captcha.html", name: "source", conn: @conn) %> <% else %>

You can't edit the source on this image.

<% end %> <% end %>
<%= if !has_sources || length(@image.sources) == 1 do %> Source <% else %> Sources <% end %>
<%= if has_sources do %> Add/Edit <% else %> Add <% end %> <%= if @source_change_count > 0 do %> History ( <%= @source_change_count %> ) <% end %> <%= if can?(@conn, :hide, @image) and not hide_staff_tools?(@conn) do %> <%= form_for @changeset, ~p"/images/#{@image}/source_history", [method: "delete"], fn _f -> %> Wipe <% end %> <% end %>
<%= if has_sources do %> <% [first_source | sources] = @image.sources %>
<%= for source <- sources do %>
<% end %> <% else %>
<% end %>