Class: EmbeddableContent::Images::ModalDialog
- Inherits:
-
Object
- Object
- EmbeddableContent::Images::ModalDialog
- Includes:
- Shared
- Defined in:
- app/services/embeddable_content/images/modal_dialog.rb
Instance Attribute Summary collapse
-
#node_processor ⇒ Object
readonly
Returns the value of attribute node_processor.
Instance Method Summary collapse
- #attribution_display_text ⇒ Object
- #attribution_id ⇒ Object
- #caption_id ⇒ Object
- #close_button_attrs ⇒ Object
- #container_attrs ⇒ Object
- #described_by_id ⇒ Object
- #description ⇒ Object
- #img_tag_attrs ⇒ Object
-
#initialize(node_processor) ⇒ ModalDialog
constructor
A new instance of ModalDialog.
- #labelled_by_id ⇒ Object
- #target_attrs ⇒ Object
- #target_div_id ⇒ Object
Constructor Details
#initialize(node_processor) ⇒ ModalDialog
Returns a new instance of ModalDialog.
11 12 13 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 11 def initialize(node_processor) @node_processor = node_processor end |
Instance Attribute Details
#node_processor ⇒ Object (readonly)
Returns the value of attribute node_processor.
6 7 8 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 6 def node_processor @node_processor end |
Instance Method Details
#attribution_display_text ⇒ Object
22 23 24 25 26 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 22 def attribution_display_text [attribution.owner_and_title_info, attribution.license.name, attribution.via_reference].join('. ').strip + '.' end |
#attribution_id ⇒ Object
69 70 71 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 69 def attribution_id record_css_id_for 'dialog-attribution' end |
#caption_id ⇒ Object
65 66 67 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 65 def record_css_id_for 'dialog-caption' end |
#close_button_attrs ⇒ Object
42 43 44 45 46 47 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 42 def { 'aria-hidden': 'true', height: '18', width: '18', viewBox: '0 0 1200 1200' } end |
#container_attrs ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 28 def container_attrs { tabindex: '-1', role: 'dialog', 'aria-labelledby': labelled_by_id, 'aria-describedby': described_by_id, 'aria-label': 'Image information' } end |
#described_by_id ⇒ Object
57 58 59 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 57 def described_by_id record_css_id_for 'dialog-long-description' end |
#description ⇒ Object
49 50 51 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 49 def description node_processor.long_description end |
#img_tag_attrs ⇒ Object
15 16 17 18 19 20 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 15 def img_tag_attrs { src: s3_ttl_url, width: '80%', alt: (alt_text), role: :image } end |
#labelled_by_id ⇒ Object
53 54 55 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 53 def labelled_by_id record_css_id_for 'dialog-alt-text' end |
#target_attrs ⇒ Object
36 37 38 39 40 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 36 def target_attrs { 'id': target_div_id, 'hidden': 'true', 'aria-hidden': 'true' } end |
#target_div_id ⇒ Object
61 62 63 |
# File 'app/services/embeddable_content/images/modal_dialog.rb', line 61 def target_div_id record_css_id_for 'modal-target' end |