From a381240cc2f3fb2f49f8c1fcc350dad5dbbbd51c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 20 Jan 2021 11:10:31 +0100 Subject: [PATCH] =?utf8?q?Mobile=20Layout:=20neue=20Layouts=20f=C3=BCr=20L?= =?utf8?q?ogin,=20Men=C3=BC,=20Stylesheet=20+=20Men=C3=BCdatei?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Menü zeigt aus Platzgründen nur Top-Level Einträge in der menu.yml an. --- SL/Layout/Dispatcher.pm | 4 +++ SL/Layout/Material.pm | 25 +++++++++++++++++ SL/Layout/MaterialMenu.pm | 16 +++++++++++ SL/Layout/MaterialStyle.pm | 24 +++++++++++++++++ SL/Layout/MobileLogin.pm | 21 +++++++++++++++ menus/mobile/00-erp.yaml | 38 ++++++++++++++++++++++++++ templates/webpages/menu/material.html | 39 +++++++++++++++++++++++++++ 7 files changed, 167 insertions(+) create mode 100644 SL/Layout/Material.pm create mode 100644 SL/Layout/MaterialMenu.pm create mode 100644 SL/Layout/MaterialStyle.pm create mode 100644 SL/Layout/MobileLogin.pm create mode 100644 menus/mobile/00-erp.yaml create mode 100644 templates/webpages/menu/material.html diff --git a/SL/Layout/Dispatcher.pm b/SL/Layout/Dispatcher.pm index fa6333762..4d0345c33 100644 --- a/SL/Layout/Dispatcher.pm +++ b/SL/Layout/Dispatcher.pm @@ -8,6 +8,8 @@ use SL::Layout::Login; use SL::Layout::Classic; use SL::Layout::V3; use SL::Layout::Javascript; +use SL::Layout::Material; +use SL::Layout::MobileLogin; sub new { my ($class, %params) = @_; @@ -18,6 +20,8 @@ sub new { return SL::Layout::Admin->new if $params{style} eq 'admin'; return SL::Layout::AdminLogin->new if $params{style} eq 'admin_login'; return SL::Layout::Login->new if $params{style} eq 'login'; + return SL::Layout::Material->new if $params{style} eq 'mobile'; + return SL::Layout::MobileLogin->new if $params{style} eq 'mobile_login'; return SL::Layout::None->new; } diff --git a/SL/Layout/Material.pm b/SL/Layout/Material.pm new file mode 100644 index 000000000..c68317206 --- /dev/null +++ b/SL/Layout/Material.pm @@ -0,0 +1,25 @@ +package SL::Layout::Material; + +use strict; +use parent qw(SL::Layout::Base); + +use SL::Layout::None; +use SL::Layout::MaterialMenu; +use SL::Layout::MaterialStyle; +use SL::Layout::Content; + +sub get_stylesheet_for_user { + # overwrite kivitendo fallback + 'css/material'; +} + +sub init_sub_layouts { + [ + SL::Layout::None->new, + SL::Layout::MaterialStyle->new, + SL::Layout::MaterialMenu->new, + SL::Layout::Content->new, + ] +} + +1; diff --git a/SL/Layout/MaterialMenu.pm b/SL/Layout/MaterialMenu.pm new file mode 100644 index 000000000..4ae4da347 --- /dev/null +++ b/SL/Layout/MaterialMenu.pm @@ -0,0 +1,16 @@ +package SL::Layout::MaterialMenu; + +use strict; +use parent qw(SL::Layout::Base); +use SL::Menu; +use SL::Controller::Base; + +sub init_menu { + SL::Menu->new('mobile'); +} + +sub pre_content { + $_[0]->presenter->render('menu/material', menu => $_[0]->menu, C => SL::Controller::Base->new); +} + +1; diff --git a/SL/Layout/MaterialStyle.pm b/SL/Layout/MaterialStyle.pm new file mode 100644 index 000000000..bb224ad7d --- /dev/null +++ b/SL/Layout/MaterialStyle.pm @@ -0,0 +1,24 @@ +package SL::Layout::MaterialStyle; + +use strict; +use parent qw(SL::Layout::Base); + +sub use_stylesheet { + "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css", + "https://fonts.googleapis.com/icon?family=Material+Icons"; +} + +sub use_javascript { + "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"; +} + +sub javascripts_inline { + "M.AutoInit();"; +} + +sub get_stylesheet_for_user { + # overwrite kivitendo fallback + 'css/material'; +} + +1; diff --git a/SL/Layout/MobileLogin.pm b/SL/Layout/MobileLogin.pm new file mode 100644 index 000000000..91a010ea3 --- /dev/null +++ b/SL/Layout/MobileLogin.pm @@ -0,0 +1,21 @@ +package SL::Layout::MobileLogin; + +use strict; +use parent qw(SL::Layout::Base); +use SL::Layout::MaterialStyle; +use SL::Layout::MaterialMenu; + +sub get_stylesheet_for_user { + # overwrite kivitendo fallback + 'css/material'; +} + +sub init_sub_layouts { + [ + SL::Layout::None->new, + SL::Layout::MaterialStyle->new, + SL::Layout::MaterialMenu->new, + ] +} + +1; diff --git a/menus/mobile/00-erp.yaml b/menus/mobile/00-erp.yaml new file mode 100644 index 000000000..ab1973309 --- /dev/null +++ b/menus/mobile/00-erp.yaml @@ -0,0 +1,38 @@ +# This is the main menu config file for mobile user space menu entries. +# +# Th structure is the same as in user/, but currently infinite nesting is not supported. +# +--- +- id: test_entry + name: Test + icon: test + order: 100 + access: customer_vendor_edit|customer_vendor_all_edit + params: + action: CustomerVendor/add + db: customer +- id: warehouse_produce_assembly + name: Produce Assembly + icon: assembly_produce + order: 200 + access: warehouse_management + module: wh.pl + params: + action: transfer_warehouse_selection + trans_type: assembly +- id: warehouse_transfer + name: Transfer + order: 300 + access: warehouse_management + module: wh.pl + params: + action: transfer_warehouse_selection + trans_type: transfer +- id: warehouse_removal + name: Removal + order: 400 + access: warehouse_management + module: wh.pl + params: + action: transfer_warehouse_selection + trans_type: removal diff --git a/templates/webpages/menu/material.html b/templates/webpages/menu/material.html new file mode 100644 index 000000000..8650cfaf3 --- /dev/null +++ b/templates/webpages/menu/material.html @@ -0,0 +1,39 @@ +[%- USE T8 %] +[%- USE L %] +[%- USE HTML %] +[%- USE LxERP -%] + + + + + +[%- BLOCK menu_items %] + [%- IF MYCONFIG.login %] +
  • [% 'User' | $T8 %]: [% MYCONFIG.login | html %]
  • + [%- ELSE %] +
  • [% L.link(C.url_for(controller='LoginScreen', action='user_login'), LxERP.t8('Login')) %]
  • + [%- END %] + +
  • + + [%- FOREACH node = menu.tree %] + [%- NEXT UNLESS node.visible %] +
  • [% L.link(menu.href_for_node(node) || '#', menu.name_for_node(node), target=node.target) %]
  • + [%- END %] + +
  • + + [%- IF MYCONFIG.login %] +
  • [% L.link(C.url_for(controller='LoginScreen', action='logout'), LxERP.t8('Logout')) %]
  • + [%- END %] +[% END %] -- 2.20.1