get_my/client/General/headerBar.js
Brian McGonagill c70f9bd74e Multiple updates and additions
- Added a permission to show or hide update version information on that dashboard as a card that will only show when new update info is available and not yet dismissed.
- Updated Lists so list items added will have their fist letter auto-capitalized
- Updated Lists so list items are searched against the products before being added to the list, so we have store info more commonly in lists
- Updated Products so new products will have their first letter capitalized automatically
- Updated the dashboard to show the Update Available card if this is enbaled in permissions.
    - The dashboard card only shows for System Admin roles.
    - The dashboard card is enabled by default
    - The dashboard card is pulled from the GitLab releases RSS feed.
    - The RSS Feed is only checked every 30 minutes using node-cron
- Updated System Configuration to have a toggle for the update available card
- Added a bell icon to the top and slide out navigation, shown when a new update is available, if update available is enabled in system configuration.
2024-08-21 07:01:36 -05:00

52 lines
1.4 KiB
JavaScript

import { M } from '../lib/assets/materialize';
import { UpdateInfo } from '../../imports/api/updateInfo.js';
Template.headerBar.onCreated(function() {
this.subscribe("UpdateVersion");
});
Template.headerBar.onRendered(function() {
var elems = document.querySelectorAll('.sidenav');
var instances = M.Sidenav.init(elems, {});
var elemd = document.querySelectorAll('.dropdown-trigger');
var instances = M.Dropdown.init(elemd, {});
});
Template.headerBar.helpers({
adminReg: function() {
return Session.get("adminreg");
},
myTheme: function() {
return Session.get("myTheme");
},
updateExists: function() {
let update = UpdateInfo.find({ viewed: false }).fetch();
if (update.length > 0) {
return true;
} else {
return false;
}
},
});
Template.headerBar.events({
'click .navBtn' (event) {
event.preventDefault();
var clickedTarget = event.target.id;
// console.log("clicked " + clickedTarget);
if (clickedTarget == 'mainMenu') {
FlowRouter.go('/');
} else {
// console.log("should be going to /" + clickedTarget);
FlowRouter.go('/' + clickedTarget);
}
},
'click .signOut': () => {
FlowRouter.go('/');
Meteor.logout();
},
'click #brandLogo' (event) {
event.preventDefault();
FlowRouter.go('/dashboard');
}
});