app_rail-steps 0.2.3 → 0.2.6
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/Gemfile.lock +1 -1
- data/README.md +17 -2
- data/lib/app_rail/steps/core/list.rb +10 -3
- data/lib/app_rail/steps/core/stack.rb +93 -0
- data/lib/app_rail/steps/displayable.rb +6 -0
- data/lib/app_rail/steps/styled_content/grid.rb +30 -0
- data/lib/app_rail/steps/styled_content/stack.rb +38 -0
- data/lib/app_rail/steps/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a141fb3b658dd53261624e501490700e20e8659856c107022597092a2fe29469
|
4
|
+
data.tar.gz: 17a66d80b87ecb6305d88b56decf82ef5445e7d44b5062d49adef43132a3a0f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea4a473618b0e1129c641f9195c2cd84f8718ce1a3f6a6713aaf9eb064cc07eed26d29ef20b84e512ea6206052ac163cde9c32defe9dbcda38ccd0cc511664f
|
7
|
+
data.tar.gz: c7c443db93e21aa566c7a23b73ba5cd8905f8ca25e6c1d555b5a7ae2a9bf74ec90fc8bf8f09f79a54f22742c586a5778c8dea3c2ed607a7e5a89c3e1053d73bd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,22 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
#require the gem in your script
|
27
|
+
require 'app_rail/steps'
|
28
|
+
|
29
|
+
...
|
30
|
+
#inside your module/class include the displayable modile
|
31
|
+
include AppRail::Steps::Displayable
|
32
|
+
|
33
|
+
...
|
34
|
+
#now you can use the methods from the gem for example:
|
35
|
+
def ar_list_item_as_json
|
36
|
+
ar_core_list_item(id: self.id, text: self.name, detail_text: self.detail_text)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
```
|
26
41
|
|
27
42
|
## Development
|
28
43
|
|
@@ -32,7 +47,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
47
|
|
33
48
|
## Contributing
|
34
49
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/FutureWorkshops/app_rail-steps.
|
36
51
|
|
37
52
|
## License
|
38
53
|
|
@@ -4,9 +4,16 @@ module AppRail
|
|
4
4
|
module Steps
|
5
5
|
module Core
|
6
6
|
module List
|
7
|
-
def ar_core_list_item(text:, id: self.id, detail_text: nil, sf_symbol_name: nil, material_icon_name: nil, preview_url: nil)
|
8
|
-
{
|
9
|
-
|
7
|
+
def ar_core_list_item(text:, id: self.id, detail_text: nil, section_name: nil, sf_symbol_name: nil, material_icon_name: nil, preview_url: nil)
|
8
|
+
{
|
9
|
+
id: id,
|
10
|
+
text: text,
|
11
|
+
detailText: detail_text,
|
12
|
+
sectionName: section_name,
|
13
|
+
sfSymbolName: sf_symbol_name,
|
14
|
+
materialIconName: material_icon_name,
|
15
|
+
imageURL: preview_url
|
16
|
+
}.compact
|
10
17
|
end
|
11
18
|
|
12
19
|
def ar_core_list_search_suggestion(text:, section_name:, id: self.id, sf_symbol_name: nil)
|
@@ -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,15 +1,21 @@
|
|
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"
|
7
|
+
require_relative "styled_content/grid"
|
8
|
+
require_relative "styled_content/stack"
|
6
9
|
|
7
10
|
module AppRail
|
8
11
|
module Steps
|
9
12
|
module Displayable
|
10
13
|
include Steps::Core::List
|
14
|
+
include Steps::Core::Stack
|
11
15
|
include Steps::CoreForms::Form
|
12
16
|
include Steps::Maps::Map
|
17
|
+
include Steps::StyledContent::Grid
|
18
|
+
include Steps::StyledContent::Stack
|
13
19
|
|
14
20
|
BUTTON_STYLES = %i[primary outline danger textOnly].freeze
|
15
21
|
ON_SUCCESS_OPTIONS = %i[none reload backward forward].freeze
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AppRail
|
4
|
+
module Steps
|
5
|
+
module StyledContent
|
6
|
+
module Grid
|
7
|
+
def ar_styled_content_grid_large_section(id:, text:)
|
8
|
+
raise "Missing id" if id.nil?
|
9
|
+
raise "Missing text" if text.nil?
|
10
|
+
|
11
|
+
{ id: id, text: text, type: :largeSection }
|
12
|
+
end
|
13
|
+
|
14
|
+
def ar_styled_content_grid_small_section(id:, text:)
|
15
|
+
raise "Missing id" if id.nil?
|
16
|
+
raise "Missing text" if text.nil?
|
17
|
+
|
18
|
+
{ id: id, text: text, type: :smallSection }
|
19
|
+
end
|
20
|
+
|
21
|
+
def ar_styled_content_grid_item(text:, id: self.id, detail_text: nil, preview_url: nil)
|
22
|
+
raise "Missing id" if id.nil?
|
23
|
+
raise "Missing text" if text.nil?
|
24
|
+
|
25
|
+
{ id: id, text: text, type: :item, detailText: detail_text, imageURL: preview_url }.compact
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AppRail
|
4
|
+
module Steps
|
5
|
+
module StyledContent
|
6
|
+
module Stack
|
7
|
+
def ar_styled_content_stack_title(title:)
|
8
|
+
raise "Missing title" if title.nil?
|
9
|
+
|
10
|
+
{ id: id, title: title, type: :title }
|
11
|
+
end
|
12
|
+
|
13
|
+
def ar_styled_content_stack_text(text:)
|
14
|
+
raise "Missing text" if text.nil?
|
15
|
+
|
16
|
+
{ text: text, type: :text }
|
17
|
+
end
|
18
|
+
|
19
|
+
def ar_styled_content_stack_list_item(text:, detail_text: nil, preview_url: nil)
|
20
|
+
raise "Missing text" if text.nil?
|
21
|
+
|
22
|
+
{ text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
|
23
|
+
end
|
24
|
+
|
25
|
+
# Remove `modal_workflow_name` argument once V1 is no longer being used
|
26
|
+
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
|
+
raise "Missing label" if label.nil?
|
28
|
+
|
29
|
+
validate_on_success!(on_success)
|
30
|
+
validate_button_style!(style)
|
31
|
+
|
32
|
+
{ type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style,
|
33
|
+
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
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
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.6
|
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-04-
|
11
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -28,9 +28,12 @@ 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
|
35
|
+
- lib/app_rail/steps/styled_content/grid.rb
|
36
|
+
- lib/app_rail/steps/styled_content/stack.rb
|
34
37
|
- lib/app_rail/steps/version.rb
|
35
38
|
homepage: https://github.com/FutureWorkshops/app_rail-steps
|
36
39
|
licenses:
|