|
|
|
|
@ -181,6 +181,7 @@ sub create_preference_form {
|
|
|
|
|
enums => $enums,
|
|
|
|
|
rwrs_rs => $c->stash->{rwr_sets_rs},
|
|
|
|
|
ncos_rs => $c->stash->{ncos_levels_rs},
|
|
|
|
|
sound_rs => $c->stash->{sound_sets_rs},
|
|
|
|
|
}],
|
|
|
|
|
});
|
|
|
|
|
$form->create_structure([$c->stash->{preference_meta}->attribute]);
|
|
|
|
|
@ -228,6 +229,24 @@ sub create_preference_form {
|
|
|
|
|
$preference->create({ value => $selected_level->id });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$c->flash(messages => [{type => 'success', text => "Preference $attribute successfully updated."}]);
|
|
|
|
|
$c->response->redirect($base_uri);
|
|
|
|
|
return;
|
|
|
|
|
} elsif ($attribute eq "sound_set") {
|
|
|
|
|
my $selected_set = $c->stash->{sound_sets_rs}->find(
|
|
|
|
|
$form->field($attribute)->value
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
my $preference = $pref_rs->search({
|
|
|
|
|
attribute_id => $c->stash->{preference_meta}->id });
|
|
|
|
|
if(!defined $selected_set) {
|
|
|
|
|
$preference->first->delete if $preference->first;
|
|
|
|
|
} elsif($preference->first) {
|
|
|
|
|
$preference->first->update({ value => $selected_set->id });
|
|
|
|
|
} else {
|
|
|
|
|
$preference->create({ value => $selected_set->id });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$c->flash(messages => [{type => 'success', text => "Preference $attribute successfully updated."}]);
|
|
|
|
|
$c->response->redirect($base_uri);
|
|
|
|
|
return;
|
|
|
|
|
@ -384,6 +403,14 @@ be set.
|
|
|
|
|
|
|
|
|
|
The updated preferences are called ncos_id and adm_ncos_id.
|
|
|
|
|
|
|
|
|
|
=head3 Special case sound_set
|
|
|
|
|
|
|
|
|
|
This is also similar to rewrite_rule_set and ncos. The stashed variables are
|
|
|
|
|
sound_sets_rs and sound_sets. In the template helper.sound_sets needs to
|
|
|
|
|
be set.
|
|
|
|
|
|
|
|
|
|
The preference with the attribute sound_set will contain the id of a sound_set.
|
|
|
|
|
|
|
|
|
|
=head2 _set_rewrite_preferences
|
|
|
|
|
|
|
|
|
|
See "Special case rewrite_rule_set".
|
|
|
|
|
|