Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c4f90397

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID c4f903975358f75bd6314c2cc5a1b41b4b2a5fa7
  • Vorgänger 70173b77
  • Nachfolger 6f1da6d4

ActionBar: bei Click auf Combo ohne oberste Action Menü aufklappen

Manche Comboboxes wie z.B. »Workflow« oder »mehr« haben auf dem obersten
Button keine Action konfiguriert (weder »submit« noch »call«). Um die
Benutzer nicht zu sehr zu verwirren, werden diese nun nicht mehr als
deaktiviert dargestellt. Bei einem Klick auf den Button-Teil der
Combobox wird dann das Menü aufgeklappt, genau so, als hätte man auf den
Pfeil-Teil geklickt.

Unterschiede anzeigen:

bin/mozilla/ir.pl
267 267
    $bar->add_actions('separator');
268 268

  
269 269
    $bar->add_actions('combobox');
270
    $bar->actions->[-1]->add_actions([ t8('more'),
271
      disabled => 1,
272
    ]);
270
    $bar->actions->[-1]->add_actions([ t8('more') ]);
273 271
    $bar->actions->[-1]->add_actions([ t8('History'),
274 272
      call     => [ 'set_history_window', $::form->{id} * 1, 'id', 'glid' ],
275 273
      disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
bin/mozilla/is.pl
309 309
    $bar->add_actions('separator');
310 310

  
311 311
    $bar->add_actions('combobox');
312
    $bar->actions->[-1]->add_actions([ t8('Workflow'),
313
      disabled => 1,
314
    ]);
312
    $bar->actions->[-1]->add_actions([ t8('Workflow') ]);
315 313
    $bar->actions->[-1]->add_actions([ t8('Use As New'),
316 314
      submit   => [ '#form', { action_use_as_new    => 1 } ],
317 315
      disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
......
329 327
    ]);
330 328

  
331 329
    $bar->add_actions('combobox');
332
    $bar->actions->[-1]->add_actions([ t8('Export'),
333
      disabled => 1,
334
    ]);
330
    $bar->actions->[-1]->add_actions([ t8('Export') ]);
335 331
    $bar->actions->[-1]->add_actions([ ($form->{id} ? t8('Print') : t8('Preview')),
336 332
      submit   => [ '#form', { action_print => 1 } ],
337 333
      checks   => [ @req_trans_desc ],
......
343 339
      disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
344 340
    ]);
345 341
    $bar->add_actions('combobox');
346
    $bar->actions->[-1]->add_actions([ t8('more'),
347
      disabled => 1,
348
    ]);
342
    $bar->actions->[-1]->add_actions([ t8('more') ]);
349 343
    $bar->actions->[-1]->add_actions([ t8('History'),
350 344
      call     => [ 'set_history_window', $form->{id} * 1, 'id' ],
351 345
      disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
bin/mozilla/oe.pl
352 352
    $bar->add_actions('separator');
353 353

  
354 354
    $bar->add_actions('combobox');
355
    $bar->actions->[-1]->add_actions([ t8('Workflow'),
356
      disabled => 1,
357
    ]);
355
    $bar->actions->[-1]->add_actions([ t8('Workflow') ]);
358 356
    $bar->actions->[-1]->add_actions([ t8('Sales Order'),
359 357
      submit   => [ '#form', { action_sales_order => 1 } ],
360 358
      disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
......
381 379
    ]);
382 380

  
383 381
    $bar->add_actions('combobox');
384
    $bar->actions->[-1]->add_actions([ t8('Export'),
385
      disabled => 1,
386
    ]);
382
    $bar->actions->[-1]->add_actions([ t8('Export') ]);
387 383
    $bar->actions->[-1]->add_actions([ t8('Print'),
388 384
      submit => [ '#form', { action_print => 1 } ],
389 385
      checks => [ @req_trans_desc ],
......
393 389
      checks => [ @req_trans_desc ],
394 390
    ]);
395 391
    $bar->add_actions('combobox');
396
    $bar->actions->[-1]->add_actions([ t8('more'),
397
      disabled => 1,
398
    ]);
392
    $bar->actions->[-1]->add_actions([ t8('more') ]);
399 393
    $bar->actions->[-1]->add_actions([ t8('History'),
400 394
      call     => [ 'set_history_window', $form->{id} * 1, 'id' ],
401 395
      disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
js/kivi.ActionBar.js
10 10
  };
11 11

  
12 12
  k.ActionBarCombobox = function(e) {
13
    this.combobox = e;
14
    this.head     = e.childNodes[0];
15
    this.toggle   = this.head.childNodes[1];
16
    this.list     = e.childNodes[0];
13
    this.combobox  = e;
14
    this.head      = e.childNodes[0];
15
    this.topAction = this.head.childNodes[0];
16
    this.toggle    = this.head.childNodes[1];
17
    this.list      = e.childNodes[0];
17 18
    this.init();
18 19
  };
19 20

  
20 21
  k.ActionBarCombobox.prototype = {
21 22
    init: function() {
22
      var obj = this;
23
      $(obj.toggle).on('click', function(event){
23
      var obj     = this;
24
      var toggler = function(event){
24 25
        $('div.' + CLASSES.combobox + '[id!=' + obj.combobox.id + ']').removeClass(CLASSES.active);
25 26
        $(obj.combobox).toggleClass(CLASSES.active);
26 27
        event.stopPropagation();
27
      });
28
      };
29

  
30
      $(obj.toggle).on('click', toggler);
31

  
32
      var data = $(this.topAction).data('action') || {};
33
      if (!data.call && !data.submit)
34
        $(this.topAction).on('click', toggler);
28 35
    }
29 36
  };
30 37

  

Auch abrufbar als: Unified diff