1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Rename/fix post stream

This commit is contained in:
Toby Zerner
2015-01-07 17:23:27 +10:30
parent ff6c7455f5
commit 2800a7e0cc
5 changed files with 12 additions and 56 deletions

View File

@@ -1,44 +0,0 @@
import Ember from 'ember';
// Represents a collection of results (e.g. a list of discussions)
export default Ember.Object.extend({
// An array of the results.
results: Em.A(),
// The currently-active result.
currentResult: null,
sort: null,
// The index of the currently-active result (determined by ID.) Returns '?'
// if the currently-active result is not in the results list.
index: function() {
var index = '?';
var id = this.get('currentResult.id');
this.get('results').some(function(result, i) {
if (result.get('id') == id) {
index = i + 1;
return true;
}
});
return index;
}.property('currentResult', 'results'),
// The number of results.
count: function() {
return this.get('results.length');
}.property('results'),
// The previous result.
previous: function() {
return this.get('results').objectAt(this.get('index') - 2);
}.property('index'),
// The next result.
next: function() {
return this.get('results').objectAt(this.get('index'));
}.property('index'),
});