mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
postListTop -> postsListTop; Telescope.utils.colorTable -> Telescope.colorElements.colorTable; reogranize menus code
This commit is contained in:
parent
60024af0d1
commit
29babb9a38
22 changed files with 56 additions and 53 deletions
|
@ -3,7 +3,7 @@ Template.css.helpers({
|
||||||
var css = "";
|
var css = "";
|
||||||
|
|
||||||
// first loop over each of the four color
|
// first loop over each of the four color
|
||||||
_.each(Telescope.utils.colorTable, function (elements, color) {
|
_.each(Telescope.colorElements.colorTable, function (elements, color) {
|
||||||
var properties = {};
|
var properties = {};
|
||||||
|
|
||||||
// for each color, loop over the items to build the selector
|
// for each color, loop over the items to build the selector
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{{> messages}}
|
{{> messages}}
|
||||||
{{> modules "hero"}}
|
{{> modules "hero"}}
|
||||||
{{> yield "adminMenu"}}
|
{{> yield "adminMenu"}}
|
||||||
{{> yield "postListTop"}}
|
{{> yield "postsListTop"}}
|
||||||
{{> yield}}
|
{{> yield}}
|
||||||
{{> footer}}
|
{{> footer}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,7 +31,6 @@ Package.onUse(function(api) {
|
||||||
'lib/router/server.js',
|
'lib/router/server.js',
|
||||||
'lib/config.js',
|
'lib/config.js',
|
||||||
'lib/modules.js',
|
'lib/modules.js',
|
||||||
'lib/menus.js',
|
|
||||||
'lib/vote.js'
|
'lib/vote.js'
|
||||||
], ['client', 'server']);
|
], ['client', 'server']);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* A dictionnary of all the elements that use custom colors
|
* A dictionnary of all the elements that use custom colors
|
||||||
*/
|
*/
|
||||||
Telescope.utils.colorTable = {
|
|
||||||
|
Telescope.colorElements = {};
|
||||||
|
|
||||||
|
Telescope.colorElements.colorTable = {
|
||||||
accentColor: [],
|
accentColor: [],
|
||||||
accentContrastColor: [],
|
accentContrastColor: [],
|
||||||
secondaryColor: [],
|
secondaryColor: [],
|
||||||
|
@ -14,19 +17,19 @@ Telescope.utils.colorTable = {
|
||||||
* @param {string} color - the color. Either `accentColor`, `accentContrastColor`, `secondaryColor`, or `secondaryContrastColor`
|
* @param {string} color - the color. Either `accentColor`, `accentContrastColor`, `secondaryColor`, or `secondaryContrastColor`
|
||||||
* @param {string} [property=color] - the property to colorize. Usually `color`, `background-color`, `border-color`, etc.
|
* @param {string} [property=color] - the property to colorize. Usually `color`, `background-color`, `border-color`, etc.
|
||||||
*/
|
*/
|
||||||
Telescope.utils.addElementColor = function (selector, color, property) {
|
Telescope.colorElements.add = function (selector, color, property) {
|
||||||
var element = {selector: selector};
|
var element = {selector: selector};
|
||||||
|
|
||||||
if (typeof property !== "undefined")
|
if (typeof property !== "undefined")
|
||||||
element.property = property;
|
element.property = property;
|
||||||
|
|
||||||
Telescope.utils.colorTable[color].push(element);
|
Telescope.colorElements.colorTable[color].push(element);
|
||||||
};
|
};
|
||||||
|
|
||||||
// shortcuts
|
// shortcuts
|
||||||
var setShortcut = function(name) {
|
var setShortcut = function(name) {
|
||||||
return function (selector, property) {
|
return function (selector, property) {
|
||||||
Telescope.utils.addElementColor(selector, name, property);
|
Telescope.colorElements.add(selector, name, property);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* Menus namespace
|
* Menus namespace
|
||||||
* @namespace Telescope.menus
|
* @namespace Telescope.menuItems
|
||||||
*/
|
*/
|
||||||
Telescope.menus = {};
|
Telescope.menuItems = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add one or more items to a menu
|
* Add one or more items to a menu
|
||||||
|
@ -29,20 +29,20 @@ Telescope.menus = {};
|
||||||
Telescope.menuItems.add = function (menu, item) {
|
Telescope.menuItems.add = function (menu, item) {
|
||||||
|
|
||||||
// if menu items array doesn't exist yet, initialize it
|
// if menu items array doesn't exist yet, initialize it
|
||||||
if (typeof Telescope.menus[menu] === "undefined") {
|
if (typeof Telescope.menuItems[menu] === "undefined") {
|
||||||
Telescope.menus[menu] = [];
|
Telescope.menuItems[menu] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(item)) {
|
if (Array.isArray(item)) {
|
||||||
|
|
||||||
var items = item; // we're dealing with an Array, so let's add an "s"
|
var items = item; // we're dealing with an Array, so let's add an "s"
|
||||||
items.forEach( function (item) {
|
items.forEach( function (item) {
|
||||||
Telescope.menus[menu].push(item);
|
Telescope.menuItems[menu].push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Telescope.menus[menu].push(item);
|
Telescope.menuItems[menu].push(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,7 @@ Telescope.menuItems.add = function (menu, item) {
|
||||||
* @param {string} label - The label of the item to remove
|
* @param {string} label - The label of the item to remove
|
||||||
*/
|
*/
|
||||||
Telescope.menuItems.remove = function (menu, label) {
|
Telescope.menuItems.remove = function (menu, label) {
|
||||||
Telescope.menus[menu] = _.reject(Telescope.menus[menu], function (menu) {
|
Telescope.menuItems[menu] = _.reject(Telescope.menuItems[menu], function (menu) {
|
||||||
return menu.label === label;
|
return menu.label === label;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -63,5 +63,5 @@ Telescope.menuItems.remove = function (menu, label) {
|
||||||
* @param {string} menu - The name of the menu
|
* @param {string} menu - The name of the menu
|
||||||
*/
|
*/
|
||||||
Telescope.menuItems.get = function (menu) {
|
Telescope.menuItems.get = function (menu) {
|
||||||
return _.sortBy(Telescope.menus[menu], "order");
|
return _.sortBy(Telescope.menuItems[menu], "order");
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
<template name="post_list_top">
|
|
||||||
{{> modules "postListTop"}}
|
|
||||||
</template>
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<template name="posts_list_top">
|
||||||
|
{{> modules "postsListTop"}}
|
||||||
|
</template>
|
|
@ -1,9 +1,3 @@
|
||||||
////////////////
|
|
||||||
// Navigation //
|
|
||||||
////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// array containing items in the views menu
|
// array containing items in the views menu
|
||||||
Telescope.menuItems.add("viewsMenu", [
|
Telescope.menuItems.add("viewsMenu", [
|
||||||
{
|
{
|
||||||
|
@ -33,18 +27,4 @@ Telescope.menuItems.add("viewsMenu", [
|
||||||
description: 'future_scheduled_posts',
|
description: 'future_scheduled_posts',
|
||||||
adminOnly: true
|
adminOnly: true
|
||||||
},
|
},
|
||||||
]);
|
|
||||||
|
|
||||||
// array containing items in the admin menu
|
|
||||||
Telescope.menuItems.add("adminMenu", [
|
|
||||||
{
|
|
||||||
route: 'settings',
|
|
||||||
label: 'settings',
|
|
||||||
description: 'telescope_settings_panel'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
route: 'usersDashboard',
|
|
||||||
label: 'users',
|
|
||||||
description: 'users_dashboard'
|
|
||||||
}
|
|
||||||
]);
|
]);
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Telescope.modules.add("postListTop", {
|
Telescope.modules.add("postsListTop", {
|
||||||
template: 'posts_views_nav',
|
template: 'posts_views_nav',
|
||||||
order: 99
|
order: 99
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ Posts.controllers.list = RouteController.extend({
|
||||||
var showViewsNav = (typeof this.showViewsNav === 'undefined') ? true : this.showViewsNav;
|
var showViewsNav = (typeof this.showViewsNav === 'undefined') ? true : this.showViewsNav;
|
||||||
|
|
||||||
if (showViewsNav) {
|
if (showViewsNav) {
|
||||||
this.render('post_list_top', {to: 'postListTop'});
|
this.render('posts_list_top', {to: 'postsListTop'});
|
||||||
}
|
}
|
||||||
this.next();
|
this.next();
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,6 +27,7 @@ Package.onUse(function (api) {
|
||||||
'lib/modules.js',
|
'lib/modules.js',
|
||||||
'lib/callbacks.js',
|
'lib/callbacks.js',
|
||||||
'lib/methods.js',
|
'lib/methods.js',
|
||||||
|
'lib/menus.js',
|
||||||
'lib/routes.js'
|
'lib/routes.js'
|
||||||
], ['client', 'server']);
|
], ['client', 'server']);
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ Package.onUse(function (api) {
|
||||||
'lib/client/templates/post_edit.js',
|
'lib/client/templates/post_edit.js',
|
||||||
'lib/client/templates/post_item.html',
|
'lib/client/templates/post_item.html',
|
||||||
'lib/client/templates/post_item.js',
|
'lib/client/templates/post_item.js',
|
||||||
'lib/client/templates/post_list_top.html',
|
'lib/client/templates/posts_list_top.html',
|
||||||
'lib/client/templates/post_page.html',
|
'lib/client/templates/post_page.html',
|
||||||
'lib/client/templates/post_page.js',
|
'lib/client/templates/post_page.js',
|
||||||
'lib/client/templates/post_submit.html',
|
'lib/client/templates/post_submit.html',
|
||||||
|
|
|
@ -15,7 +15,7 @@ Telescope.modules.add("adminMenu", {
|
||||||
description: 'see_what_people_are_searching_for'
|
description: 'see_what_people_are_searching_for'
|
||||||
});
|
});
|
||||||
|
|
||||||
Telescope.utils.addElementColor('.search .search-field', 'secondaryContrastColor');
|
Telescope.colorElements.add('.search .search-field', 'secondaryContrastColor');
|
||||||
|
|
||||||
Searches = new Meteor.Collection("searches", {
|
Searches = new Meteor.Collection("searches", {
|
||||||
schema: new SimpleSchema({
|
schema: new SimpleSchema({
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<template name="settings_form">
|
<template name="settings">
|
||||||
{{#if this.hasSettings}}
|
{{#if this.hasSettings}}
|
||||||
{{> quickForm collection="Settings" id="updateSettingsForm" type="update" doc=this.settings label-class="control-label" input-col-class="controls" template="bootstrap3-horizontal"}}
|
{{> quickForm collection="Settings" id="updateSettingsForm" type="update" doc=this.settings label-class="control-label" input-col-class="controls" template="bootstrap3-horizontal"}}
|
||||||
{{else}}
|
{{else}}
|
7
packages/telescope-settings/lib/menus.js
Normal file
7
packages/telescope-settings/lib/menus.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Telescope.menuItems.add("adminMenu", [
|
||||||
|
{
|
||||||
|
route: 'settings',
|
||||||
|
label: 'settings',
|
||||||
|
description: 'telescope_settings_panel'
|
||||||
|
}
|
||||||
|
]);
|
|
@ -4,7 +4,6 @@ Meteor.startup(function () {
|
||||||
Router.route('/settings', {
|
Router.route('/settings', {
|
||||||
controller: Telescope.controllers.admin,
|
controller: Telescope.controllers.admin,
|
||||||
name: 'settings',
|
name: 'settings',
|
||||||
template: 'settings_form',
|
|
||||||
// layoutTemplate: 'adminLayout',
|
// layoutTemplate: 'adminLayout',
|
||||||
data: function () {
|
data: function () {
|
||||||
// we only have one set of settings for now
|
// we only have one set of settings for now
|
||||||
|
|
|
@ -18,6 +18,7 @@ Package.onUse(function(api) {
|
||||||
api.addFiles([
|
api.addFiles([
|
||||||
'lib/settings.js',
|
'lib/settings.js',
|
||||||
'lib/router.js',
|
'lib/router.js',
|
||||||
|
'lib/menus.js',
|
||||||
'package-tap.i18n'
|
'package-tap.i18n'
|
||||||
], both);
|
], both);
|
||||||
|
|
||||||
|
@ -28,8 +29,8 @@ Package.onUse(function(api) {
|
||||||
api.addFiles([
|
api.addFiles([
|
||||||
'lib/client/language_changer.js',
|
'lib/client/language_changer.js',
|
||||||
'lib/client/helpers.js',
|
'lib/client/helpers.js',
|
||||||
'lib/client/templates/settings_form.html',
|
'lib/client/templates/settings.html',
|
||||||
'lib/client/templates/settings_form.js'
|
'lib/client/templates/settings.js'
|
||||||
], 'client');
|
], 'client');
|
||||||
|
|
||||||
api.addFiles([
|
api.addFiles([
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Telescope.modules.add("postListTop", {
|
Telescope.modules.add("postsListTop", {
|
||||||
template: "tagline_banner",
|
template: "tagline_banner",
|
||||||
order: 1
|
order: 1
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ Meteor.startup(function () {
|
||||||
showViewsNav: false,
|
showViewsNav: false,
|
||||||
|
|
||||||
onBeforeAction: function () {
|
onBeforeAction: function () {
|
||||||
this.render('category_title', {to: 'postListTop'});
|
this.render('category_title', {to: 'postsListTop'});
|
||||||
this.next();
|
this.next();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,13 @@ Telescope.menuItems.add("userMenu", [
|
||||||
label: 'sign_out',
|
label: 'sign_out',
|
||||||
description: 'sign_out'
|
description: 'sign_out'
|
||||||
}
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// array containing items in the admin menu
|
||||||
|
Telescope.menuItems.add("adminMenu", [
|
||||||
|
{
|
||||||
|
route: 'users_dashboard',
|
||||||
|
label: 'users',
|
||||||
|
description: 'users_dashboard'
|
||||||
|
}
|
||||||
]);
|
]);
|
|
@ -111,9 +111,7 @@ Meteor.startup(function () {
|
||||||
|
|
||||||
Router.route('/users-dashboard', {
|
Router.route('/users-dashboard', {
|
||||||
controller: Telescope.controllers.admin,
|
controller: Telescope.controllers.admin,
|
||||||
name: 'usersDashboard',
|
name: 'users_dashboard'
|
||||||
template: 'users_dashboard'
|
|
||||||
// template: 'users'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unsubscribe (from notifications)
|
// Unsubscribe (from notifications)
|
||||||
|
|
|
@ -110,7 +110,10 @@ Telescope.schemas.userData = new SimpleSchema({
|
||||||
isInvited: {
|
isInvited: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
optional: true,
|
optional: true,
|
||||||
editableBy: ["admin"]
|
editableBy: ["admin"],
|
||||||
|
autoform: {
|
||||||
|
omit: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
The user's karma
|
The user's karma
|
||||||
|
@ -216,7 +219,10 @@ Users.schema = new SimpleSchema({
|
||||||
isAdmin: {
|
isAdmin: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
optional: true,
|
optional: true,
|
||||||
editableBy: ["admin"]
|
editableBy: ["admin"],
|
||||||
|
autoform: {
|
||||||
|
omit: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
profile: {
|
profile: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
Loading…
Add table
Reference in a new issue