@saltcorn/mobile-app 0.8.1-beta.4 → 0.8.1-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/www/js/routes/common.js +21 -7
package/package.json
CHANGED
package/www/js/routes/common.js
CHANGED
|
@@ -32,21 +32,31 @@ const sbAdmin2Layout = () => {
|
|
|
32
32
|
return saltcorn.data.state.getState().layouts["sbadmin2"];
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const getMenu = () => {
|
|
35
|
+
const getMenu = (req) => {
|
|
36
36
|
const state = saltcorn.data.state.getState();
|
|
37
|
-
const allowSignup = state.getConfig("allow_signup");
|
|
38
37
|
const mobileCfg = saltcorn.data.state.getState().mobileConfig;
|
|
38
|
+
const role = mobileCfg.role_id || 10;
|
|
39
|
+
const extraMenu = saltcorn.data.web_mobile_commons.get_extra_menu(
|
|
40
|
+
role,
|
|
41
|
+
req.__
|
|
42
|
+
);
|
|
43
|
+
const allowSignup = state.getConfig("allow_signup");
|
|
39
44
|
const userName = mobileCfg.user_name;
|
|
40
45
|
const authItems = mobileCfg.isPublicUser
|
|
41
46
|
? [
|
|
42
|
-
{ link: "javascript:execLink('/auth/login')", label: "Login" },
|
|
47
|
+
{ link: "javascript:execLink('/auth/login')", label: req.__("Login") },
|
|
43
48
|
...(allowSignup
|
|
44
|
-
? [
|
|
49
|
+
? [
|
|
50
|
+
{
|
|
51
|
+
link: "javascript:execLink('/auth/signup')",
|
|
52
|
+
label: req.__("Sign up"),
|
|
53
|
+
},
|
|
54
|
+
]
|
|
45
55
|
: []),
|
|
46
56
|
]
|
|
47
57
|
: [
|
|
48
58
|
{
|
|
49
|
-
label: "User",
|
|
59
|
+
label: req.__("User"),
|
|
50
60
|
icon: "far fa-user",
|
|
51
61
|
isUser: true,
|
|
52
62
|
subitems: [
|
|
@@ -61,8 +71,12 @@ const getMenu = () => {
|
|
|
61
71
|
];
|
|
62
72
|
|
|
63
73
|
return [
|
|
74
|
+
extraMenu.length > 0 && {
|
|
75
|
+
section: req.__("Menu"),
|
|
76
|
+
items: extraMenu,
|
|
77
|
+
},
|
|
64
78
|
{
|
|
65
|
-
section: "User",
|
|
79
|
+
section: req.__("User"),
|
|
66
80
|
isUser: true,
|
|
67
81
|
items: authItems,
|
|
68
82
|
},
|
|
@@ -81,7 +95,7 @@ const wrapContents = (contents, title, context, req) => {
|
|
|
81
95
|
body: { above: [contents] },
|
|
82
96
|
alerts: prepareAlerts(context, req),
|
|
83
97
|
role: state.mobileConfig.role_id,
|
|
84
|
-
menu: getMenu(),
|
|
98
|
+
menu: getMenu(req),
|
|
85
99
|
headers: getHeaders(),
|
|
86
100
|
brand: { name: "Saltcorn" },
|
|
87
101
|
bodyClass: "",
|