mobile_workflow 0.6.21 → 0.6.26
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65e12da53f92edfa4c06876329b205e1f71990ee264175cb4a9355672c5f75d9
|
4
|
+
data.tar.gz: b021eff511808e096e8853ae9b3e8d0d5e305b3163941b1480e10630df9463ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09221ae3237245c92776a17665c58f6672302537213b763f4d8c3710ab0856f96a3a4a6615cc631fcf11efc25ab8a099edbabdc86d99e99b48e43846d4bd5097'
|
7
|
+
data.tar.gz: a0ff5ad06eb925171419d07b0243a8288402fd5731c1b8a761f21ac2440e4524599d91dc56655aab308451a0a12dd9b10478cba55a7b0becf36ee616062c9a52
|
@@ -6,12 +6,13 @@ module MobileWorkflow
|
|
6
6
|
def binary_urls(object)
|
7
7
|
return unless params["binaries"]
|
8
8
|
|
9
|
-
params["binaries"].
|
10
|
-
|
9
|
+
params["binaries"].map do |binary|
|
10
|
+
object_attribute = binary["identifier"]
|
11
|
+
extension = binary["mimetype"].split('/')[1] # i.e. image/jpg --> jpg, video/mp4 --> mp4
|
11
12
|
|
12
13
|
{
|
13
14
|
"identifier" => binary["identifier"],
|
14
|
-
"url" => presigned_url("#{object.class.name.underscore}/#{object.id}/#{
|
15
|
+
"url" => presigned_url("#{object.class.name.underscore}/#{object.id}/#{object_attribute}.#{extension}"),
|
15
16
|
"method" => "PUT"
|
16
17
|
}
|
17
18
|
end
|
@@ -5,7 +5,8 @@ module MobileWorkflow
|
|
5
5
|
|
6
6
|
ON_SUCCESS_OPTIONS = [:none, :reload, :backward, :forward]
|
7
7
|
BUTTON_STYLES = [:primary, :outline, :danger]
|
8
|
-
CONTENT_MODE_OPTIONS = [:scale_aspect_fill, :scale_aspect_fit]
|
8
|
+
CONTENT_MODE_OPTIONS = [:scale_aspect_fill, :scale_aspect_fit]
|
9
|
+
QUESTION_STYLES = [:single_choice, :multiple_choice]
|
9
10
|
|
10
11
|
def mw_list_item(id: self.id, text:, detail_text: nil, sf_symbol_name: nil, image_attachment: nil)
|
11
12
|
mw_list_item = {id: id, text: text, detailText: detail_text, sfSymbolName: sf_symbol_name}
|
@@ -13,6 +14,10 @@ module MobileWorkflow
|
|
13
14
|
mw_list_item.compact
|
14
15
|
end
|
15
16
|
|
17
|
+
def mw_list_search_suggestion(id:, text:, section_name:, sf_symbol_name: nil)
|
18
|
+
{id: id, text: text, sectionName: section_name, sfSymbolName: sf_symbol_name}.compact
|
19
|
+
end
|
20
|
+
|
16
21
|
def mw_map_item(id: self.id, text:, detail_text: nil, latitude:, longitude:)
|
17
22
|
{id: id, text: text, detailText: detail_text, latitude: latitude, longitude: longitude}.compact
|
18
23
|
end
|
@@ -44,43 +49,75 @@ module MobileWorkflow
|
|
44
49
|
{type: :video, previewURL: preview_url(attachment, options: preview_options), url: attachment_url(attachment)}
|
45
50
|
end
|
46
51
|
|
47
|
-
def mw_display_button(label:, style: :primary, on_success: :forward)
|
52
|
+
def mw_display_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil)
|
48
53
|
validate_on_success!(on_success)
|
49
54
|
validate_button_style!(style)
|
50
55
|
|
51
|
-
{type: :button, label: label, style: style, onSuccess: on_success}.compact
|
56
|
+
{type: :button, label: label, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact
|
52
57
|
end
|
53
58
|
|
54
59
|
def mw_display_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward)
|
55
60
|
validate_on_success!(on_success)
|
56
61
|
validate_button_style!(style)
|
57
62
|
|
58
|
-
{type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success}.compact
|
63
|
+
{type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success, sfSymbolName: 'trash', materialIconName: 'delete'}.compact
|
59
64
|
end
|
60
65
|
|
61
|
-
def mw_display_url_button(label:, url:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload)
|
66
|
+
def mw_display_url_button(label:, url:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload, sf_symbol_name: nil, material_icon_name: nil)
|
62
67
|
validate_on_success!(on_success)
|
63
68
|
validate_button_style!(style)
|
64
69
|
|
65
|
-
{type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title, confirmText: confirm_text, onSuccess: on_success}.compact
|
70
|
+
{type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title, confirmText: confirm_text, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact
|
66
71
|
end
|
67
72
|
alias_method :mw_display_button_for_url, :mw_display_url_button
|
68
73
|
|
69
|
-
def mw_display_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary)
|
74
|
+
def mw_display_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary, sf_symbol_name: nil, material_icon_name: nil)
|
70
75
|
validate_button_style!(style)
|
71
76
|
raise 'Invalid android_deep_link' unless android_deep_link.start_with?('http')
|
72
77
|
|
73
|
-
{type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style}.compact
|
78
|
+
{type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact
|
74
79
|
end
|
75
80
|
alias_method :mw_display_button_for_system_url, :mw_display_system_url_button
|
76
81
|
|
77
|
-
def mw_display_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none)
|
82
|
+
def mw_display_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
|
78
83
|
validate_on_success!(on_success)
|
79
84
|
validate_button_style!(style)
|
80
85
|
|
81
|
-
{type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success}.compact
|
86
|
+
{type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name}.compact
|
82
87
|
end
|
83
88
|
alias_method :mw_display_button_for_modal_workflow, :mw_display_modal_workflow_button
|
89
|
+
|
90
|
+
def mw_text_choice_question(question:, style:, text_choices:)
|
91
|
+
raise 'Missing question' if question.blank?
|
92
|
+
raise 'Text Choices should be a hash' unless text_choices.is_a?(Hash)
|
93
|
+
validate_question_style!(style)
|
94
|
+
|
95
|
+
text_choices_a = text_choices.map{|k, v| {_class: "ORKTextChoice", exclusive: false, text: k, value: v} }.to_a
|
96
|
+
{ question: question, answerFormat: { _class: "ORKTextChoiceAnswerFormat", style: style.to_s.camelize(:lower), textChoices: text_choices_a}}
|
97
|
+
end
|
98
|
+
|
99
|
+
def mw_grid_large_section(id:, text:)
|
100
|
+
raise 'Missing id' if id.nil?
|
101
|
+
raise 'Missing text' if text.nil?
|
102
|
+
|
103
|
+
{ id: id, text: text, type: :largeSection }
|
104
|
+
end
|
105
|
+
|
106
|
+
def mw_grid_small_section(id:, text:)
|
107
|
+
raise 'Missing id' if id.nil?
|
108
|
+
raise 'Missing text' if text.nil?
|
109
|
+
|
110
|
+
{ id: id, text: text, type: :smallSection }
|
111
|
+
end
|
112
|
+
|
113
|
+
def mw_grid_item(id: self.id, text:, image_attachment: nil)
|
114
|
+
raise 'Missing id' if id.nil?
|
115
|
+
raise 'Missing text' if text.nil?
|
116
|
+
|
117
|
+
item = { id: id, text: text, type: :item }
|
118
|
+
item[:imageURL] = preview_url(image_attachment, options: { resize_to_fill: [600, 600] }) if image_attachment
|
119
|
+
item
|
120
|
+
end
|
84
121
|
|
85
122
|
private
|
86
123
|
def validate_on_success!(on_success)
|
@@ -95,6 +132,10 @@ module MobileWorkflow
|
|
95
132
|
raise 'Unknown style' unless BUTTON_STYLES.include?(style)
|
96
133
|
end
|
97
134
|
|
135
|
+
def validate_question_style!(style)
|
136
|
+
raise 'Unknown style' unless QUESTION_STYLES.include?(style)
|
137
|
+
end
|
138
|
+
|
98
139
|
def preview_url(attachment, options:)
|
99
140
|
return nil unless attachment.attached?
|
100
141
|
|
@@ -52,6 +52,9 @@ module MobileWorkflow
|
|
52
52
|
def generate_models
|
53
53
|
say "Loading OpenAPI Spec: #{open_api_spec_path}"
|
54
54
|
say "Generating models"
|
55
|
+
|
56
|
+
copy_file("app/models/application_record.rb")
|
57
|
+
|
55
58
|
model_name_to_properties.each_pair do |model_name, model_properties|
|
56
59
|
|
57
60
|
if doorkeeper_oauth?
|
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.6.
|
4
|
+
version: 0.6.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|