Class: EmbeddableContent::Images::NodeProcessor

Inherits:
VisualElementNodeProcessor show all
Defined in:
app/services/embeddable_content/images/node_processor.rb

Constant Summary collapse

TARGETS_THAT_DISPLAY_A_MODAL_DIALOG =
%i[web].freeze
TARGETS_THAT_USE_DIV_TAGS =
%i[editable].freeze
TARGETS_THAT_USE_FIGURE_TAGS =
%i[cms print web exported qti cc schoology]
.freeze

Constants inherited from VisualElementNodeProcessor

VisualElementNodeProcessor::MISSING_LABEL_TEXT

Constants inherited from NodeProcessor

NodeProcessor::ADDED_CLASSES_BLANK_BY_DEFAULT, NodeProcessor::ALL_TARGETS_PROCESSED_BY_DEFAULT, NodeProcessor::DEFAULT_TEMPLATE_MANAGER_CLASS, NodeProcessor::NODE_CAN_BE_REMOVED_BY_DEFAULT, NodeProcessor::RECORD_BLANK_BY_DEFAULT, NodeProcessor::SELECTOR_CLASS_BLANK_BY_DEFAULT

Instance Attribute Summary

Attributes inherited from NodeProcessor

#doc_processor, #error, #node, #node_index

Attributes inherited from EmbedderBase

#config, #options

Instance Method Summary collapse

Methods inherited from VisualElementNodeProcessor

#label_text

Methods included from TemplateBased

#node_type

Methods inherited from RecordNodeProcessor

#attached_file, #cms_url, #record, #record_css_id_for, #record_id, #record_model, #s3_ttl_service_url, #s3_url

Methods inherited from NodeProcessor

#initialize, #node_added_classes, #process!, #record

Methods inherited from EmbedderBase

default_s3_bucket, #ed_node, #initialize, #locale, #s3_bucket, #target, #to_s, #tree, #tree_node

Constructor Details

This class inherits a constructor from EmbeddableContent::NodeProcessor

Instance Method Details

#display_modal_dialog?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/services/embeddable_content/images/node_processor.rb', line 17

def display_modal_dialog?
  TARGETS_THAT_DISPLAY_A_MODAL_DIALOG.include? target.to_sym
end

#figure_tagObject



24
25
26
27
28
29
30
# File 'app/services/embeddable_content/images/node_processor.rb', line 24

def figure_tag
  case target
  when *TARGETS_THAT_USE_DIV_TAGS     then :div
  when *TARGETS_THAT_USE_FIGURE_TAGS  then :figure
  else raise "Undefined tag for target: #{target}"
  end
end

#img_tag_attrsObject



12
13
14
# File 'app/services/embeddable_content/images/node_processor.rb', line 12

def img_tag_attrs
  @img_tag_attrs ||= ImgTagAttributes.new(self).to_h
end


8
9
10
# File 'app/services/embeddable_content/images/node_processor.rb', line 8

def modal_dialog
  @modal_dialog = ModalDialog.new self
end

#node_can_be_removed?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/services/embeddable_content/images/node_processor.rb', line 32

def node_can_be_removed?
  false
end

#node_selector_classObject



36
37
38
# File 'app/services/embeddable_content/images/node_processor.rb', line 36

def node_selector_class
  [super, 'embedded-content-image'].join ' '
end