mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
added user config for dark mode and navigation
This commit is contained in:
parent
1d7ecc3efa
commit
40af926104
7 changed files with 82 additions and 16 deletions
|
|
@ -5,7 +5,15 @@ Template.userConfig.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.userConfig.onRendered(function() {
|
||||
|
||||
let myConfig = UserConfig.findOne({ user: Meteor.userId() });
|
||||
if (typeof myConfig != 'undefined') {
|
||||
console.log("My Pref: " + myConfig.darkPref);
|
||||
if (myConfig.darkMode == 'light') {
|
||||
$("#darkMode").prop('checked', false);
|
||||
} else {
|
||||
$("#darkMode").prop('checked', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.userConfig.helpers({
|
||||
|
|
@ -13,5 +21,24 @@ Template.userConfig.helpers({
|
|||
});
|
||||
|
||||
Template.userConfig.events({
|
||||
|
||||
'click #darkMode' (event) {
|
||||
let darkModePref = $("#darkMode").prop('checked');
|
||||
if (darkModePref == true) {
|
||||
Meteor.call('update.darkModePref', 'dark', function(err, reuslt) {
|
||||
if (err) {
|
||||
console.log(" ERROR: could not set dark mode preference to dark: " + err);
|
||||
} else {
|
||||
showSnackbar("Dark Mode Preference Set to Dark", "green");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Meteor.call('update.darkModePref', 'light', function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR: could not set dark mode preference to light: " + err);
|
||||
} else {
|
||||
showSnackbar("Dark Mode Preference Set to Light", "green");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue