0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00

Add conditionality to route_to url

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-29 11:47:08 +10:00
Ursprung 2844a75f30
Commit 857a159d0c
4 geänderte Dateien mit 27 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -157,7 +157,8 @@ const action = {
'required',
'recipient',
'profile_updates',
'group'
'group',
'url'
],
advanced: [
'code',

Datei anzeigen

@ -267,7 +267,18 @@
</div>
<div class="setting-value">
{{input value=action.url}}
{{wizard-mapper
inputs=action.url
property='url'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
context='action'
wizardFieldSelection=true
userFieldSelection='key,value'
groupSelection='key,value'
categorySelection='key,value'
userSelection='key,value'
)}}
</div>
</div>
{{/if}}

Datei anzeigen

@ -113,7 +113,6 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
:type,
:code,
:skip_redirect,
:url,
:post,
:post_builder,
:post_template,
@ -124,7 +123,8 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
required: mapped_params,
recipient: mapped_params,
profile_updates: mapped_params,
group: mapped_params
group: mapped_params,
url: mapped_params
]
)
end

Datei anzeigen

@ -221,7 +221,17 @@ class CustomWizard::Action
end
def route_to
url = mapper.interpolate(action['url'])
return unless (url_input = action['url']).present?
if url_input.is_a?(String)
url = mapper.interpolate(url_input)
else
url = CustomWizard::Mapper.new(
inputs: url_input,
data: data,
user: user
).perform
end
if action['code']
data[action['code']] = SecureRandom.hex(8)