app_rail-steps 0.2.8 → 0.2.11
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/app_rail/steps/core/stack.rb +48 -22
- data/lib/app_rail/steps/core_forms/form.rb +4 -0
- data/lib/app_rail/steps/core_forms/question.rb +25 -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: 715b23d59a1f0186a3e9d5296492e64e0a165a788cd99191d745af88916591a7
|
4
|
+
data.tar.gz: 05f1aec93c0920517ddd4687ee10d8cff1fe183a9e61c118206f2a92077617d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d0c73306645433d89267f53a3bd4d29243285ca18ef812034d1d580f90da2f2adc809dfcd77c289a3f19f3986f79f87bf86126dcca71d0ccf3fbd68b836d4a
|
7
|
+
data.tar.gz: e4471a05569414cc92efb3bdf16d8b918245a09c7e0cb168f3dfd1ec749bbe1b93b6e8913372de8778d286745cb22cfd2c472586f0cb9a06f731978cdd8ca340
|
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
@@ -5,16 +5,31 @@ module AppRail
|
|
5
5
|
module Core
|
6
6
|
module Stack
|
7
7
|
CONTENT_MODE_OPTIONS = %i[scale_aspect_fill scale_aspect_fit].freeze
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
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
|
11
20
|
end
|
12
21
|
|
13
|
-
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)
|
14
23
|
validate_content_mode!(content_mode)
|
15
|
-
|
16
|
-
|
17
|
-
|
24
|
+
validate_image_style!(image_style)
|
25
|
+
|
26
|
+
{
|
27
|
+
type: :image,
|
28
|
+
contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower),
|
29
|
+
previewURL: preview_url,
|
30
|
+
url: attachment_url,
|
31
|
+
imageStyle: camelcase_converter(image_style.to_s, first_letter: :lower)
|
32
|
+
}
|
18
33
|
end
|
19
34
|
|
20
35
|
def ar_core_stack_unsplash_image(image_url)
|
@@ -22,8 +37,7 @@ module AppRail
|
|
22
37
|
unsplash_id = image_url.split("/").last
|
23
38
|
image_url = "https://source.unsplash.com/#{unsplash_id}/800x600"
|
24
39
|
end
|
25
|
-
|
26
|
-
{ type: :image, previewURL: image_url, url: image_url }.compact
|
40
|
+
ar_core_stack_image(preview_url: image_url, attachment_url: image_url)
|
27
41
|
end
|
28
42
|
|
29
43
|
def ar_core_stack_video(preview_url:, attachment_url:)
|
@@ -31,24 +45,24 @@ module AppRail
|
|
31
45
|
end
|
32
46
|
|
33
47
|
def ar_core_stack_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil)
|
34
|
-
|
35
|
-
|
48
|
+
ar_core_stack_validate_on_success!(on_success)
|
49
|
+
ar_core_stack_validate_button_style!(style)
|
36
50
|
|
37
51
|
{ type: :button, label: label, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name,
|
38
52
|
materialIconName: material_icon_name }.compact
|
39
53
|
end
|
40
54
|
|
41
55
|
def ar_core_stack_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward)
|
42
|
-
|
43
|
-
|
56
|
+
ar_core_stack_validate_on_success!(on_success)
|
57
|
+
ar_core_stack_validate_button_style!(style)
|
44
58
|
|
45
59
|
{ type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success,
|
46
60
|
sfSymbolName: "trash", materialIconName: "delete" }.compact
|
47
61
|
end
|
48
62
|
|
49
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)
|
50
|
-
|
51
|
-
|
64
|
+
ar_core_stack_validate_on_success!(on_success)
|
65
|
+
ar_core_stack_validate_button_style!(style)
|
52
66
|
|
53
67
|
{ type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title,
|
54
68
|
confirmText: confirm_text, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
|
@@ -56,7 +70,7 @@ module AppRail
|
|
56
70
|
alias ar_core_stack_button_for_url ar_core_stack_url_button
|
57
71
|
|
58
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)
|
59
|
-
|
73
|
+
ar_core_stack_validate_button_style!(style)
|
60
74
|
raise "Invalid android_deep_link" if android_deep_link && !android_deep_link.start_with?("http")
|
61
75
|
|
62
76
|
{ type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link,
|
@@ -65,8 +79,8 @@ module AppRail
|
|
65
79
|
alias ar_core_stack_button_for_system_url ar_core_stack_system_url_button
|
66
80
|
|
67
81
|
def ar_core_stack_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
|
68
|
-
|
69
|
-
|
82
|
+
ar_core_stack_validate_on_success!(on_success)
|
83
|
+
ar_core_stack_validate_button_style!(style)
|
70
84
|
|
71
85
|
{ type: :button, label: label, linkId: link_id, style: style, onSuccess: on_success,
|
72
86
|
sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
|
@@ -74,8 +88,8 @@ module AppRail
|
|
74
88
|
|
75
89
|
# Remove this method once V1 is no longer being used
|
76
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)
|
77
|
-
|
78
|
-
|
91
|
+
ar_core_stack_validate_on_success!(on_success)
|
92
|
+
ar_core_stack_validate_button_style!(style)
|
79
93
|
|
80
94
|
{ type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success,
|
81
95
|
sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
|
@@ -84,8 +98,20 @@ module AppRail
|
|
84
98
|
|
85
99
|
private
|
86
100
|
|
87
|
-
def validate_content_mode!(
|
88
|
-
raise "Unknown content_mode" unless CONTENT_MODE_OPTIONS.include?(
|
101
|
+
def validate_content_mode!(content_mode)
|
102
|
+
raise "Unknown content_mode" unless CONTENT_MODE_OPTIONS.include?(content_mode)
|
103
|
+
end
|
104
|
+
|
105
|
+
def validate_image_style!(image_style)
|
106
|
+
raise "Unknown image_style" unless IMAGE_STYLE_OPTIONS.include?(image_style)
|
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)
|
89
115
|
end
|
90
116
|
end
|
91
117
|
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,25 @@
|
|
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(id:, label:, multiple_selection_options:, selection_type: :single, optional: false, show_other_option: false)
|
8
|
+
raise "Missing label" if label.nil?
|
9
|
+
raise "Missing id" if id.nil?
|
10
|
+
raise "Missing multiple_selection_options" if multiple_selection_options.nil?
|
11
|
+
|
12
|
+
{
|
13
|
+
item_type: :multiple_selection,
|
14
|
+
id: id,
|
15
|
+
label: label,
|
16
|
+
multiple_selection_options: multiple_selection_options,
|
17
|
+
selection_type: selection_type,
|
18
|
+
optional: optional,
|
19
|
+
show_other_option: show_other_option
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.11
|
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-21 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.
|