Revision 20e24a4a
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/DeliveryTerm.pm | ||
---|---|---|
use SL::DB::DeliveryTerm;
|
||
use SL::DB::Language;
|
||
use SL::Helper::Flash;
|
||
use SL::Locale::String qw(t8);
|
||
|
||
use Rose::Object::MakeMethods::Generic
|
||
(
|
||
... | ... | |
sub action_list {
|
||
my ($self) = @_;
|
||
|
||
$self->setup_list_action_bar;
|
||
$self->render('delivery_term/list',
|
||
title => $::locale->text('Delivery terms'),
|
||
DELIVERY_TERMS => SL::DB::Manager::DeliveryTerm->get_all_sorted);
|
||
... | ... | |
my ($self) = @_;
|
||
|
||
$self->{delivery_term} = SL::DB::DeliveryTerm->new;
|
||
$self->setup_form_action_bar;
|
||
$self->render('delivery_term/form', title => $::locale->text('Create a new delivery term'));
|
||
}
|
||
|
||
sub action_edit {
|
||
my ($self) = @_;
|
||
$self->setup_form_action_bar;
|
||
$self->render('delivery_term/form', title => $::locale->text('Edit delivery term'));
|
||
}
|
||
|
||
... | ... | |
$self->{languages} = SL::DB::Manager::Language->get_all_sorted;
|
||
}
|
||
|
||
sub setup_list_action_bar {
|
||
my ($self) = @_;
|
||
|
||
for my $bar ($::request->layout->get('actionbar')) {
|
||
$bar->add(
|
||
link => [
|
||
t8('Add'),
|
||
link => $self->url_for(action => 'new'),
|
||
],
|
||
);
|
||
}
|
||
}
|
||
|
||
sub setup_form_action_bar {
|
||
my ($self) = @_;
|
||
|
||
my $is_new = !$self->delivery_term->id;
|
||
|
||
for my $bar ($::request->layout->get('actionbar')) {
|
||
$bar->add(
|
||
action => [
|
||
t8('Save'),
|
||
submit => [ '#form', { action => 'DeliveryTerm/' . ($is_new ? 'create' : 'update') } ],
|
||
checks => [ 'kivi.validate_form' ],
|
||
accesskey => 'enter',
|
||
],
|
||
|
||
action => [
|
||
t8('Delete'),
|
||
submit => [ '#form', { action => 'DeliveryTerm/destroy' } ],
|
||
confirm => t8('Do you really want to delete this object?'),
|
||
disabled => $is_new ? t8('This object has not been saved yet.') : undef,
|
||
],
|
||
|
||
'separator',
|
||
|
||
link => [
|
||
t8('Abort'),
|
||
link => $self->url_for(action => 'list'),
|
||
],
|
||
);
|
||
}
|
||
}
|
||
|
||
1;
|
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »System« → »Lieferbedingungen«