utilise wizard mapper to retrieve values
Dieser Commit ist enthalten in:
Ursprung
f13c04043b
Commit
2458525206
4 geänderte Dateien mit 35 neuen und 3 gelöschten Zeilen
|
@ -284,6 +284,25 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if watchCategories}}
|
{{#if watchCategories}}
|
||||||
|
<div class="setting full field-mapper-setting">
|
||||||
|
<div class="setting-label">
|
||||||
|
<label>{{i18n "admin.wizard.action.watch_categories.categories"}}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="setting-value">
|
||||||
|
{{wizard-mapper
|
||||||
|
inputs=action.categories
|
||||||
|
property='categories'
|
||||||
|
onUpdate=(action 'mappedFieldUpdated')
|
||||||
|
options=(hash
|
||||||
|
textSelection='key,value'
|
||||||
|
wizardFieldSelection=true
|
||||||
|
userFieldSelection='key,value'
|
||||||
|
context='action'
|
||||||
|
)}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.watch_categories.mute_remainder"}}</label>
|
<label>{{i18n "admin.wizard.action.watch_categories.mute_remainder"}}</label>
|
||||||
|
|
|
@ -211,6 +211,7 @@ en:
|
||||||
watch_categories:
|
watch_categories:
|
||||||
label: "Watch Categories"
|
label: "Watch Categories"
|
||||||
mute_remainder: "Mute Remainder"
|
mute_remainder: "Mute Remainder"
|
||||||
|
categories: "Categories"
|
||||||
post_builder:
|
post_builder:
|
||||||
checkbox: "Post Builder"
|
checkbox: "Post Builder"
|
||||||
label: "Builder"
|
label: "Builder"
|
||||||
|
|
|
@ -122,6 +122,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||||
custom_fields: mapped_params,
|
custom_fields: mapped_params,
|
||||||
required: mapped_params,
|
required: mapped_params,
|
||||||
recipient: mapped_params,
|
recipient: mapped_params,
|
||||||
|
categories: mapped_params,
|
||||||
mute_remainder: mapped_params,
|
mute_remainder: mapped_params,
|
||||||
profile_updates: mapped_params,
|
profile_updates: mapped_params,
|
||||||
group: mapped_params,
|
group: mapped_params,
|
||||||
|
|
|
@ -134,10 +134,21 @@ class CustomWizard::Action
|
||||||
end
|
end
|
||||||
|
|
||||||
def watch_categories
|
def watch_categories
|
||||||
key, watched_categories = data.first
|
|
||||||
mute_remainder = data.values[1]
|
watched_categories_map = CustomWizard::Mapper.new(
|
||||||
|
inputs: action['categories'],
|
||||||
|
data: data,
|
||||||
|
user: user
|
||||||
|
).perform
|
||||||
|
|
||||||
|
mute_remainder = CustomWizard::Mapper.new(
|
||||||
|
inputs: action['mute_remainder'],
|
||||||
|
data: data,
|
||||||
|
user: user
|
||||||
|
).perform
|
||||||
|
|
||||||
Category.all.each do |category|
|
Category.all.each do |category|
|
||||||
if watched_categories.include?(category.id.to_s)
|
if watched_categories_map.include?(category.id.to_s)
|
||||||
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:watching], category.id)
|
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:watching], category.id)
|
||||||
elsif mute_remainder
|
elsif mute_remainder
|
||||||
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:muted], category.id)
|
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:muted], category.id)
|
||||||
|
|
Laden …
In neuem Issue referenzieren