Class: EmbeddableContent::VideoLinks::NodeProcessor

Inherits:
EmbeddableContent::VisualElementNodeProcessor show all
Includes:
VimeoPlayerSettings
Defined in:
app/services/embeddable_content/video_links/node_processor.rb

Constant Summary collapse

PLAYER_PRESENTATION_TARGETS =

TODO: make this a field on the embed

%i[cc kiddom schoology cms exported qti web].freeze
DESCRIPTION_PRESENTATION_TARGETS =
%i[editable print].freeze
CAPTIONED_TARGETS =

TODO: make this a field on the embed

%i[cc kiddom schoology cms qti web].freeze
UNCAPTIONED_TARGETS =
%i[editable exported print].freeze

Constants included from VimeoPlayerSettings

VimeoPlayerSettings::DEFAULT_VIMEO_ATTRIBUTES, VimeoPlayerSettings::VIMEO_URL_REGEX

Constants inherited from EmbeddableContent::VisualElementNodeProcessor

EmbeddableContent::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 included from VimeoPlayerSettings

#vimeo_attributes

Methods inherited from EmbeddableContent::VisualElementNodeProcessor

#label_text

Methods included from TemplateBased

#node_type

Methods inherited from RecordNodeProcessor

#attached_file, #cms_url, #node_selector_class, #record, #record_css_id_for, #record_id, #record_model, #s3_ttl_url, #s3_url

Methods inherited from NodeProcessor

#initialize, #node_added_classes, #node_selector_class, #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_caption?Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
# File 'app/services/embeddable_content/video_links/node_processor.rb', line 33

def display_caption?
  case target
  when *CAPTIONED_TARGETS   then true
  when *UNCAPTIONED_TARGETS then false
  else raise "Undefined caption status for target: #{target}"
  end
end

#presentationObject



20
21
22
23
24
25
26
# File 'app/services/embeddable_content/video_links/node_processor.rb', line 20

def presentation
  case target
  when *PLAYER_PRESENTATION_TARGETS      then :video_player
  when *DESCRIPTION_PRESENTATION_TARGETS then :description
  else raise "Undefined video presentation for target: #{target}"
  end
end

#video_availability_textObject



41
42
43
# File 'app/services/embeddable_content/video_links/node_processor.rb', line 41

def video_availability_text
  "Video '#{title}' available here: #{url}."
end

#video_playerObject



8
9
10
11
12
13
# File 'app/services/embeddable_content/video_links/node_processor.rb', line 8

def video_player
  case url
  when VIMEO_URL_REGEX then :vimeo_player
  else raise "Unrecognized video player for URL: #{url}"
  end
end