Revision a381240c
Von Sven Schöling vor mehr als 3 Jahren hinzugefügt
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 |
use SL::Controller::Base; |
|
7 |
|
|
8 |
sub init_menu { |
|
9 |
SL::Menu->new('mobile'); |
|
10 |
} |
|
11 |
|
|
12 |
sub pre_content { |
|
13 |
$_[0]->presenter->render('menu/material', menu => $_[0]->menu, C => SL::Controller::Base->new); |
|
14 |
} |
|
15 |
|
|
16 |
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 |
"M.AutoInit();"; |
|
17 |
} |
|
18 |
|
|
19 |
sub get_stylesheet_for_user { |
|
20 |
# overwrite kivitendo fallback |
|
21 |
'css/material'; |
|
22 |
} |
|
23 |
|
|
24 |
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 get_stylesheet_for_user { |
|
9 |
# overwrite kivitendo fallback |
|
10 |
'css/material'; |
|
11 |
} |
|
12 |
|
|
13 |
sub init_sub_layouts { |
|
14 |
[ |
|
15 |
SL::Layout::None->new, |
|
16 |
SL::Layout::MaterialStyle->new, |
|
17 |
SL::Layout::MaterialMenu->new, |
|
18 |
] |
|
19 |
} |
|
20 |
|
|
21 |
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 |
[% PROCESS menu_items %] |
|
11 |
</ul> |
|
12 |
</div> |
|
13 |
</nav> |
|
14 |
|
|
15 |
<ul id="nav-mobile" class="sidenav"> |
|
16 |
[% PROCESS menu_items %] |
|
17 |
</ul> |
|
18 |
|
|
19 |
|
|
20 |
[%- BLOCK menu_items %] |
|
21 |
[%- IF MYCONFIG.login %] |
|
22 |
<li><a>[% 'User' | $T8 %]: [% MYCONFIG.login | html %]</a></li> |
|
23 |
[%- ELSE %] |
|
24 |
<li>[% L.link(C.url_for(controller='LoginScreen', action='user_login'), LxERP.t8('Login')) %]</li> |
|
25 |
[%- END %] |
|
26 |
|
|
27 |
<li><div class="divider"></div></li> |
|
28 |
|
|
29 |
[%- FOREACH node = menu.tree %] |
|
30 |
[%- NEXT UNLESS node.visible %] |
|
31 |
<li>[% L.link(menu.href_for_node(node) || '#', menu.name_for_node(node), target=node.target) %]</li> |
|
32 |
[%- END %] |
|
33 |
|
|
34 |
<li><div class="divider"></div></li> |
|
35 |
|
|
36 |
[%- IF MYCONFIG.login %] |
|
37 |
<li>[% L.link(C.url_for(controller='LoginScreen', action='logout'), LxERP.t8('Logout')) %]</li> |
|
38 |
[%- END %] |
|
39 |
[% END %] |
Auch abrufbar als: Unified diff
Mobile Layout: neue Layouts für Login, Menü, Stylesheet + Menüdatei
Menü zeigt aus Platzgründen nur Top-Level Einträge in der menu.yml an.