2019-11-25 03:16:22 +01:00
|
|
|
.block
|
2021-10-10 00:50:57 +02:00
|
|
|
- has_sources = Enum.any?(@image.sources)
|
2023-02-20 17:26:00 +01:00
|
|
|
= form_for @changeset, Routes.image_source_path(@conn, :update, @image), [method: "put", class: "hidden", id: "source-form", data: [remote: "true"]], fn f ->
|
2019-11-25 03:27:25 +01:00
|
|
|
= if can?(@conn, :edit_metadata, @image) and !@conn.assigns.current_ban do
|
2019-11-25 03:16:22 +01:00
|
|
|
|
|
|
|
= if @changeset.action do
|
|
|
|
.alert.alert-danger
|
|
|
|
p Oops, something went wrong! Please check the errors below.
|
2021-10-10 00:50:57 +02:00
|
|
|
|
|
|
|
p
|
|
|
|
'The page(s) you found this image on. Images may have a maximum of
|
|
|
|
span.js-max-source-count> 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
|
|
|
|
= inputs_for f, :sources, [skip_hidden: true], fn fs ->
|
|
|
|
.field.js-image-source.field--inline.flex--no-wrap.flex--centered
|
|
|
|
= text_input fs, :source, class: "input flex__grow js-source-url", placeholder: "Source URL"
|
|
|
|
= error_tag fs, :source
|
|
|
|
|
|
|
|
label.input--separate-left.flex__fixed.flex--centered
|
|
|
|
a.js-source-remove href="#"
|
|
|
|
i.fa.fa-trash>
|
|
|
|
' Delete
|
|
|
|
|
|
|
|
.field
|
|
|
|
button.button.js-image-add-source type="button"
|
|
|
|
i.fa.fa-plus>
|
|
|
|
' Add source
|
|
|
|
= submit "Save sources", class: "button button--separate-left"
|
2019-11-25 03:16:22 +01:00
|
|
|
button.button.button--separate-left type="reset" data-click-hide="#source-form" data-click-show="#image-source"
|
|
|
|
' Cancel
|
|
|
|
|
2020-09-12 19:43:16 +02:00
|
|
|
= render PhilomenaWeb.CaptchaView, "_captcha.html", name: "source", conn: @conn
|
2019-11-25 03:16:22 +01:00
|
|
|
|
|
|
|
- else
|
|
|
|
p
|
|
|
|
' You can't edit the source on this image.
|
|
|
|
|
2023-05-28 18:12:53 +02:00
|
|
|
.flex.flex--wrap.flex--column#image-source
|
|
|
|
.flex
|
2021-10-10 00:50:57 +02:00
|
|
|
a.button.button--separate-right#edit-source data-click-focus=".js-image-source" data-click-hide="#image-source" data-click-show="#source-form" title="Edit source" accessKey="s"
|
2019-12-06 22:38:36 +01:00
|
|
|
i.fas.fa-edit>
|
2021-10-10 00:50:57 +02:00
|
|
|
= if !has_sources || length(@image.sources) == 1 do
|
|
|
|
' Source:
|
|
|
|
- else
|
|
|
|
' Sources:
|
2021-10-09 03:33:16 +02:00
|
|
|
= if @source_change_count > 0 do
|
2019-12-08 00:41:31 +01:00
|
|
|
a.button.button--link.button--separate-left href=Routes.image_source_change_path(@conn, :index, @image) title="Source history"
|
|
|
|
i.fa.fa-history>
|
|
|
|
| History (
|
|
|
|
= @source_change_count
|
|
|
|
| )
|
2019-12-16 06:25:06 +01:00
|
|
|
|
2019-12-20 23:35:46 +01:00
|
|
|
= if can?(@conn, :hide, @image) and not hide_staff_tools?(@conn) do
|
2019-12-16 06:25:06 +01:00
|
|
|
= form_for @changeset, Routes.image_source_history_path(@conn, :delete, @image), [method: "delete"], fn _f ->
|
|
|
|
button.button.button--state-danger.button--separate-left type="submit" data-confirm="Are you really, really sure?" title="Wipe sources"
|
|
|
|
i.fas.fa-eraser>
|
|
|
|
' Wipe
|
2023-05-28 18:12:53 +02:00
|
|
|
.image_sources
|
|
|
|
= if has_sources do
|
|
|
|
- [first_source | sources] = @image.sources
|
2021-11-13 18:53:35 +01:00
|
|
|
.image_source__icon
|
2023-05-28 18:12:53 +02:00
|
|
|
i class=image_source_icon(first_source.source)
|
2021-11-13 18:53:35 +01:00
|
|
|
.image_source__link
|
2023-05-28 18:12:53 +02:00
|
|
|
a.js-source-link href=first_source.source
|
|
|
|
strong = first_source.source
|
|
|
|
= for source <- sources do
|
|
|
|
.image_source__icon
|
|
|
|
i class=image_source_icon(source.source)
|
|
|
|
.image_source__link
|
|
|
|
a href=source.source
|
|
|
|
strong = source.source
|
|
|
|
- else
|
|
|
|
.image_source__icon
|
|
|
|
i.fa.fa-unlink
|
|
|
|
.image_source__link
|
|
|
|
em> not provided yet
|