Skip to content

Instantly share code, notes, and snippets.

@riking
Created August 26, 2015 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riking/7edf7e695c8ebec8af20 to your computer and use it in GitHub Desktop.
Save riking/7edf7e695c8ebec8af20 to your computer and use it in GitHub Desktop.
import binarySearch from 'discourse/plugins/discourse-data-explorer/discourse/lib/binary-search';
export default Ember.Component.extend({
tagName: 'td',
user: function() {
const valueInt = parseInt(this.get('value'));
const userRelAry = this.get('extra.relations.user');
const idx = binarySearch(userRelAry, valueInt);
return userRelAry[idx];
}.property('extra.relations', 'value')
});
{{#if user}}
<a href="/users/{{user.username}}/activity">{{avatar user imageSize="tiny"}} {{user.username}}</a>
{{else}}
User #{{value}} (deleted)
{{/if}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment