mobile_workflow 0.6.22 → 0.6.23
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/app/models/concerns/mobile_workflow/displayable.rb +15 -1
- data/lib/mobile_workflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '090b3070564f994192df8405b3e82cffe5e7898d1ff5a5d7d74b6f82894356a0'
|
4
|
+
data.tar.gz: 17733e78cf3e0b6f180a3db9f6e4baf41e6d5616d805f91bc8af0a0053dfa9bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62098f3fa6656bc4f5e29034fbade9f0087cfcb4462a161cf70549a272d94cc98bd2055a71b734a1089a0ebba80e9c309d36e5a51c4c1cb1cdeb4e39f7de3208
|
7
|
+
data.tar.gz: 31facdd89a123b1682d2bf6f5ea5fc72370c3e08462c16c614d6225f03cc1b939c8b8e8952c5d7051ab0154d9cd4c9533e2e9de2ad285e5a477f3fd08b76d9d4
|
@@ -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}
|
@@ -81,6 +82,15 @@ module MobileWorkflow
|
|
81
82
|
{type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success}.compact
|
82
83
|
end
|
83
84
|
alias_method :mw_display_button_for_modal_workflow, :mw_display_modal_workflow_button
|
85
|
+
|
86
|
+
def mw_text_choice_question(question:, style:, text_choices:)
|
87
|
+
raise 'Missing question' if question.blank?
|
88
|
+
raise 'Text Choices should be a hash' unless text_choices.is_a?(Hash)
|
89
|
+
validate_question_style!(style)
|
90
|
+
|
91
|
+
text_choices_a = text_choices.map{|k, v| {_class: "ORKTextChoice", exclusive: false, text: k, value: v} }.to_a
|
92
|
+
{ question: question, answerFormat: { _class: "ORKTextChoiceAnswerFormat", style: style.to_s.camelize(:lower), textChoices: text_choices_a}}
|
93
|
+
end
|
84
94
|
|
85
95
|
private
|
86
96
|
def validate_on_success!(on_success)
|
@@ -95,6 +105,10 @@ module MobileWorkflow
|
|
95
105
|
raise 'Unknown style' unless BUTTON_STYLES.include?(style)
|
96
106
|
end
|
97
107
|
|
108
|
+
def validate_question_style!(style)
|
109
|
+
raise 'Unknown style' unless QUESTION_STYLES.include?(style)
|
110
|
+
end
|
111
|
+
|
98
112
|
def preview_url(attachment, options:)
|
99
113
|
return nil unless attachment.attached?
|
100
114
|
|
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.23
|
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-04-
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|