Module: Card::Set::Type::Image::HtmlViews::HtmlFormat
- Extended by:
- AbstractFormat
- Includes:
- File::HtmlFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb
Instance Method Summary
collapse
#cached_upload_card_name, #file_chooser_action_text, #humanized_attachment_name, #preview_editor_delete_text, #view: input, #view: preview_editor
Instance Method Details
#content_changes(action, diff_type, hide_diff = false) ⇒ Object
60
61
62
63
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 60
def content_changes action, diff_type, hide_diff=false
voo.size = diff_type == :summary ? :icon : :medium
[old_image(action, hide_diff), new_image(action)].compact.join
end
|
#goto_autocomplete_icon ⇒ Object
87
88
89
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 87
def goto_autocomplete_icon
render :core, size: :small
end
|
#invalid_image(source) ⇒ Object
38
39
40
41
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 38
def invalid_image source
"<!-- invalid image for #{safe_name}; source: #{source} -->"
end
|
#new_image(action) ⇒ Object
81
82
83
84
85
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 81
def new_image action
card.with_selected_action_id action.id do
Card::Content::Diff.render_added_chunk _render_core
end
end
|
#old_image(action, hide_diff) ⇒ Object
65
66
67
68
69
70
71
72
73
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 65
def old_image action, hide_diff
return if hide_diff || !action
old_image_change action do |old_action_id|
card.with_selected_action_id old_action_id do
Card::Content::Diff.render_deleted_chunk _render_core
end
end
end
|
#old_image_change(action) {|change.card_action_id| ... } ⇒ Object
75
76
77
78
79
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 75
def old_image_change action
return unless (change = card.last_change_on(:db_content, before: action))
yield change.card_action_id
end
|
43
44
45
46
47
48
49
50
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 43
def preview
return if card.new_card? && !card.preliminary_upload?
wrap_with :div, class: "attachment-preview",
id: "#{card.attachment.filename}-preview" do
_render_core size: :medium
end
end
|
#show_action_content_toggle?(_action, _view_type) ⇒ Boolean
52
53
54
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 52
def show_action_content_toggle? _action, _view_type
true
end
|
#view: content_changes ⇒ Object
56
57
58
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 56
view :content_changes do
content_changes card.last_action, :expanded
end
|
#view: core ⇒ Object
12
13
14
15
16
17
18
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 12
view :core do
return card.attachment.read.html_safe if svg?
with_valid_source do |source|
image_tag source, alt: card.name
end
end
|
#view: full_width ⇒ Object
32
33
34
35
36
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 32
view :full_width do
with_valid_source do |source|
image_tag source, alt: card.name, class: "w-100"
end
end
|
#with_valid_source ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image/html_views.rb', line 20
def with_valid_source
handle_source do |source|
if source.blank? || source == "missing"
invalid_image source
else
yield source
end
end
end
|