mobile_workflow 0.7.9 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59170ad3bd79a19bd9865679525edafce2bcef6e408249f16dd6fc4ed2cdd1e7
4
- data.tar.gz: 8d083bbcea39395ec6d990ea88f592c27aa28a53a1888a22b947ff71a99f3f44
3
+ metadata.gz: 05a26587c0ada255dbdb65acf88ccb79c9b3c446ba674e94d4abf9f67b0b1e03
4
+ data.tar.gz: f40ed602bb5aa0d959a98ffc103d0b9413c379104f006664a25650b2786cc05e
5
5
  SHA512:
6
- metadata.gz: 3c89026173ff3cf6b735bbc0d01ffb6e905cd1cf99509d6fe436aee5f4dc2cd327cf1fd9f613cdb8fc6a4804166152ba6c5cb56827bdb812f09e527f389f95fc
7
- data.tar.gz: 9c55da0efbcfac7a749d4ec7c4702946de29a255a5a5ec6b641dbf8f880b32b358f0e90952c72befbadd002c1b4c89bd2d59a5c06bd8b2f9426f9d7e37c8224c
6
+ metadata.gz: 537062506b6b62327e638c58ea0b03681bf288a7ee0ca1b0ade9537a6dfb621eebd592efa43b105a4c5f4b6093ecc17471230cb4f4590ae1bef74ec6ef0b104b
7
+ data.tar.gz: ba524976812ed3116a354777ff47a1b57734c17352e8609e279a0a0128e29792c9ff46504ef46991a2cd6df1e3f1e3ee5300753c8457f7b62030d861df647e16
data/README.md CHANGED
@@ -26,89 +26,6 @@ Or install it yourself as:
26
26
  $ gem install mobile_workflow
27
27
  ```
28
28
 
29
- ## Upgrade to version 0.7.7 or higher
30
- The following utility methods have changed their parameters:
31
-
32
- ```ruby
33
- # app/models/concerns/mobile_workflow/displayable/steps/styled_content/grid.rb#20
34
- def mw_grid_item(id: self.id, text:, detail_text: nil, preview_url: nil)
35
- raise 'Missing id' if id.nil?
36
- raise 'Missing text' if text.nil?
37
-
38
- { id: id, text: text, type: :item, detailText: detail_text, imageURL: preview_url }.compact
39
- end
40
-
41
- # app/models/concerns/mobile_workflow/displayable/steps/styled_content/stack.rb#20
42
- def mw_stack_list_item(id:, text:, detail_text: nil, preview_url: nil)
43
- raise 'Missing id' if id.nil?
44
- raise 'Missing text' if text.nil?
45
-
46
- { id: id.to_s, text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
47
- end
48
-
49
- # app/models/concerns/mobile_workflow/displayable/steps/list.rb#5
50
- def mw_list_item(id: self.id, text:, detail_text: nil, sf_symbol_name: nil, material_icon_name: nil, preview_url: nil)
51
- { id: id, text: text, detailText: detail_text, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name, imageURL: preview_url }.compact
52
- end
53
-
54
- # app/models/concerns/mobile_workflow/displayable/steps/stack.rb#26
55
- def mw_display_video(preview_url:, attachment_url:)
56
- {type: :video, previewURL: preview_url, url: attachment_url}
57
- end
58
-
59
- # app/models/concerns/mobile_workflow/displayable/steps/stack.rb#11
60
- def mw_display_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill)
61
- validate_content_mode!(content_mode)
62
-
63
- {type: :image, contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower), previewURL: preview_url, url: attachment_url}
64
- end
65
- ```
66
-
67
- All URLs MUST now be explicitly sent as arguments to the above methods, which means they must be previously set. If not, the methods will not work.
68
-
69
- In order to support projects using `ActiveStorage`, there is a new model concern `MobileWorkflow::Attachable` that provides a few helpers. This is what you can do to upgrade if you use ActiveStorage (otherwise the helpers must be manually created):
70
-
71
- 1. Include the concern in the `ApplicationRecord` class, together with `MobileWorkflow::Displayable`:
72
-
73
- ```ruby
74
- class ApplicationRecord < ActiveRecord::Base
75
- include MobileWorkflow::Attachable
76
- include MobileWorkflow::Displayable
77
- end
78
- ```
79
-
80
- 2. Once included, the following helpers will be available, so use them to generate the intended URLs:
81
-
82
- ```ruby
83
- def preview_url(attachment, options: { resize_to_fill: [200, 200] })
84
- return nil unless attachment.attached?
85
-
86
- if attachment.image?
87
- rails_representation_url(attachment.variant(options), host: heroku_attachment_host)
88
- elsif attachment.previewable?
89
- rails_representation_url(attachment.preview(options), host: heroku_attachment_host)
90
- else
91
- return nil
92
- end
93
- end
94
-
95
- def attachment_url(attachment)
96
- return nil unless attachment.attached?
97
-
98
- rails_blob_url(attachment, host: heroku_attachment_host)
99
- end
100
- ```
101
-
102
- Example of use:
103
- ```ruby
104
- # Old method call
105
- mw_list_item(text: 'John Doe', detail_text: 'Company Name', image_attachment: <ActiveStorage::Attached::One>, image_url: 'https://test.org/preview')
106
-
107
- # New method call
108
- preview_url = preview_url(<ActiveStorage::Attached::One>, options: { resize_to_fill: [200, 200] }) || 'https://test.org/preview'
109
- mw_list_item(text: 'John Doe', detail_text: 'Company Name', preview_url: preview_url)
110
- ```
111
-
112
29
  ## Contributing
113
30
  Contribution directions go here.
114
31
 
@@ -1,70 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+
1
4
  module MobileWorkflow
2
5
  module Displayable
3
6
  module Steps
4
7
  module Form
5
- def mw_form_section(label:, identifier:)
8
+ def mw_form_section(label:, id:)
6
9
  raise 'Missing label' if label.nil?
7
- raise 'Missing identifier' if identifier.nil?
8
-
9
- { item_type: :section, label: label, identifier: identifier }
10
+ raise 'Missing id' if id.nil?
11
+
12
+ { item_type: :section, id: id, label: label }
10
13
  end
11
-
12
- def mw_form_multiple_selection(label:, identifier:, multiple_selection_options:, selection_type: :single, optional: false, show_other_option: false)
14
+
15
+ def mw_form_multiple_selection(label:, multiple_selection_options:, id:, selection_type: :single, optional: false, show_other_option: false)
13
16
  raise 'Missing label' if label.nil?
14
- raise 'Missing identifier' if identifier.nil?
17
+ raise 'Missing id' if id.nil?
15
18
  raise 'Missing multiple selection options' if multiple_selection_options.nil?
16
-
17
- { item_type: :multiple_selection, label: label, identifier: identifier, multiple_selection_options: multiple_selection_options, selection_type: selection_type, optional: optional, show_other_option: show_other_option }
19
+
20
+ { item_type: :multiple_selection, id: id, label: label,
21
+ multiple_selection_options: multiple_selection_options, selection_type: selection_type, optional: optional, show_other_option: show_other_option }
18
22
  end
19
-
23
+
20
24
  def mw_form_multiple_selection_options(text:, hint: nil, is_pre_selected: false)
21
25
  raise 'Missing text' if text.nil?
22
-
26
+
23
27
  { text: text, hint: hint, isPreSelected: is_pre_selected }
24
28
  end
25
-
26
- def mw_form_number(label:, identifier:, placeholder: nil, optional: false, symbol_position: :leading, default_text_answer: nil, hint: nil)
29
+
30
+ def mw_form_number(label:, id:, placeholder: nil, optional: false, symbol_position: :leading, default_text_answer: nil, hint: nil)
27
31
  raise 'Missing label' if label.nil?
28
- raise 'Missing identifier' if identifier.nil?
29
-
30
- { item_type: :number, number_type: :number, label: label, identifier: identifier, placeholder: placeholder, optional: optional, symbol_position: symbol_position, default_text_answer: default_text_answer, hint: hint }
32
+ raise 'Missing id' if id.nil?
33
+
34
+ { item_type: :number, number_type: :number, id: id, label: label,
35
+ placeholder: placeholder, optional: optional, symbol_position: symbol_position, default_text_answer: default_text_answer, hint: hint }
31
36
  end
32
-
33
- def mw_form_text(label:, identifier:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil)
37
+
38
+ def mw_form_text(label:, id:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil, hint: nil)
34
39
  raise 'Missing label' if label.nil?
35
- raise 'Missing identifier' if identifier.nil?
36
-
37
- { item_type: :text, label: label, identifier: identifier, placeholder: placeholder, optional: optional, multiline: multiline, default_text_answer: default_text_answer }
40
+ raise 'Missing id' if id.nil?
41
+
42
+ { item_type: :text, id: id, label: label, placeholder: placeholder,
43
+ optional: optional, multiline: multiline, default_text_answer: default_text_answer, hint: hint }
38
44
  end
39
-
40
- def mw_form_date(label:, identifier:, optional: false, default_text_answer: nil)
45
+
46
+ def mw_form_date(label:, id:, optional: false, default_text_answer: nil)
41
47
  raise 'Missing label' if label.nil?
42
- raise 'Missing identifier' if identifier.nil?
43
-
44
- { item_type: :date, date_type: :calendar, label: label, identifier: identifier, optional: optional, default_text_answer: default_text_answer }
48
+ raise 'Missing id' if id.nil?
49
+
50
+ { item_type: :date, date_type: :calendar, id: id, label: label, optional: optional,
51
+ default_text_answer: default_text_answer }
45
52
  end
46
-
47
- def mw_form_time(label:, identifier:, optional: false, default_text_answer: nil)
53
+
54
+ def mw_form_time(label:, id:, optional: false, default_text_answer: nil)
48
55
  raise 'Missing label' if label.nil?
49
- raise 'Missing identifier' if identifier.nil?
50
-
51
- { item_type: :time, label: label, identifier: identifier, optional: optional, default_text_answer: default_text_answer }
56
+ raise 'Missing id' if id.nil?
57
+
58
+ { item_type: :time, id: id, label: label, optional: optional,
59
+ default_text_answer: default_text_answer }
52
60
  end
53
-
54
- def mw_form_email(label:, identifier:, placeholder: nil, optional: false, default_text_answer: nil)
61
+
62
+ def mw_form_email(label:, id:, placeholder: nil, optional: false, default_text_answer: nil)
55
63
  raise 'Missing label' if label.nil?
56
- raise 'Missing identifier' if identifier.nil?
57
-
58
- { item_type: :email, label: label, identifier: identifier, placeholder: placeholder, optional: optional, default_text_answer: default_text_answer }
64
+ raise 'Missing id' if id.nil?
65
+
66
+ { item_type: :email, id: id, label: label, placeholder: placeholder,
67
+ optional: optional, default_text_answer: default_text_answer }
59
68
  end
60
-
61
- def mw_form_password(label:, identifier:, placeholder: nil, optional: false, default_text_answer: nil, hint: nil)
69
+
70
+ def mw_form_password(label:, id:, placeholder: nil, optional: false, default_text_answer: nil, hint: nil)
62
71
  raise 'Missing label' if label.nil?
63
- raise 'Missing identifier' if identifier.nil?
64
-
65
- { item_type: :secure, label: label, identifier: identifier, placeholder: placeholder, optional: optional, default_text_answer: default_text_answer, hint: hint }
72
+ raise 'Missing id' if id.nil?
73
+
74
+ { item_type: :secure, id: id, label: label, placeholder: placeholder,
75
+ optional: optional, default_text_answer: default_text_answer, hint: hint }
66
76
  end
67
77
  end
68
78
  end
69
79
  end
70
- end
80
+ end
@@ -56,7 +56,15 @@ module MobileWorkflow
56
56
  {type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact
57
57
  end
58
58
  alias_method :mw_display_button_for_system_url, :mw_display_system_url_button
59
-
59
+
60
+ def mw_display_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
61
+ validate_on_success!(on_success)
62
+ validate_button_style!(style)
63
+
64
+ {type: :button, label: label, linkId: link_id, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact
65
+ end
66
+
67
+ # Remove this method once V1 is no longer being used
60
68
  def mw_display_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
61
69
  validate_on_success!(on_success)
62
70
  validate_button_style!(style)
@@ -1,40 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MobileWorkflow
2
4
  module Displayable
3
5
  module Steps
4
6
  module StyledContent
5
7
  module Stack
6
- def mw_stack_title(id:, title:)
7
- raise 'Missing id' if id.nil?
8
+ def mw_stack_title(title:)
8
9
  raise 'Missing title' if title.nil?
9
-
10
+
10
11
  { id: id, title: title, type: :title }
11
12
  end
12
-
13
- def mw_stack_text(id:, text:)
14
- raise 'Missing id' if id.nil?
13
+
14
+ def mw_stack_text(text:)
15
15
  raise 'Missing text' if text.nil?
16
-
17
- { id: id, text: text, type: :text }
16
+
17
+ { text: text, type: :text }
18
18
  end
19
-
20
- def mw_stack_list_item(id:, text:, detail_text: nil, preview_url: nil)
21
- raise 'Missing id' if id.nil?
19
+
20
+ def mw_stack_list_item(text:, detail_text: nil, preview_url: nil)
22
21
  raise 'Missing text' if text.nil?
23
-
24
- { id: id.to_s, text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
22
+
23
+ { text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
25
24
  end
26
-
27
- def mw_stack_button(id:, label:, url: nil, method: :nil, on_success: :none, style: :primary, modal_workflow_name: 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)
28
- raise 'Missing id' if id.nil?
25
+
26
+ # Remove `modal_workflow_name` argument once V1 is no longer being used
27
+ def mw_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)
29
28
  raise 'Missing label' if label.nil?
30
-
29
+
31
30
  validate_on_success!(on_success)
32
31
  validate_button_style!(style)
33
-
34
- { id: id, type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style, modalWorkflow: modal_workflow_name, 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
32
+
33
+ { type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style,
34
+ 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
35
35
  end
36
36
  end
37
37
  end
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -1,5 +1,5 @@
1
1
  module MobileWorkflow
2
- VERSION = '0.7.9'
2
+ VERSION = '0.10.0'
3
3
  RUBY_VERSION = '2.7.3'
4
4
  RAILS_VERSION = '6.1.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobile_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -114,7 +114,7 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
- description:
117
+ description:
118
118
  email:
119
119
  - matt@futureworkshops.com
120
120
  executables:
@@ -192,7 +192,7 @@ homepage: https://github.com/futureworkshops/mobile_workflow
192
192
  licenses:
193
193
  - MIT
194
194
  metadata: {}
195
- post_install_message:
195
+ post_install_message:
196
196
  rdoc_options: []
197
197
  require_paths:
198
198
  - lib
@@ -207,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  requirements: []
210
- rubygems_version: 3.3.5
211
- signing_key:
210
+ rubygems_version: 3.3.6
211
+ signing_key:
212
212
  specification_version: 4
213
213
  summary: A Rails engine to provide API support for Mobile Workflow Apps.
214
214
  test_files: []