mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01: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 = "";
|
||||
|
||||
// first loop over each of the four color
|
||||
_.each(Telescope.utils.colorTable, function (elements, color) {
|
||||
_.each(Telescope.colorElements.colorTable, function (elements, color) {
|
||||
var properties = {};
|
||||
|
||||
// for each color, loop over the items to build the selector
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{{> messages}}
|
||||
{{> modules "hero"}}
|
||||
{{> yield "adminMenu"}}
|
||||
{{> yield "postListTop"}}
|
||||
{{> yield "postsListTop"}}
|
||||
{{> yield}}
|
||||
{{> footer}}
|
||||
</div>
|
||||
|
|
|
@ -31,7 +31,6 @@ Package.onUse(function(api) {
|
|||
'lib/router/server.js',
|
||||
'lib/config.js',
|
||||
'lib/modules.js',
|
||||
'lib/menus.js',
|
||||
'lib/vote.js'
|
||||
], ['client', 'server']);
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
/**
|
||||
* A dictionnary of all the elements that use custom colors
|
||||
*/
|
||||
Telescope.utils.colorTable = {
|
||||
|
||||
Telescope.colorElements = {};
|
||||
|
||||
Telescope.colorElements.colorTable = {
|
||||
accentColor: [],
|
||||
accentContrastColor: [],
|
||||
secondaryColor: [],
|
||||
|
@ -14,19 +17,19 @@ Telescope.utils.colorTable = {
|
|||
* @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.
|
||||
*/
|
||||
Telescope.utils.addElementColor = function (selector, color, property) {
|
||||
Telescope.colorElements.add = function (selector, color, property) {
|
||||
var element = {selector: selector};
|
||||
|
||||
if (typeof property !== "undefined")
|
||||
element.property = property;
|
||||
|
||||
Telescope.utils.colorTable[color].push(element);
|
||||
Telescope.colorElements.colorTable[color].push(element);
|
||||
};
|
||||
|
||||
// shortcuts
|
||||
var setShortcut = function(name) {
|
||||
return function (selector, property) {
|
||||
Telescope.utils.addElementColor(selector, name, property);
|
||||
Telescope.colorElements.add(selector, name, property);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* Menus namespace
|
||||
* @namespace Telescope.menus
|
||||
* @namespace Telescope.menuItems
|
||||
*/
|
||||
Telescope.menus = {};
|
||||
Telescope.menuItems = {};
|
||||
|
||||
/**
|
||||
* Add one or more items to a menu
|
||||
|
@ -29,20 +29,20 @@ Telescope.menus = {};
|
|||
Telescope.menuItems.add = function (menu, item) {
|
||||
|
||||
// if menu items array doesn't exist yet, initialize it
|
||||
if (typeof Telescope.menus[menu] === "undefined") {
|
||||
Telescope.menus[menu] = [];
|
||||
if (typeof Telescope.menuItems[menu] === "undefined") {
|
||||
Telescope.menuItems[menu] = [];
|
||||
}
|
||||
|
||||
if (Array.isArray(item)) {
|
||||
|
||||
var items = item; // we're dealing with an Array, so let's add an "s"
|
||||
items.forEach( function (item) {
|
||||
Telescope.menus[menu].push(item);
|
||||
Telescope.menuItems[menu].push(item);
|
||||
});
|
||||
|
||||
} 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
|
||||
*/
|
||||
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;
|
||||
});
|
||||
};
|
||||
|
@ -63,5 +63,5 @@ Telescope.menuItems.remove = function (menu, label) {
|
|||
* @param {string} menu - The name of the 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
|
||||
Telescope.menuItems.add("viewsMenu", [
|
||||
{
|
||||
|
@ -33,18 +27,4 @@ Telescope.menuItems.add("viewsMenu", [
|
|||
description: 'future_scheduled_posts',
|
||||
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',
|
||||
order: 99
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ Posts.controllers.list = RouteController.extend({
|
|||
var showViewsNav = (typeof this.showViewsNav === 'undefined') ? true : this.showViewsNav;
|
||||
|
||||
if (showViewsNav) {
|
||||
this.render('post_list_top', {to: 'postListTop'});
|
||||
this.render('posts_list_top', {to: 'postsListTop'});
|
||||
}
|
||||
this.next();
|
||||
},
|
||||
|
|
|
@ -27,6 +27,7 @@ Package.onUse(function (api) {
|
|||
'lib/modules.js',
|
||||
'lib/callbacks.js',
|
||||
'lib/methods.js',
|
||||
'lib/menus.js',
|
||||
'lib/routes.js'
|
||||
], ['client', 'server']);
|
||||
|
||||
|
@ -59,7 +60,7 @@ Package.onUse(function (api) {
|
|||
'lib/client/templates/post_edit.js',
|
||||
'lib/client/templates/post_item.html',
|
||||
'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.js',
|
||||
'lib/client/templates/post_submit.html',
|
||||
|
|
|
@ -15,7 +15,7 @@ Telescope.modules.add("adminMenu", {
|
|||
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", {
|
||||
schema: new SimpleSchema({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<template name="settings_form">
|
||||
<template name="settings">
|
||||
{{#if this.hasSettings}}
|
||||
{{> quickForm collection="Settings" id="updateSettingsForm" type="update" doc=this.settings label-class="control-label" input-col-class="controls" template="bootstrap3-horizontal"}}
|
||||
{{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', {
|
||||
controller: Telescope.controllers.admin,
|
||||
name: 'settings',
|
||||
template: 'settings_form',
|
||||
// layoutTemplate: 'adminLayout',
|
||||
data: function () {
|
||||
// we only have one set of settings for now
|
||||
|
|
|
@ -18,6 +18,7 @@ Package.onUse(function(api) {
|
|||
api.addFiles([
|
||||
'lib/settings.js',
|
||||
'lib/router.js',
|
||||
'lib/menus.js',
|
||||
'package-tap.i18n'
|
||||
], both);
|
||||
|
||||
|
@ -28,8 +29,8 @@ Package.onUse(function(api) {
|
|||
api.addFiles([
|
||||
'lib/client/language_changer.js',
|
||||
'lib/client/helpers.js',
|
||||
'lib/client/templates/settings_form.html',
|
||||
'lib/client/templates/settings_form.js'
|
||||
'lib/client/templates/settings.html',
|
||||
'lib/client/templates/settings.js'
|
||||
], 'client');
|
||||
|
||||
api.addFiles([
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Telescope.modules.add("postListTop", {
|
||||
Telescope.modules.add("postsListTop", {
|
||||
template: "tagline_banner",
|
||||
order: 1
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ Meteor.startup(function () {
|
|||
showViewsNav: false,
|
||||
|
||||
onBeforeAction: function () {
|
||||
this.render('category_title', {to: 'postListTop'});
|
||||
this.render('category_title', {to: 'postsListTop'});
|
||||
this.next();
|
||||
},
|
||||
|
||||
|
|
|
@ -24,4 +24,13 @@ Telescope.menuItems.add("userMenu", [
|
|||
label: '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', {
|
||||
controller: Telescope.controllers.admin,
|
||||
name: 'usersDashboard',
|
||||
template: 'users_dashboard'
|
||||
// template: 'users'
|
||||
name: 'users_dashboard'
|
||||
});
|
||||
|
||||
// Unsubscribe (from notifications)
|
||||
|
|
|
@ -110,7 +110,10 @@ Telescope.schemas.userData = new SimpleSchema({
|
|||
isInvited: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
editableBy: ["admin"]
|
||||
editableBy: ["admin"],
|
||||
autoform: {
|
||||
omit: true
|
||||
}
|
||||
},
|
||||
/**
|
||||
The user's karma
|
||||
|
@ -216,7 +219,10 @@ Users.schema = new SimpleSchema({
|
|||
isAdmin: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
editableBy: ["admin"]
|
||||
editableBy: ["admin"],
|
||||
autoform: {
|
||||
omit: true
|
||||
}
|
||||
},
|
||||
profile: {
|
||||
type: Object,
|
||||
|
|
Loading…
Add table
Reference in a new issue