Class: Alchemy::Ingredients::FileEditor

Inherits:
BaseEditor
  • Object
show all
Defined in:
app/components/alchemy/ingredients/file_editor.rb

Direct Known Subclasses

AudioEditor, VideoEditor

Instance Attribute Summary

Attributes inherited from BaseEditor

#html_options, #ingredient

Instance Method Summary collapse

Methods inherited from BaseEditor

#call, #form_field_id, #form_field_name, #initialize

Constructor Details

This class inherits a constructor from Alchemy::Ingredients::BaseEditor

Instance Method Details

#input_fieldObject



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
36
37
38
39
40
41
42
43
44
45
46
# File 'app/components/alchemy/ingredients/file_editor.rb', line 9

def input_field
  ("alchemy-file-editor", class: "file") do
    concat tag.div(
      render_icon(attachment&.icon_css_class),
      class: "file_icon"
    )
    concat tag.div(attachment&.name, class: "file_name")
    if editable?
      concat link_to(
        render_icon(:times), "#",
        class: [
          "remove_file_link",
          attachment ? nil : "hidden"
        ],
        data: {
          form_field_id: form_field_id(:attachment_id)
        }
      )
    end
    concat(
      tag.div(class: "file_tools") do
        concat dialog_link
        concat link_to_dialog(
          render_icon(:edit),
          editable? ? alchemy.edit_admin_ingredient_path(ingredient) : nil,
          {
            title: Alchemy.t(:edit_file_properties),
            size: "400x215"
          },
          title: editable? ? Alchemy.t(:edit_file_properties) : nil
        )
      end
    )
    concat hidden_field_tag(form_field_name(:attachment_id),
      attachment&.id,
      id: form_field_id(:attachment_id))
  end
end