app_rail-steps 0.2.9 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/app_rail/steps/core/stack.rb +30 -14
- data/lib/app_rail/steps/core_forms/form.rb +4 -0
- data/lib/app_rail/steps/core_forms/question.rb +23 -0
- data/lib/app_rail/steps/displayable.rb +2 -13
- data/lib/app_rail/steps/styled_content/stack.rb +15 -2
- data/lib/app_rail/steps/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e97c2e972f41b9e52f0812d393307769cf307d1acd5bf2e45e3a1ce3e96a598
|
4
|
+
data.tar.gz: 72ae962e677f2b2e9d744df841fed365aa2f5da3ae16baca1c5f6ec8c1d82a3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a68e6fc37e83ae4737fd149b666ca196d85a15858b5070ae439367b162245ed144fd8339183d881570f3c811b4824e2280e1b74bf17bbd4594777a75d7f89526
|
7
|
+
data.tar.gz: f49f6fb1f1497141cd46efb981dd1a330d6211e3aeb1237508c1e35407a535c720c26c723c186ef0906bcd1785a49745dcdc7c273a7ed569df0104e7eaa1d50f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.11] - 2022-04-12
|
4
|
+
|
5
|
+
- Below change reverted because stack doesnt support patch yet
|
6
|
+
- Change default method on ar_core_stack_url_button from put to patch - more likely to match the kind of operation performed
|
7
|
+
|
3
8
|
## [0.1.0] - 2022-04-12
|
4
9
|
|
5
10
|
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -6,12 +6,20 @@ module AppRail
|
|
6
6
|
module Stack
|
7
7
|
CONTENT_MODE_OPTIONS = %i[scale_aspect_fill scale_aspect_fit].freeze
|
8
8
|
IMAGE_STYLE_OPTIONS = %i[full_width profile].freeze
|
9
|
+
BUTTON_STYLES = %i[primary outline danger].freeze
|
10
|
+
ON_SUCCESS_OPTIONS = %i[none reload backward forward].freeze
|
9
11
|
|
10
|
-
def ar_core_stack_text(text:, label: nil)
|
11
|
-
{
|
12
|
+
def ar_core_stack_text(text:, label: nil, sf_symbol_name: nil, material_icon_name: nil)
|
13
|
+
{
|
14
|
+
type: :text,
|
15
|
+
label: label,
|
16
|
+
text: text.to_s,
|
17
|
+
sfSymbolName: sf_symbol_name,
|
18
|
+
materialIconName: material_icon_name
|
19
|
+
}.compact
|
12
20
|
end
|
13
21
|
|
14
|
-
def ar_core_stack_image(preview_url:, attachment_url
|
22
|
+
def ar_core_stack_image(preview_url:, attachment_url: preview_url, image_style: :full_width, content_mode: :scale_aspect_fill)
|
15
23
|
validate_content_mode!(content_mode)
|
16
24
|
validate_image_style!(image_style)
|
17
25
|
|
@@ -37,24 +45,24 @@ module AppRail
|
|
37
45
|
end
|
38
46
|
|
39
47
|
def ar_core_stack_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil)
|
40
|
-
|
41
|
-
|
48
|
+
ar_core_stack_validate_on_success!(on_success)
|
49
|
+
ar_core_stack_validate_button_style!(style)
|
42
50
|
|
43
51
|
{ type: :button, label: label, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name,
|
44
52
|
materialIconName: material_icon_name }.compact
|
45
53
|
end
|
46
54
|
|
47
55
|
def ar_core_stack_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward)
|
48
|
-
|
49
|
-
|
56
|
+
ar_core_stack_validate_on_success!(on_success)
|
57
|
+
ar_core_stack_validate_button_style!(style)
|
50
58
|
|
51
59
|
{ type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success,
|
52
60
|
sfSymbolName: "trash", materialIconName: "delete" }.compact
|
53
61
|
end
|
54
62
|
|
55
63
|
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)
|
56
|
-
|
57
|
-
|
64
|
+
ar_core_stack_validate_on_success!(on_success)
|
65
|
+
ar_core_stack_validate_button_style!(style)
|
58
66
|
|
59
67
|
{ type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title,
|
60
68
|
confirmText: confirm_text, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
|
@@ -62,7 +70,7 @@ module AppRail
|
|
62
70
|
alias ar_core_stack_button_for_url ar_core_stack_url_button
|
63
71
|
|
64
72
|
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)
|
65
|
-
|
73
|
+
ar_core_stack_validate_button_style!(style)
|
66
74
|
raise "Invalid android_deep_link" if android_deep_link && !android_deep_link.start_with?("http")
|
67
75
|
|
68
76
|
{ type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link,
|
@@ -71,8 +79,8 @@ module AppRail
|
|
71
79
|
alias ar_core_stack_button_for_system_url ar_core_stack_system_url_button
|
72
80
|
|
73
81
|
def ar_core_stack_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
|
74
|
-
|
75
|
-
|
82
|
+
ar_core_stack_validate_on_success!(on_success)
|
83
|
+
ar_core_stack_validate_button_style!(style)
|
76
84
|
|
77
85
|
{ type: :button, label: label, linkId: link_id, style: style, onSuccess: on_success,
|
78
86
|
sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
|
@@ -80,8 +88,8 @@ module AppRail
|
|
80
88
|
|
81
89
|
# Remove this method once V1 is no longer being used
|
82
90
|
def ar_core_stack_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
|
83
|
-
|
84
|
-
|
91
|
+
ar_core_stack_validate_on_success!(on_success)
|
92
|
+
ar_core_stack_validate_button_style!(style)
|
85
93
|
|
86
94
|
{ type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success,
|
87
95
|
sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
|
@@ -97,6 +105,14 @@ module AppRail
|
|
97
105
|
def validate_image_style!(image_style)
|
98
106
|
raise "Unknown image_style" unless IMAGE_STYLE_OPTIONS.include?(image_style)
|
99
107
|
end
|
108
|
+
|
109
|
+
def ar_core_stack_validate_on_success!(on_success)
|
110
|
+
raise "Unknown on_success action" unless ON_SUCCESS_OPTIONS.include?(on_success)
|
111
|
+
end
|
112
|
+
|
113
|
+
def ar_core_stack_validate_button_style!(style)
|
114
|
+
raise "Unknown style" unless BUTTON_STYLES.include?(style)
|
115
|
+
end
|
100
116
|
end
|
101
117
|
end
|
102
118
|
end
|
@@ -4,6 +4,10 @@ module AppRail
|
|
4
4
|
module Steps
|
5
5
|
module CoreForms
|
6
6
|
module Form
|
7
|
+
#
|
8
|
+
# MBS - Note - ID on forms should be the value on the customOutput in the app.json for this field
|
9
|
+
#
|
10
|
+
|
7
11
|
def ar_core_forms_form_section(label:, id:)
|
8
12
|
raise "Missing label" if label.nil?
|
9
13
|
raise "Missing id" if id.nil?
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AppRail
|
4
|
+
module Steps
|
5
|
+
module CoreForms
|
6
|
+
module Question
|
7
|
+
def ar_core_forms_question_multiple_selection(label:, multiple_selection_options:, selection_type: :single, optional: false, show_other_option: false)
|
8
|
+
raise "Missing label" if label.nil?
|
9
|
+
raise "Missing multiple_selection_options" if multiple_selection_options.nil?
|
10
|
+
|
11
|
+
{
|
12
|
+
item_type: :multiple_selection,
|
13
|
+
label: label,
|
14
|
+
multiple_selection_options: multiple_selection_options,
|
15
|
+
selection_type: selection_type,
|
16
|
+
optional: optional,
|
17
|
+
show_other_option: show_other_option
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative "core/list"
|
4
4
|
require_relative "core/stack"
|
5
5
|
require_relative "core_forms/form"
|
6
|
+
require_relative "core_forms/question"
|
6
7
|
require_relative "maps/map"
|
7
8
|
require_relative "styled_content/grid"
|
8
9
|
require_relative "styled_content/stack"
|
@@ -14,24 +15,12 @@ module AppRail
|
|
14
15
|
include Steps::Core::List
|
15
16
|
include Steps::Core::Stack
|
16
17
|
include Steps::CoreForms::Form
|
18
|
+
include Steps::CoreForms::Question
|
17
19
|
include Steps::Maps::Map
|
18
20
|
include Steps::StyledContent::Grid
|
19
21
|
include Steps::StyledContent::Stack
|
20
22
|
include Steps::Charts::Dashboard
|
21
23
|
|
22
|
-
BUTTON_STYLES = %i[primary outline danger textOnly].freeze
|
23
|
-
ON_SUCCESS_OPTIONS = %i[none reload backward forward].freeze
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def validate_on_success!(on_success)
|
28
|
-
raise "Unknown on_success action" unless ON_SUCCESS_OPTIONS.include?(on_success)
|
29
|
-
end
|
30
|
-
|
31
|
-
def validate_button_style!(style)
|
32
|
-
raise "Unknown style" unless BUTTON_STYLES.include?(style)
|
33
|
-
end
|
34
|
-
|
35
24
|
def camelcase_converter(string, first_letter: :upper)
|
36
25
|
string = string.split("_").map(&:capitalize).join
|
37
26
|
return string unless first_letter == :lower
|
@@ -4,6 +4,9 @@ module AppRail
|
|
4
4
|
module Steps
|
5
5
|
module StyledContent
|
6
6
|
module Stack
|
7
|
+
BUTTON_STYLES = %i[primary outline danger textOnly].freeze
|
8
|
+
ON_SUCCESS_OPTIONS = %i[none reload backward forward].freeze
|
9
|
+
|
7
10
|
def ar_styled_content_stack_title(title:)
|
8
11
|
raise "Missing title" if title.nil?
|
9
12
|
|
@@ -26,12 +29,22 @@ module AppRail
|
|
26
29
|
def ar_styled_content_stack_button(label:, url: nil, method: :nil, on_success: :none, style: :primary, modal_workflow_name: nil, link_id: nil, link_url: nil, sf_symbol_name: nil, apple_system_url: nil, android_deep_link: nil, confirm_title: nil, confirm_text: nil, share_text: nil, share_image_url: nil)
|
27
30
|
raise "Missing label" if label.nil?
|
28
31
|
|
29
|
-
|
30
|
-
|
32
|
+
ar_styled_content_stack_validate_on_success!(on_success)
|
33
|
+
ar_styled_content_stack_validate_button_style!(style)
|
31
34
|
|
32
35
|
{ type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style,
|
33
36
|
modalWorkflow: modal_workflow_name, linkId: link_id, linkURL: link_url, sfSymbolName: sf_symbol_name, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, confirmTitle: confirm_title, confirmText: confirm_text, shareText: share_text, shareImageURL: share_image_url }.compact
|
34
37
|
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def ar_styled_content_stack_validate_on_success!(on_success)
|
42
|
+
raise "Unknown on_success action" unless ON_SUCCESS_OPTIONS.include?(on_success)
|
43
|
+
end
|
44
|
+
|
45
|
+
def ar_styled_content_stack_validate_button_style!(style)
|
46
|
+
raise "Unknown style" unless BUTTON_STYLES.include?(style)
|
47
|
+
end
|
35
48
|
end
|
36
49
|
end
|
37
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_rail-steps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- lib/app_rail/steps/core/list.rb
|
32
32
|
- lib/app_rail/steps/core/stack.rb
|
33
33
|
- lib/app_rail/steps/core_forms/form.rb
|
34
|
+
- lib/app_rail/steps/core_forms/question.rb
|
34
35
|
- lib/app_rail/steps/displayable.rb
|
35
36
|
- lib/app_rail/steps/maps/map.rb
|
36
37
|
- lib/app_rail/steps/styled_content/grid.rb
|
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
58
|
- !ruby/object:Gem::Version
|
58
59
|
version: '0'
|
59
60
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.7
|
61
62
|
signing_key:
|
62
63
|
specification_version: 4
|
63
64
|
summary: Utilities to generate JSON for expected step responses.
|