This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/header-dropdown.js.es6
Sam 086d31d53b UX: when on full page search header search should not pop open
fix `/` handling in full page search to highlight search term
2015-09-18 12:20:59 +10:00

35 lines
844 B
JavaScript

import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: [':header-dropdown-toggle', 'active'],
@computed('showUser')
href(showUser) {
return showUser ? this.currentUser.get('path') : '';
},
active: Ember.computed.alias('toggleVisible'),
actions: {
toggle() {
if (Discourse.Mobile.mobileView && this.get('mobileAction')) {
this.sendAction('mobileAction');
return;
}
if (this.siteSettings.login_required && !this.currentUser) {
this.sendAction('loginAction');
} else {
if (this.get('action')) {
this.sendAction('action');
} else {
this.toggleProperty('toggleVisible');
}
}
this.appEvents.trigger('dropdowns:closeAll');
}
}
});