diff --git a/lib/philomena_web/controllers/image/file_controller.ex b/lib/philomena_web/controllers/image/file_controller.ex index f2f115d8..49e0e0f4 100644 --- a/lib/philomena_web/controllers/image/file_controller.ex +++ b/lib/philomena_web/controllers/image/file_controller.ex @@ -7,6 +7,7 @@ defmodule PhilomenaWeb.Image.FileController do plug PhilomenaWeb.CanaryMapPlug, update: :hide plug :load_and_authorize_resource, model: Image, id_name: "image_id", persisted: true plug :verify_not_deleted + plug PhilomenaWeb.ScraperPlug, params_name: "image", params_key: "image" def update(conn, %{"image" => image_params}) do case Images.update_file(conn.assigns.image, image_params) do diff --git a/lib/philomena_web/templates/image/_options.html.slime b/lib/philomena_web/templates/image/_options.html.slime index 90ab2546..727fbcf0 100644 --- a/lib/philomena_web/templates/image/_options.html.slime +++ b/lib/philomena_web/templates/image/_options.html.slime @@ -71,7 +71,16 @@ = form_for @changeset, Routes.image_file_path(@conn, :update, @image), [method: "put", multipart: true], fn f -> #js-image-upload-previews p Upload a file from your computer - .field = file_input f, :image, class: "input js-scraper" + .field + = file_input f, :image, class: "input js-scraper" + + .field.field--inline + = url_input f, :scraper_url, class: "input input--wide js-scraper", placeholder: "Link a deviantART page, a Tumblr post, or the image directly" + button.button.button--separate-left#js-scraper-preview(type="button" title="Fetch the image at the specified URL" data-disable-with="Fetch" disabled) + ' Fetch + + .field-error-js.hidden.js-scraper + = submit "Save changes", class: "button", data: [disable_with: raw("Replacing…")] .block__tab.hidden data-tab="administration"