much cleaner code
This commit is contained in:
parent
3d575f7645
commit
b6bda7f45f
|
@ -34,47 +34,31 @@ function refreshThemeHelpers(theme) {
|
||||||
//
|
//
|
||||||
theme.helpers = {
|
theme.helpers = {
|
||||||
getPasswordChar : function() {
|
getPasswordChar : function() {
|
||||||
var pwChar = Config.defaults.passwordChar;
|
let pwChar = _.get(
|
||||||
if(_.has(theme, 'customization.defaults.general')) {
|
theme,
|
||||||
var themePasswordChar = theme.customization.defaults.general.passwordChar;
|
'customization.defaults.general.passwordChar',
|
||||||
if(_.isString(themePasswordChar)) {
|
Config.defaults.passwordChar
|
||||||
pwChar = themePasswordChar.substr(0, 1);
|
);
|
||||||
} else if(_.isNumber(themePasswordChar)) {
|
|
||||||
pwChar = String.fromCharCode(themePasswordChar);
|
if(_.isString(pwChar)) {
|
||||||
}
|
pwChar = pwChar.substr(0, 1);
|
||||||
|
} else if(_.isNumber(pwChar)) {
|
||||||
|
pwChar = String.fromCharCode(pwChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pwChar;
|
return pwChar;
|
||||||
},
|
},
|
||||||
getDateFormat : function(style) {
|
getDateFormat : function(style = 'short') {
|
||||||
style = style || 'short';
|
const format = Config.defaults.dateFormat[style] || 'MM/DD/YYYY';
|
||||||
|
return _.get(theme, `customization.defaults.dateFormat.${style}`, format);
|
||||||
var format = Config.defaults.dateFormat[style] || 'MM/DD/YYYY';
|
|
||||||
|
|
||||||
if(_.has(theme, 'customization.defaults.dateFormat')) {
|
|
||||||
return theme.customization.defaults.dateFormat[style] || format;
|
|
||||||
}
|
|
||||||
return format;
|
|
||||||
},
|
},
|
||||||
getTimeFormat : function(style) {
|
getTimeFormat : function(style = 'short') {
|
||||||
style = style || 'short';
|
const format = Config.defaults.timeFormat[style] || 'h:mm a';
|
||||||
|
return _.get(theme, `customization.defaults.timeFormat.${style}`, format);
|
||||||
var format = Config.defaults.timeFormat[style] || 'h:mm a';
|
|
||||||
|
|
||||||
if(_.has(theme, 'customization.defaults.timeFormat')) {
|
|
||||||
return theme.customization.defaults.timeFormat[style] || format;
|
|
||||||
}
|
|
||||||
return format;
|
|
||||||
},
|
},
|
||||||
getDateTimeFormat : function(style) {
|
getDateTimeFormat : function(style = 'short') {
|
||||||
style = style || 'short';
|
const format = Config.defaults.dateTimeFormat[style] || 'MM/DD/YYYY h:mm a';
|
||||||
|
return _.get(theme, `customization.defaults.dateTimeFormat.${style}`, format);
|
||||||
var format = Config.defaults.dateTimeFormat[style] || 'MM/DD/YYYY h:mm a';
|
|
||||||
|
|
||||||
if(_.has(theme, 'customization.defaults.dateTimeFormat')) {
|
|
||||||
return theme.customization.defaults.dateTimeFormat[style] || format;
|
|
||||||
}
|
|
||||||
|
|
||||||
return format;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue