Revision 8631a825
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/Taxzones.pm | ||
---|---|---|
27 | 27 |
|
28 | 28 |
my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); |
29 | 29 |
|
30 |
$self->setup_list_action_bar; |
|
30 | 31 |
$self->render('taxzones/list', |
31 | 32 |
title => t8('List of tax zones'), |
32 | 33 |
TAXZONES => $taxzones); |
... | ... | |
42 | 43 |
sub show_form { |
43 | 44 |
my ($self, %params) = @_; |
44 | 45 |
|
46 |
$self->setup_show_form_action_bar; |
|
45 | 47 |
$self->render('taxzones/form', %params, |
46 | 48 |
BUCHUNGSGRUPPEN => SL::DB::Manager::Buchungsgruppe->get_all_sorted); |
47 | 49 |
} |
... | ... | |
179 | 181 |
|
180 | 182 |
sub init_defaults { SL::DB::Default->get }; |
181 | 183 |
|
184 |
# |
|
185 |
# helpers |
|
186 |
# |
|
187 |
|
|
188 |
sub setup_show_form_action_bar { |
|
189 |
my ($self) = @_; |
|
190 |
|
|
191 |
my $is_new = !$self->config->id; |
|
192 |
|
|
193 |
for my $bar ($::request->layout->get('actionbar')) { |
|
194 |
$bar->add( |
|
195 |
action => [ |
|
196 |
t8('Save'), |
|
197 |
submit => [ '#form', { action => 'Taxzones/' . ($is_new ? 'create' : 'update') } ], |
|
198 |
checks => [ 'kivi.validate_form' ], |
|
199 |
accesskey => 'enter', |
|
200 |
], |
|
201 |
|
|
202 |
action => [ |
|
203 |
t8('Delete'), |
|
204 |
submit => [ '#form', { action => 'Taxzones/delete' } ], |
|
205 |
confirm => t8('Do you really want to delete this object?'), |
|
206 |
disabled => $is_new ? t8('This object has not been saved yet.') |
|
207 |
: !$self->config->orphaned ? t8('The object is in use and cannot be deleted.') |
|
208 |
: undef, |
|
209 |
], |
|
210 |
|
|
211 |
link => [ |
|
212 |
t8('Abort'), |
|
213 |
link => $self->url_for(action => 'list'), |
|
214 |
], |
|
215 |
); |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
sub setup_list_action_bar { |
|
220 |
my ($self) = @_; |
|
221 |
|
|
222 |
for my $bar ($::request->layout->get('actionbar')) { |
|
223 |
$bar->add( |
|
224 |
link => [ |
|
225 |
t8('Add'), |
|
226 |
link => $self->url_for(action => 'new'), |
|
227 |
], |
|
228 |
); |
|
229 |
} |
|
230 |
} |
|
231 |
|
|
182 | 232 |
1; |
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »Steuerzonen«