Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add icons to sidebar #375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/accounts/accounts-tab/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (Meteor.isClient) {
index: 80,
identifier: 'accounts-index',
title: i18n('accounts.index.title'),
iconClass: 'fa fa-user',
routeName: 'accounts.index',
activeRouteRegex: 'accounts',
permission: 'accounts.index'
Expand Down
7 changes: 7 additions & 0 deletions packages/base/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ orion.links.attachSchema(new SimpleSchema({
title: {
type: String
},
iconClass: {
type: String,
optional: true
},
routeName: {
type: String,
optional: true
Expand All @@ -38,6 +42,9 @@ orion.links.add = function(options) {
if (_.isFunction(options.title)) {
options.title = options.title();
}
if (_.isFunction(options.iconClass)) {
options.iconClass = options.iconClass();
}
self.upsert({ identifier: options.identifier }, { $set: options });
});
};
Expand Down
12 changes: 9 additions & 3 deletions packages/bootstrap/views/sidebar/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<span class="caret"></span>
</a>
<a href="{{ RouterLayerPathFor routeName }}">
{{ title }}
{{>orionBootstrapSidebarLinkIcon}} {{ title }}
</a>
{{ else }}
<a data-target="#admin-links-{{ identifier }}" href="#" data-toggle="collapse">
{{ title }}
{{>orionBootstrapSidebarLinkIcon}} {{ title }}
<span class="caret"></span>
</a>
{{/ if }}
Expand All @@ -37,7 +37,13 @@
</li>
{{ else }}
<li class="{{ RouterLayerIsActiveRoutePartial activeRouteRegex }}">
<a href="{{ RouterLayerPathFor routeName }}">{{ title }}</a>
<a href="{{ RouterLayerPathFor routeName }}">{{>orionBootstrapSidebarLinkIcon}} {{ title }}</a>
</li>
{{/ if }}
</template>

<template name="orionBootstrapSidebarLinkIcon">
{{#if iconClass}}
<i class="sidebar-icon {{iconClass}}"></i>
{{/if}}
</template>
4 changes: 4 additions & 0 deletions packages/bootstrap/views/sidebar/sidebar.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
padding-right: 20px;
cursor: pointer;
}
.sidebar-icon {
display: inline;
padding-right: 4px;
}
}
1 change: 1 addition & 0 deletions packages/collections/collections_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ orion.collections.onCreated(function() {
activeRouteRegex: 'collections.' + self.name,
permission: 'collections.' + self.name + '.index',
title: self.name[0].toUpperCase() + self.name.slice(1),
iconClass: 'fa fa-table',
index: 30
}, self.link);
orion.links.add(linkOptions);
Expand Down
1 change: 1 addition & 0 deletions packages/config/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if (Meteor.isClient) {
index: 100,
identifier: 'config-update',
title: i18n('config.update.title'),
iconClass: 'fa fa-wrench',
routeName: 'config.update',
activeRouteRegex: 'config',
permission: 'config.update'
Expand Down
1 change: 1 addition & 0 deletions packages/dictionary/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Tracker.autorun(function () {
index: 10,
identifier: 'dictionary-update',
title: i18n('dictionary.update.title'),
iconClass: 'fa fa-at',
routeName: 'dictionary.update',
activeRouteRegex: 'dictionary',
permission: 'dictionary.update',
Expand Down
1 change: 1 addition & 0 deletions packages/pages/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if (Meteor.isClient) {
index: 40,
identifier: 'pages-index',
title: i18n('pages.index.title'),
iconClass: 'fa fa-file-o',
routeName: 'pages.index',
activeRouteRegex: 'pages',
permission: 'pages.index',
Expand Down