app_rail-steps 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42519d84340141281c5aafa11a20c515f5be53567ebb6f53df920c6ac6870170
4
- data.tar.gz: b665ddd40d4d904d676af85f7cee1cce6ed8e8e1a42e68420cfb7d80a04551e2
3
+ metadata.gz: 7eec3b376b102a4001550f293763e044c96cc0031cc42f5cefdbc960824be46a
4
+ data.tar.gz: b1de751d8d17653b2c3d42d117325e8b3339b02374881c2dcd515eb7081a0dc6
5
5
  SHA512:
6
- metadata.gz: 1bf6eef1061548b2226b1d5b3f6428165f7443338101cdd5350b0fdc106d7e0a685c0598fe83d1075acbf59c33ba59a8d13ce1a95403de7c74cc2d461dd6ac00
7
- data.tar.gz: ecb72f5f9271a9c97d661637898ef16edd4bb1eec847100188bc50553081bb821f7b286edd564a64c41d7db1cc4082764d4f7f4700b9a75a19313e03dd0e4b60
6
+ metadata.gz: dfbdce5969408464b564756c18c7f4603d9a23b926d884328f2184aa0e1ee7e4cbd4509121c35a34dd77eba1efce3a36d25dc2aadf9fd48238352d4956e9fe5e
7
+ data.tar.gz: 8eef9412eec72784ea95026c94934f0744a70546e80662f6126c419817b17d09c7c8cbbbea66762a2e508729d093e92b032513998a25c07a5e90568ffc0f334d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_rail-steps (0.2.3)
4
+ app_rail-steps (0.2.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppRail
4
+ module Steps
5
+ module Core
6
+ module Stack
7
+ CONTENT_MODE_OPTIONS = %i[scale_aspect_fill scale_aspect_fit].freeze
8
+
9
+ def ar_core_stack_text(text:, label: nil)
10
+ { type: :text, label: label, text: text.to_s }.compact
11
+ end
12
+
13
+ def ar_core_stack_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill)
14
+ validate_content_mode!(content_mode)
15
+
16
+ { type: :image, contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower),
17
+ previewURL: preview_url, url: attachment_url }
18
+ end
19
+
20
+ def ar_core_stack_unsplash_image(image_url)
21
+ if image_url.start_with? "https://unsplash.com/photos"
22
+ unsplash_id = image_url.split("/").last
23
+ image_url = "https://source.unsplash.com/#{unsplash_id}/800x600"
24
+ end
25
+
26
+ { type: :image, previewURL: image_url, url: image_url }.compact
27
+ end
28
+
29
+ def ar_core_stack_video(preview_url:, attachment_url:)
30
+ { type: :video, previewURL: preview_url, url: attachment_url }
31
+ end
32
+
33
+ def ar_core_stack_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil)
34
+ validate_on_success!(on_success)
35
+ validate_button_style!(style)
36
+
37
+ { type: :button, label: label, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name,
38
+ materialIconName: material_icon_name }.compact
39
+ end
40
+
41
+ def ar_core_stack_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward)
42
+ validate_on_success!(on_success)
43
+ validate_button_style!(style)
44
+
45
+ { type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success,
46
+ sfSymbolName: "trash", materialIconName: "delete" }.compact
47
+ end
48
+
49
+ def ar_core_stack_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)
50
+ validate_on_success!(on_success)
51
+ validate_button_style!(style)
52
+
53
+ { type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title,
54
+ confirmText: confirm_text, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
55
+ end
56
+ alias ar_core_stack_button_for_url ar_core_stack_url_button
57
+
58
+ def ar_core_stack_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary, sf_symbol_name: nil, material_icon_name: nil)
59
+ validate_button_style!(style)
60
+ raise "Invalid android_deep_link" if android_deep_link && !android_deep_link.start_with?("http")
61
+
62
+ { type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link,
63
+ style: style, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
64
+ end
65
+ alias ar_core_stack_button_for_system_url ar_core_stack_system_url_button
66
+
67
+ def ar_core_stack_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
68
+ validate_on_success!(on_success)
69
+ validate_button_style!(style)
70
+
71
+ { type: :button, label: label, linkId: link_id, style: style, onSuccess: on_success,
72
+ sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
73
+ end
74
+
75
+ # Remove this method once V1 is no longer being used
76
+ def ar_core_stack_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
77
+ validate_on_success!(on_success)
78
+ validate_button_style!(style)
79
+
80
+ { type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success,
81
+ sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
82
+ end
83
+ alias ar_core_stack_button_for_modal_workflow ar_core_stack_modal_workflow_button
84
+
85
+ private
86
+
87
+ def validate_content_mode!(on_success)
88
+ raise "Unknown content_mode" unless CONTENT_MODE_OPTIONS.include?(on_success)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "core/list"
4
+ require_relative "core/stack"
4
5
  require_relative "core_forms/form"
5
6
  require_relative "maps/map"
6
7
 
@@ -8,6 +9,7 @@ module AppRail
8
9
  module Steps
9
10
  module Displayable
10
11
  include Steps::Core::List
12
+ include Steps::Core::Stack
11
13
  include Steps::CoreForms::Form
12
14
  include Steps::Maps::Map
13
15
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AppRail
4
4
  module Steps
5
- VERSION = "0.2.3"
5
+ VERSION = "0.2.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_rail-steps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith
@@ -28,6 +28,7 @@ files:
28
28
  - app_rail-steps.gemspec
29
29
  - lib/app_rail/steps.rb
30
30
  - lib/app_rail/steps/core/list.rb
31
+ - lib/app_rail/steps/core/stack.rb
31
32
  - lib/app_rail/steps/core_forms/form.rb
32
33
  - lib/app_rail/steps/displayable.rb
33
34
  - lib/app_rail/steps/maps/map.rb