Show listings of a path
This commit is contained in:
@@ -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.[]')
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user