<div id="c-uploads">
  <div id="a-new">
    <h1>Batch Upload</h1>

    <section>
      <% @urls.each.with_index do |url, i| %>
        <div class="upload-preview">
          <p class="caption-top">
            <%= link_to "Image ##{i}", new_upload_path(url: url, ref: params[:url]), target: "_blank" %>
          </p>

          <%= link_to new_upload_path(url: url, ref: params[:url]), target: "_blank" do %>
            <% if ImageProxy.needs_proxy?(url) %>
              <%= image_tag(image_proxy_uploads_path(url: url)) %>
            <% else %>
              <%= image_tag url %>
            <% end %>
          <% end %>
        </div>
      <% end %>
    </section>

    <p><%= link_to "Open all links in new windows", "#", :id => "link" %></p>
  </div>
</div>

<% content_for(:page_title) do %>
  Batch Upload - <%= Danbooru.config.app_name %>
<% end %>

<% content_for(:html_header) do %>
  <script type="text/javascript">
    $(function() {
      $("#link").click(function() {
        $(".upload-preview > a").each(function(i, v) {
          window.open(v.href);
        });
      });
    })
  </script>
<% end %>

<%= render "posts/partials/common/secondary_links" %>
