Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5bb638dd

Von Sven Schöling vor mehr als 3 Jahren hinzugefügt

  • ID 5bb638dd79c3e6f4df61a2ad7e5f80d172d52002
  • Vorgänger addf5dbb
  • Nachfolger 36ac2ac4

Mobile Layout: neue Layouts für Login, Menü, Stylesheet + Menüdatei

Unterschiede anzeigen:

SL/Layout/Dispatcher.pm
8 8
use SL::Layout::Classic;
9 9
use SL::Layout::V3;
10 10
use SL::Layout::Javascript;
11
use SL::Layout::Material;
12
use SL::Layout::MobileLogin;
11 13

  
12 14
sub new {
13 15
  my ($class, %params) = @_;
......
18 20
  return SL::Layout::Admin->new      if $params{style} eq 'admin';
19 21
  return SL::Layout::AdminLogin->new if $params{style} eq 'admin_login';
20 22
  return SL::Layout::Login->new      if $params{style} eq 'login';
23
  return SL::Layout::Material->new   if $params{style} eq 'mobile';
24
  return SL::Layout::MobileLogin->new if $params{style} eq 'mobile_login';
21 25
  return SL::Layout::None->new;
22 26
}
23 27

  
SL/Layout/Material.pm
1
package SL::Layout::Material;
2

  
3
use strict;
4
use parent qw(SL::Layout::Base);
5

  
6
use SL::Layout::None;
7
use SL::Layout::MaterialMenu;
8
use SL::Layout::MaterialStyle;
9
use SL::Layout::Content;
10

  
11
sub get_stylesheet_for_user {
12
  # overwrite kivitendo fallback
13
  'css/material';
14
}
15

  
16
sub init_sub_layouts {
17
  [
18
    SL::Layout::None->new,
19
    SL::Layout::MaterialStyle->new,
20
    SL::Layout::MaterialMenu->new,
21
    SL::Layout::Content->new,
22
  ]
23
}
24

  
25
1;
SL/Layout/MaterialMenu.pm
1
package SL::Layout::MaterialMenu;
2

  
3
use strict;
4
use parent qw(SL::Layout::Base);
5
use SL::Menu;
6

  
7
sub init_menu {
8
  SL::Menu->new('mobile');
9
}
10

  
11
sub javascripts_inline {
12
<<'EOL';
13
  document.addEventListener('DOMContentLoaded', function() {
14
    var elems = document.querySelectorAll('.sidenav');
15
    var instances = M.Sidenav.init(elems);
16
  });
17
EOL
18
}
19

  
20
sub pre_content {
21
  $_[0]->presenter->render('menu/material', menu => $_[0]->menu);
22
}
23

  
24
1;
SL/Layout/MaterialStyle.pm
1
package SL::Layout::MaterialStyle;
2

  
3
use strict;
4
use parent qw(SL::Layout::Base);
5

  
6
sub use_stylesheet {
7
  "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css",
8
  "https://fonts.googleapis.com/icon?family=Material+Icons";
9
}
10

  
11
sub use_javascript {
12
  "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js";
13
}
14

  
15
sub javascripts_inline {
16
<<'EOL';
17
  document.addEventListener('DOMContentLoaded', function() {
18
    var elems = document.querySelectorAll('select');
19
    var instances = M.FormSelect.init(elems);
20
  });
21
EOL
22
}
23

  
24
sub get_stylesheet_for_user {
25
  # overwrite kivitendo fallback
26
  'css/material';
27
}
28

  
29
1;
SL/Layout/MobileLogin.pm
1
package SL::Layout::MobileLogin;
2

  
3
use strict;
4
use parent qw(SL::Layout::Base);
5
use SL::Layout::MaterialStyle;
6
use SL::Layout::MaterialMenu;
7

  
8
sub start_content {
9
  "<div id='login' class='login'>\n";
10
}
11

  
12
sub end_content {
13
  "</div>\n";
14
}
15

  
16
sub get_stylesheet_for_user {
17
  # overwrite kivitendo fallback
18
  'css/material';
19
}
20

  
21
sub init_sub_layouts {
22
  [
23
    SL::Layout::MaterialStyle->new,
24
    SL::Layout::MaterialMenu->new,
25
  ]
26
}
27

  
28
1;
menus/mobile/00-erp.yaml
1
# This is the main menu config file for mobile user space menu entries.
2
#
3
# Th structure is the same as in user/, but currently infinite nesting is not supported.
4
#
5
---
6
- id: test_entry
7
  name: Test
8
  icon: test
9
  order: 100
10
  access: customer_vendor_edit|customer_vendor_all_edit
11
  params:
12
    action: CustomerVendor/add
13
    db: customer
14
- id: warehouse_produce_assembly
15
  name: Produce Assembly
16
  icon: assembly_produce
17
  order: 200
18
  access: warehouse_management
19
  module: wh.pl
20
  params:
21
    action: transfer_warehouse_selection
22
    trans_type: assembly
23
- id: warehouse_transfer
24
  name: Transfer
25
  order: 300
26
  access: warehouse_management
27
  module: wh.pl
28
  params:
29
    action: transfer_warehouse_selection
30
    trans_type: transfer
31
- id: warehouse_removal
32
  name: Removal
33
  order: 400
34
  access: warehouse_management
35
  module: wh.pl
36
  params:
37
    action: transfer_warehouse_selection
38
    trans_type: removal
templates/webpages/menu/material.html
1
[%- USE T8 %]
2
[%- USE L %]
3
[%- USE HTML %]
4
[%- USE LxERP -%]
5
<nav>
6
  <div class="nav-wrapper">
7
    <a class="brand-logo">Kivitendo</a>
8
    <a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
9
    <ul id="nav" class="right hide-on-med-and-down">
10
      [%- FOREACH node = menu.tree %]
11
        [%- NEXT UNLESS node.visible %]
12
        <li>[% L.link(menu.href_for_node(node) || '#', menu.name_for_node(node), target=node.target) %]</li>
13
      [%- END %]
14
    </ul>
15
  </div>
16
</nav>
17

  
18
<ul id="nav-mobile" class="sidenav">
19
  [%- FOREACH node = menu.tree %]
20
    [%- NEXT UNLESS node.visible %]
21
    <li>[% L.link(menu.href_for_node(node) || '#', menu.name_for_node(node), target=node.target) %]</li>
22
  [%- END %]
23
</ul>

Auch abrufbar als: Unified diff