@saltcorn/sbadmin2 0.7.3 → 0.7.4-beta.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.
Files changed (2) hide show
  1. package/index.js +17 -9
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -30,6 +30,7 @@ const {
30
30
  headersInBody,
31
31
  } = require("@saltcorn/markup/layout_utils");
32
32
  const db = require("@saltcorn/data/db");
33
+ const { isNode } = require("@saltcorn/data/utils");
33
34
 
34
35
  /**
35
36
  * @param {string} currentUrl
@@ -288,6 +289,8 @@ const renderAuthLinks = (authLinks) => {
288
289
  if (authLinks.forgot) links.push(link(authLinks.forgot, "Forgot password?"));
289
290
  if (authLinks.signup)
290
291
  links.push(link(authLinks.signup, "Create an account!"));
292
+ if (authLinks.publicUser)
293
+ links.push(link(authLinks.publicUser, "Continue as public user"));
291
294
  const meth_links = (authLinks.methods || [])
292
295
  .map(({ url, icon, label }) =>
293
296
  a(
@@ -316,6 +319,11 @@ const formModify = (form) => {
316
319
  return form;
317
320
  };
318
321
 
322
+ /**
323
+ * omit '/' in a mobile deployment (needed for ios)
324
+ */
325
+ const safeSlash = () => (isNode() ? "/" : "");
326
+
319
327
  /**
320
328
  * @param {*} headers
321
329
  * @param {string} title
@@ -331,22 +339,22 @@ const wrapIt = (headers, title, bodyAttr, rest) =>
331
339
  <meta charset="utf-8">
332
340
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
333
341
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
334
- <link rel="stylesheet" href="/plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/fontawesome-free/css/all.min.css">
342
+ <link rel="stylesheet" href="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/fontawesome-free/css/all.min.css">
335
343
  <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
336
344
 
337
345
  <!-- Custom styles for this template-->
338
- <link rel="stylesheet" href="/plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/css/sb-admin-2.css">
346
+ <link rel="stylesheet" href="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/css/sb-admin-2.css">
339
347
  ${headersInHead(headers)}
340
348
  <title>${text(title)}</title>
341
349
  </head>
342
350
  <body ${bodyAttr}>
343
351
  ${rest}
344
- <script src="/static_assets/${
345
- db.connectObj.version_tag
346
- }/jquery-3.6.0.min.js"></script>
347
- <script src="/plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
348
- <script src="/plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/jquery-easing/jquery.easing.min.js"></script>
349
- <script src="/plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/js/sb-admin-2.min.js"></script>
352
+ <script src="${safeSlash()}static_assets/${
353
+ db.connectObj.version_tag
354
+ }/jquery-3.6.0.min.js"></script>
355
+ <script src="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
356
+ <script src="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/jquery-easing/jquery.easing.min.js"></script>
357
+ <script src="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/js/sb-admin-2.min.js"></script>
350
358
  ${headersInBody(headers)}
351
359
  </body>
352
360
  </html>`;
@@ -431,7 +439,7 @@ const wrap = ({
431
439
  title,
432
440
  `id="page-top" class="${bodyClass || ""}"`,
433
441
  `<div id="wrapper">
434
- ${db.is_node ? sidebar(brand, menu, currentUrl) : ""}
442
+ ${menu && menu.length > 0 ? sidebar(brand, menu, currentUrl) : ""}
435
443
 
436
444
  <div id="content-wrapper" class="d-flex flex-column">
437
445
  <div id="content">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/sbadmin2",
3
- "version": "0.7.3",
3
+ "version": "0.7.4-beta.2",
4
4
  "description": "SB Admin 2 layout plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,8 +9,8 @@
9
9
  "clean": "echo \"Error: no TypeScript support yet\""
10
10
  },
11
11
  "dependencies": {
12
- "@saltcorn/data": "0.7.3",
13
- "@saltcorn/markup": "0.7.3",
12
+ "@saltcorn/data": "0.7.4-beta.2",
13
+ "@saltcorn/markup": "0.7.4-beta.2",
14
14
  "startbootstrap-sb-admin-2-bs5": "^4.1.5-beta.8"
15
15
  },
16
16
  "author": "Tom Nielsen",