Module: Card::Set::Type::File::HtmlFormat

Extended by:
AbstractFormat
Included in:
Image::HtmlViews::HtmlFormat
Defined in:
card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb,
card/tmpsets/set/mod013-card-mod-carrierwave/type/file.rb

Instance Method Summary collapse

Instance Method Details

#cached_upload_card_nameObject



116
117
118
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 116

def cached_upload_card_name
  Card::Env.params[:attachment_upload].gsub(/\[\w+\]$/, "[action_id_of_cached_upload]")
end

#file_chooser_action_textObject



103
104
105
106
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 103

def file_chooser_action_text
  action = card.new_card? ? "Add" : "Replace"
  "#{action} #{humanized_attachment_name}..."
end

#humanized_attachment_nameObject



108
109
110
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 108

def humanized_attachment_name
  card.attachment_name.to_s.humanize
end

#previewObject



112
113
114
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 112

def preview
  ""
end

#preview_editor_delete_textObject



120
121
122
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 120

def preview_editor_delete_text
  tr :delete
end

#view: coreObject



85
86
87
88
89
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 85

view :core do
  handle_source do |source|
    "<a href=\"#{source}\">#{tr :download, title: title_in_context(voo.title)}</a>"
  end
end

#view: inputObject



91
92
93
94
95
96
97
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 91

view :input do
  if card.no_upload?
    text_field :content, class: "d0-card-content"
  else
    haml :file_chooser, action_text: file_chooser_action_text
  end
end

#view: preview_editorObject



99
100
101
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb', line 99

view :preview_editor, unknown: true, cache: :never do
  haml :preview_editor
end