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

add skip_redirect for actions

Dieser Commit ist enthalten in:
Angus McLeod 2018-09-18 11:56:42 +10:00
Ursprung a1f4d6fdf9
Commit b78c2f0c0f
3 geänderte Dateien mit 29 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -102,6 +102,16 @@
</div> </div>
{{/if}} {{/if}}
<div class="setting">
<div class="setting-label">
<h3>{{i18n "admin.wizard.action.skip_redirect.label"}}</h3>
</div>
<div class="setting-value">
{{input type='checkbox' checked=action.skip_redirect}}
<span>{{i18n 'admin.wizard.action.skip_redirect.description' type='topic'}}</span>
</div>
</div>
<div class="setting full"> <div class="setting full">
<label>{{i18n 'admin.wizard.action.add_fields' type='Topic'}}</label> <label>{{i18n 'admin.wizard.action.add_fields' type='Topic'}}</label>
{{wizard-custom-inputs inputs=action.add_fields {{wizard-custom-inputs inputs=action.add_fields
@ -165,6 +175,16 @@
</div> </div>
</div> </div>
<div class="setting">
<div class="setting-label">
<h3>{{i18n "admin.wizard.action.skip_redirect.label"}}</h3>
</div>
<div class="setting-value">
{{input type='checkbox' checked=action.skip_redirect}}
<span>{{i18n 'admin.wizard.action.skip_redirect.description' type='message'}}</span>
</div>
</div>
<div class="setting full"> <div class="setting full">
<label>{{i18n "admin.wizard.action.add_fields" type='Message'}}</label> <label>{{i18n "admin.wizard.action.add_fields" type='Message'}}</label>
{{wizard-custom-inputs inputs=action.add_fields {{wizard-custom-inputs inputs=action.add_fields

Datei anzeigen

@ -102,6 +102,9 @@ en:
add_fields: "{{type}} Fields" add_fields: "{{type}} Fields"
available_fields: "* If 'Save wizard submissions' is disabled, only the fields of the current step are available to the current step's actions." available_fields: "* If 'Save wizard submissions' is disabled, only the fields of the current step are available to the current step's actions."
topic_attr: "Topic Attribute" topic_attr: "Topic Attribute"
skip_redirect:
label: "Skip Redirect"
description: "Don't redirect the user to this {{type}} after the wizard completes"
send_message: send_message:
label: "Send Message" label: "Send Message"
recipient: "Recipient" recipient: "Recipient"

Datei anzeigen

@ -325,10 +325,12 @@ class CustomWizard::Builder
post.topic.save_custom_fields(true) post.topic.save_custom_fields(true)
end end
unless action['skip_redirect']
data['redirect_to'] = post.topic.url data['redirect_to'] = post.topic.url
end end
end end
end end
end
def send_message(user, action, data) def send_message(user, action, data)
title = data[action['title']] title = data[action['title']]
@ -352,10 +354,12 @@ class CustomWizard::Builder
if creator.errors.present? if creator.errors.present?
updater.errors.add(:send_message, creator.errors.full_messages.join(" ")) updater.errors.add(:send_message, creator.errors.full_messages.join(" "))
else else
unless action['skip_redirect']
data['redirect_to'] = post.topic.url data['redirect_to'] = post.topic.url
end end
end end
end end
end
def update_profile(user, action, data) def update_profile(user, action, data)
return unless action['profile_updates'].length return unless action['profile_updates'].length