Class: Marksmith::Fields::MarkdownField

Inherits:
Avo::Fields::BaseField
  • Object
show all
Defined in:
lib/marksmith/fields/markdown_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, **args, &block) ⇒ MarkdownField

Returns a new instance of MarkdownField.



11
12
13
14
15
16
17
18
19
20
# File 'lib/marksmith/fields/markdown_field.rb', line 11

def initialize(id, **args, &block)
  @media_library = args[:media_library].nil? ? true : args[:media_library]
  @extra_preview_params = args[:extra_preview_params] || {}
  @file_uploads = args[:file_uploads]
  @always_show = args[:always_show] || false

  super(id, **args, &block)

  hide_on :index
end

Instance Attribute Details

#always_showObject (readonly)

Returns the value of attribute always_show.



7
8
9
# File 'lib/marksmith/fields/markdown_field.rb', line 7

def always_show
  @always_show
end

#extra_preview_paramsObject (readonly)

Returns the value of attribute extra_preview_params.



7
8
9
# File 'lib/marksmith/fields/markdown_field.rb', line 7

def extra_preview_params
  @extra_preview_params
end

#file_uploadsObject (readonly)

Returns the value of attribute file_uploads.



7
8
9
# File 'lib/marksmith/fields/markdown_field.rb', line 7

def file_uploads
  @file_uploads
end

Instance Method Details

Returns:

  • (Boolean)


26
27
28
# File 'lib/marksmith/fields/markdown_field.rb', line 26

def gallery_enabled?
  Avo::MediaLibrary.configuration.enabled && @media_library
end

#view_component_namespaceObject



22
23
24
# File 'lib/marksmith/fields/markdown_field.rb', line 22

def view_component_namespace
  "Marksmith::MarkdownField"
end