Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 942ce912

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 942ce912a7551ef0756ba1b737b72f8756469730
  • Vorgänger 20e24a4a
  • Nachfolger 32066492

ActionBar: Verwendung bei »System« → »Benutzerdefinierte Variablen«

Unterschiede anzeigen:

SL/Controller/CustomVariableConfig.pm
46 46

  
47 47
  my $configs = SL::DB::Manager::CustomVariableConfig->get_all_sorted(where => [ module => $self->module ]);
48 48

  
49
  $self->setup_list_action_bar;
49 50
  $::form->header;
50 51
  $self->render('custom_variable_config/list',
51 52
                title   => t8('List of custom variables'),
......
70 71
  $params{all_partsgroups} = SL::DB::Manager::PartsGroup->get_all();
71 72

  
72 73
  $::request->layout->use_javascript("${_}.js") for qw(jquery.selectboxes jquery.multiselect2side);
74
  $self->setup_form_action_bar;
73 75
  $self->render('custom_variable_config/form', %params);
74 76
}
75 77

  
......
226 228
  }
227 229
}
228 230

  
231
sub setup_list_action_bar {
232
  my ($self) = @_;
233

  
234
  for my $bar ($::request->layout->get('actionbar')) {
235
    $bar->add(
236
      action => [
237
        t8('Add'),
238
        link => $self->url_for(action => 'new', module => $self->module),
239
      ],
240
    );
241
  }
242
}
243

  
244
sub setup_form_action_bar {
245
  my ($self) = @_;
246

  
247
  my $is_new = !$self->config->id;
248

  
249
  for my $bar ($::request->layout->get('actionbar')) {
250
    $bar->add(
251
      combobox => [
252
        action => [
253
          t8('Save'),
254
          submit    => [ '#form', { action => 'CustomVariableConfig/' . ($is_new ? 'create' : 'update') } ],
255
          checks    => [ 'check_prerequisites' ],
256
          accesskey => 'enter',
257
        ],
258

  
259
        action => [
260
          t8('Save as new'),
261
          submit => [ '#form', { action => 'CustomVariableConfig/create'} ],
262
          checks => [ 'check_prerequisites' ],
263
          not_if => $is_new,
264
        ],
265
      ], # end of combobox "Save"
266

  
267
      action => [
268
        t8('Delete'),
269
        submit   => [ '#form', { action => 'CustomVariableConfig/destroy' } ],
270
        confirm  => t8('Do you really want to delete this object?'),
271
        disabled => $is_new ? t8('This object has not been saved yet.') : undef,
272
      ],
273

  
274
      'separator',
275

  
276
      link => [
277
        t8('Abort'),
278
        link => $self->url_for(action => 'list', module => $self->module),
279
      ],
280
    );
281
  }
282
}
283

  
229 284
1;
templates/webpages/custom_variable_config/form.html
1 1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]<h1>[% HTML.escape(title) %]</h1>
2 2

  
3
<form action="controller.pl" method="post">
3
<form action="controller.pl" method="post" id="form">
4 4
 [%- L.hidden_tag("id", SELF.config.id) %]
5 5

  
6 6
 <p>
......
100 100
  </table>
101 101
 </p>
102 102

  
103
 <p>
104
  [% L.hidden_tag("action", "CustomVariableConfig/dispatch") %]
105
  [% L.submit_tag("action_" _  (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
106
  [%- IF SELF.config.id %]
107
   [% L.submit_tag("action_create", LxERP.t8('Save as new'), onclick="return check_prerequisites();") %]
108
   [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure?')) %]
109
  [%- END %]
110
  <a href="[% SELF.url_for(action='list', module=SELF.module) %]">[%- LxERP.t8("Cancel") %]</a>
111
 </p>
112

  
113 103
 <hr>
114 104

  
115 105
 <h3>[% 'Annotations' | $T8 %]</h3>
templates/webpages/custom_variable_config/list.html
55 55
 </table>
56 56
</p>
57 57

  
58
<hr height="3">
59

  
60
<p>
61
 <a href="[% SELF.url_for(action='new', module=SELF.module) %]">[%- 'Add' | $T8 %]</a>
62
</p>
63

  
64 58
[% L.sortable_element('#cvarcfg_list tbody', url=SELF.url_for(action='reorder'), with='cvarcfg_id', params='"&module=" + encodeURIComponent($("#module").val())') %]
65 59

  
66 60
<script type="text/javascript">

Auch abrufbar als: Unified diff