Module: MobileWorkflow::Displayable::Steps::Stack
- Included in:
- MobileWorkflow::Displayable
- Defined in:
- app/models/concerns/mobile_workflow/displayable/steps/stack.rb
Constant Summary collapse
- CONTENT_MODE_OPTIONS =
[:scale_aspect_fill, :scale_aspect_fit]
Instance Method Summary collapse
- #mw_display_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object
- #mw_display_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward) ⇒ Object
- #mw_display_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill) ⇒ Object
- #mw_display_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object
-
#mw_display_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object
(also: #mw_display_button_for_modal_workflow)
Remove this method once V1 is no longer being used.
- #mw_display_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object (also: #mw_display_button_for_system_url)
- #mw_display_text(text:, label: nil) ⇒ Object
- #mw_display_unsplash_image(image_url) ⇒ Object
- #mw_display_url_button(url:, label:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object (also: #mw_display_button_for_url)
- #mw_display_video(preview_url:, attachment_url:) ⇒ Object
Instance Method Details
#mw_display_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object
30 31 32 33 34 35 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 30 def (label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil) validate_on_success!(on_success) (style) {type: :button, label: label, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact end |
#mw_display_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward) ⇒ Object
37 38 39 40 41 42 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 37 def (url:, label: "Delete", method: :delete, style: :danger, on_success: :backward) validate_on_success!(on_success) (style) {type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success, sfSymbolName: 'trash', materialIconName: 'delete'}.compact end |
#mw_display_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill) ⇒ Object
11 12 13 14 15 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 11 def mw_display_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill) validate_content_mode!(content_mode) {type: :image, contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower), previewURL: preview_url, url: } end |
#mw_display_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object
60 61 62 63 64 65 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 60 def (label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil) validate_on_success!(on_success) (style) {type: :button, label: label, linkId: link_id, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact end |
#mw_display_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object Also known as:
Remove this method once V1 is no longer being used
68 69 70 71 72 73 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 68 def (label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil) validate_on_success!(on_success) (style) {type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact end |
#mw_display_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object Also known as:
52 53 54 55 56 57 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 52 def (label:, apple_system_url: nil, android_deep_link: nil, style: :primary, sf_symbol_name: nil, material_icon_name: nil) (style) raise 'Invalid android_deep_link' if android_deep_link && !android_deep_link.start_with?('http') {type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact end |
#mw_display_text(text:, label: nil) ⇒ Object
7 8 9 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 7 def mw_display_text(text:, label: nil) {type: :text, label: label, text: text.to_s}.compact end |
#mw_display_unsplash_image(image_url) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 17 def mw_display_unsplash_image(image_url) if image_url.start_with? "https://unsplash.com/photos" unsplash_id = image_url.split('/').last image_url = "https://source.unsplash.com/#{unsplash_id}/800x600" end {type: :image, previewURL: image_url, url: image_url}.compact end |
#mw_display_url_button(url:, label:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload, sf_symbol_name: nil, material_icon_name: nil) ⇒ Object Also known as:
44 45 46 47 48 49 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 44 def (url:, label:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload, sf_symbol_name: nil, material_icon_name: nil) validate_on_success!(on_success) (style) {type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title, confirmText: confirm_text, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact end |
#mw_display_video(preview_url:, attachment_url:) ⇒ Object
26 27 28 |
# File 'app/models/concerns/mobile_workflow/displayable/steps/stack.rb', line 26 def mw_display_video(preview_url:, attachment_url:) {type: :video, previewURL: preview_url, url: } end |