1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
- display_mod_tools = can?(:manage, post)
.block
= form_with(model: post, url: post_source_path(post), method: :put, class: 'hidden', id: 'source-form', data: { 'remote': true }) do |f|
.flex
= f.url_field :source_url, id: 'source-field', class: 'input input--wide', autocomplete: 'off', placeholder: 'Source URL'
= f.submit 'Save source', class: 'button button--separate-left'
= button_tag type: :reset, class: 'button button--separate-left', data: { 'click-hide': '#source-form', 'click-show': '#image-source' } do
| Cancel
- if !current_user && Flipflop.enabled?(:captcha)
= captcha_tags
.flex.flex--wrap#image-source
- if can?(:update_metadata, post) && !@current_ban
a.button.button--separate-right#edit-source data-click-focus="#source-field" data-click-hide="#image-source" data-click-show="#source-form" title='Edit source' accessKey='s'
i.far.fa-edit>
| Source:
- else
' Source:
p
- if post.source_url.present?
- source_display = CGI.unescape(post.source_url) rescue post.source_url
a.js-source-link href=post.source_url
strong = source_display
- else
em> not provided yet
- if post.source_changes.count > 1 || display_mod_tools
a.button.button--link.button--separate-left href=post_source_changes_path(post) title='Source history'
i.fas.fa-history>
| History (
= post.source_changes.count
| )
- if can? :delete, SourceChange
= form_tag post_source_history_path(post), method: :delete do
= button_tag :submit, data: { confirm: t('are_you_sure') }, class: 'button button--state-danger button--separate-left', title: 'Wipe sources' do
i.fas.fa-eraser>
| Wipe
|