From e5e0071cb766b1576c442edd4ac18971173208eb Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 23 Jul 2015 06:51:39 +0530 Subject: [PATCH] FIX: non-admin users were not able to see invite tabs --- .../discourse/components/nav-item.js.es6 | 22 +++++++++++++++++++ .../templates/components/nav-item.hbs | 13 +++++++++++ 2 files changed, 35 insertions(+) create mode 100644 app/assets/javascripts/discourse/components/nav-item.js.es6 create mode 100644 app/assets/javascripts/discourse/templates/components/nav-item.hbs diff --git a/app/assets/javascripts/discourse/components/nav-item.js.es6 b/app/assets/javascripts/discourse/components/nav-item.js.es6 new file mode 100644 index 00000000000..c50741820e9 --- /dev/null +++ b/app/assets/javascripts/discourse/components/nav-item.js.es6 @@ -0,0 +1,22 @@ +export default Ember.Component.extend({ + tagName: 'li', + classNameBindings: ['active'], + + router: function() { + return this.container.lookup('router:main'); + }.property(), + + fullPath: function() { + return Discourse.getURL(this.get('path')); + }.property('path'), + + active: function() { + const route = this.get('route'); + if (!route) { return; } + + const routeParam = this.get('routeParam'), + router = this.get('router'); + + return routeParam ? router.isActive(route, routeParam) : router.isActive(route); + }.property('router.url', 'route') +}); diff --git a/app/assets/javascripts/discourse/templates/components/nav-item.hbs b/app/assets/javascripts/discourse/templates/components/nav-item.hbs new file mode 100644 index 00000000000..ec8e0a1e758 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/nav-item.hbs @@ -0,0 +1,13 @@ +{{#if routeParam}} + {{#link-to route routeParam}}{{i18n label}}{{/link-to}} +{{else}} + {{#if route}} + {{#link-to route}}{{i18n label}}{{/link-to}} + {{else}} + {{#if path}} + {{i18n label}} + {{else}} + {{i18n label}} + {{/if}} + {{/if}} +{{/if}}