Make useDropdowns a theme-level setting instead

This commit is contained in:
Sacha Greif 2014-08-15 12:30:51 +09:00
parent a4c7fc3dd7
commit 7de249500c
9 changed files with 27 additions and 6 deletions

View file

@ -12,7 +12,7 @@ Template[getTemplate('nav')].helpers({
return !!secondaryNav.length;
},
dropdownClass: function () {
return getSetting('useDropdowns', true) ? 'has-dropdown' : 'no-dropdown';
return getThemeSetting('useDropdowns', true) ? 'has-dropdown' : 'no-dropdown';
},
getTemplate: function () {
return getTemplate(this);

View file

@ -86,10 +86,6 @@ settingsSchemaObject = {
type: Number,
optional: true
},
useDropdowns: {
type: Boolean,
optional: true
},
language: {
type: String,
defaultValue: 'en',

View file

@ -163,3 +163,8 @@ getTemplate = function (name) {
return !!templates[name] ? templates[name] : name;
}
// ------------------------------ Theme Settings ------------------------------ //
themeSettings = {
'useDropdowns': true // whether or not to use dropdown menus in a theme
};

View file

@ -37,6 +37,8 @@ Package.on_use(function (api) {
'commentEditClientCallbacks',
'getTemplate',
'templates'
'templates',
'themeSettings'
]);
});

View file

@ -11,6 +11,14 @@ getSetting = function(setting, defaultValue){
}
};
getThemeSetting = function(setting, defaultValue){
if(typeof themeSettings[setting] !== 'undefined'){
return themeSettings[setting];
}else{
return typeof defaultValue === 'undefined' ? '' : defaultValue;
}
};
camelToDash = function (str) {
return str.replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1-$2').toLowerCase();
}

View file

@ -19,6 +19,7 @@ Package.on_use(function (api) {
'camelToDash',
'dashToCamel',
'getSetting',
'getThemeSetting',
'getSiteUrl',
'trimWords'
]);

View file

@ -2,6 +2,8 @@ Package.describe({summary: "Telescope base theme"});
Package.on_use(function (api) {
api.use(['telescope-lib', 'telescope-base'], ['client', 'server']);
api.add_files([
'lib/client/css/screen.css',
], ['client']);

View file

@ -0,0 +1 @@
themeSettings.useDropdowns = true; // not strictly needed since "true" is the current default

View file

@ -2,6 +2,12 @@ Package.describe({summary: "Telescope Hubble theme"});
Package.on_use(function (api) {
api.use(['telescope-lib', 'telescope-base'], ['client', 'server']);
api.add_files([
'lib/hubble.js',
], ['client', 'server']);
api.add_files([
'lib/client/css/screen.css',
], ['client']);