Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 032e3094

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 032e3094aedff7d72652a4caf4fc1a1db9f3ad64
  • Vorgänger 97c075f9
  • Nachfolger 20e24a4a

ActionBar: Verwendung bei »System« → »Zahlungsbedingungen«

Unterschiede anzeigen:

SL/Controller/PaymentTerm.pm
7 7
use SL::DB::PaymentTerm;
8 8
use SL::DB::Language;
9 9
use SL::Helper::Flash;
10
use SL::Locale::String qw(t8);
10 11

  
11 12
use Rose::Object::MakeMethods::Generic
12 13
(
......
25 26
sub action_list {
26 27
  my ($self) = @_;
27 28

  
29
  $self->setup_list_action_bar;
28 30
  $self->render('payment_term/list',
29 31
                title         => $::locale->text('Payment terms'),
30 32
                PAYMENT_TERMS => SL::DB::Manager::PaymentTerm->get_all_sorted);
......
34 36
  my ($self) = @_;
35 37

  
36 38
  $self->{payment_term} = SL::DB::PaymentTerm->new(auto_calculation => 1);
39
  $self->setup_form_action_bar;
37 40
  $self->render('payment_term/form', title => $::locale->text('Create a new payment term'));
38 41
}
39 42

  
40 43
sub action_edit {
41 44
  my ($self) = @_;
42 45

  
46
  $self->setup_form_action_bar;
43 47
  $self->render('payment_term/form', title => $::locale->text('Edit payment term'));
44 48
}
45 49

  
......
127 131
  $self->{languages} = SL::DB::Manager::Language->get_all_sorted;
128 132
}
129 133

  
134
sub setup_list_action_bar {
135
  my ($self) = @_;
136

  
137
  for my $bar ($::request->layout->get('actionbar')) {
138
    $bar->add(
139
      link => [
140
        t8('Add'),
141
        link => $self->url_for(action => 'new'),
142
      ],
143
    );
144
  }
145
}
146

  
147
sub setup_form_action_bar {
148
  my ($self) = @_;
149

  
150
  my $is_new = !$self->payment_term->id;
151

  
152
  for my $bar ($::request->layout->get('actionbar')) {
153
    $bar->add(
154
      action => [
155
        t8('Save'),
156
        submit    => [ '#form', { action => 'PaymentTerm/' . ($is_new ? 'create' : 'update') } ],
157
        checks    => [ 'kivi.validate_form' ],
158
        accesskey => 'enter',
159
      ],
160

  
161
      action => [
162
        t8('Delete'),
163
        submit   => [ '#form', { action => 'PaymentTerm/destroy' } ],
164
        confirm  => t8('Do you really want to delete this object?'),
165
        disabled => $is_new ? t8('This object has not been saved yet.') : undef,
166
      ],
167

  
168
      'separator',
169

  
170
      link => [
171
        t8('Abort'),
172
        link => $self->url_for(action => 'list'),
173
      ],
174
    );
175
  }
176
}
177

  
130 178
1;

Auch abrufbar als: Unified diff