2015-02-07 06:32:59 +08:00
|
|
|
export default Ember.Component.extend({
|
|
|
|
tagName: 'li',
|
|
|
|
classNameBindings: ['active'],
|
|
|
|
|
|
|
|
router: function() {
|
|
|
|
return this.container.lookup('router:main');
|
|
|
|
}.property(),
|
|
|
|
|
2015-07-06 23:18:12 +08:00
|
|
|
fullPath: function() {
|
|
|
|
return Discourse.getURL(this.get('path'));
|
|
|
|
}.property('path'),
|
|
|
|
|
2015-02-07 06:32:59 +08:00
|
|
|
active: function() {
|
2015-02-12 00:53:06 +08:00
|
|
|
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);
|
2015-02-07 06:32:59 +08:00
|
|
|
}.property('router.url', 'route')
|
|
|
|
});
|