Show listings of a path

This commit is contained in:
2017-11-12 04:03:13 +01:00
parent ff2f44df18
commit 0607d82e50
13 changed files with 106 additions and 23 deletions

View File

@@ -2,6 +2,7 @@ import Controller from '@ember/controller';
import EmberObject from '@ember/object';
import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import { isPresent } from '@ember/utils';
export default Controller.extend({
@@ -11,18 +12,24 @@ export default Controller.extend({
connected: alias('storage.connected'),
categories: alias('storage.categories'),
queryParams: ['path'],
currentListing: function() {
if (isPresent(this.get('model'))) {
return this.get('model');
}
if (!this.get('categories')) { return null; }
const listing = [];
this.get('categories').forEach(categoryName => {
listing.pushObject(EmberObject.create({
listing.push(EmberObject.create({
name: categoryName,
type: 'folder'
}));
});
return listing;
}.property('categories.[]')
}.property('categories.[]', 'model.[]')
});