Revision d860b41d
Von Moritz Bunkus vor etwa 10 Jahren hinzugefügt
SL/Controller/RequirementSpecPredefinedText.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use parent qw(SL::Controller::Base); |
6 | 6 |
|
7 |
use List::MoreUtils qw(none); |
|
8 |
|
|
7 | 9 |
use SL::DB::RequirementSpecPredefinedText; |
8 | 10 |
use SL::Helper::Flash; |
9 | 11 |
use SL::Locale::String; |
... | ... | |
32 | 34 |
sub action_new { |
33 | 35 |
my ($self) = @_; |
34 | 36 |
|
35 |
$self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new; |
|
37 |
$self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(useable_for_text_blocks => 1);
|
|
36 | 38 |
$self->render('requirement_spec_predefined_text/form', title => t8('Create a new predefined text')); |
37 | 39 |
} |
38 | 40 |
|
... | ... | |
95 | 97 |
my $params = delete($::form->{requirement_spec_predefined_text}) || { }; |
96 | 98 |
my $title = $is_new ? t8('Create a new predefined text') : t8('Edit predefined text'); |
97 | 99 |
|
100 |
# Force presence of booleans for the useable_* flags. |
|
101 |
my @useable_flags = qw(text_blocks sections); |
|
102 |
$params->{"useable_for_${_}"} = !!$params->{"useable_for_${_}"} for @useable_flags; |
|
103 |
|
|
104 |
# Force usage for text blocks if none of the check boxes are marked. |
|
105 |
$params->{useable_for_text_blocks} = 1 if none { $params->{"useable_for_${_}"} } @useable_flags; |
|
106 |
|
|
98 | 107 |
$self->{requirement_spec_predefined_text}->assign_attributes(%{ $params }); |
99 | 108 |
|
100 | 109 |
my @errors = $self->{requirement_spec_predefined_text}->validate; |
Auch abrufbar als: Unified diff
Pflichtenhefte vordef Textblöcke: Verwaltung Flags »benutzbar für…«