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/directory-toggle.js.es6
Robin Ward 7ef306cd3b A bunch of tweaks to the Users directory
- Move user directory from `/directory` to `/users/`
- Defaults to 'weekly' time period
- Don't include deleted topics/posts in the results
- Move heart icon to header instead of on each row
- "Users" instead of "Users found"
2015-03-19 12:29:38 -04:00

35 lines
849 B
JavaScript

import StringBuffer from 'discourse/mixins/string-buffer';
import { iconHTML } from 'discourse/helpers/fa-icon';
export default Ember.Component.extend(StringBuffer, {
tagName: 'th',
classNames: ['sortable'],
rerenderTriggers: ['order', 'asc'],
renderString(buffer) {
const icon = this.get('icon');
if (icon) {
buffer.push(iconHTML(icon));
}
const field = this.get('field');
buffer.push(I18n.t('directory.' + field));
if (field === this.get('order')) {
buffer.push(iconHTML(this.get('asc') ? 'chevron-up' : 'chevron-down'));
}
},
click() {
const currentOrder = this.get('order'),
field = this.get('field');
if (currentOrder === field) {
this.set('asc', this.get('asc') ? null : true);
} else {
this.setProperties({ order: field, asc: null });
}
}
});