|
@@ -29,6 +29,7 @@
|
|
|
* @param {Object} options
|
|
* @param {Object} options
|
|
|
* @param {AssistHelper} options.assistHelper
|
|
* @param {AssistHelper} options.assistHelper
|
|
|
* @param {Object} options.definition
|
|
* @param {Object} options.definition
|
|
|
|
|
+ * @param {Function} options.currentDirectory - The observable keeping track of the current open directory
|
|
|
* @param {HueFolder} options.parent
|
|
* @param {HueFolder} options.parent
|
|
|
* @param {string} options.app - Currently only 'documents' is supported
|
|
* @param {string} options.app - Currently only 'documents' is supported
|
|
|
*
|
|
*
|
|
@@ -36,6 +37,7 @@
|
|
|
*/
|
|
*/
|
|
|
function HueFileEntry (options) {
|
|
function HueFileEntry (options) {
|
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
+ self.currentDirectory = options.currentDirectory;
|
|
|
self.parent = options.parent;
|
|
self.parent = options.parent;
|
|
|
self.definition = options.definition;
|
|
self.definition = options.definition;
|
|
|
self.assistHelper = options.assistHelper;
|
|
self.assistHelper = options.assistHelper;
|
|
@@ -45,6 +47,8 @@
|
|
|
self.path = self.definition.name;
|
|
self.path = self.definition.name;
|
|
|
self.app = options.app;
|
|
self.app = options.app;
|
|
|
|
|
|
|
|
|
|
+ self.selected = ko.observable(false);
|
|
|
|
|
+
|
|
|
self.loaded = ko.observable(false);
|
|
self.loaded = ko.observable(false);
|
|
|
self.loading = ko.observable(false);
|
|
self.loading = ko.observable(false);
|
|
|
self.hasErrors = ko.observable(false);
|
|
self.hasErrors = ko.observable(false);
|
|
@@ -63,6 +67,20 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ HueFileEntry.prototype.toggleSelected = function () {
|
|
|
|
|
+ var self = this;
|
|
|
|
|
+ self.selected(! self.selected());
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ HueFileEntry.prototype.open = function () {
|
|
|
|
|
+ var self = this;
|
|
|
|
|
+ if (self.definition.type === 'directory') {
|
|
|
|
|
+ self.currentDirectory(self);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ window.location.href = self.definition.absoluteUrl;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
HueFileEntry.prototype.load = function () {
|
|
HueFileEntry.prototype.load = function () {
|
|
|
var self = this;
|
|
var self = this;
|
|
|
if (self.loading()) {
|
|
if (self.loading()) {
|
|
@@ -80,6 +98,7 @@
|
|
|
});
|
|
});
|
|
|
self.entries($.map(cleanEntries, function (definition) {
|
|
self.entries($.map(cleanEntries, function (definition) {
|
|
|
return new HueFileEntry({
|
|
return new HueFileEntry({
|
|
|
|
|
+ currentDirectory: self.currentDirectory,
|
|
|
assistHelper: self.assistHelper,
|
|
assistHelper: self.assistHelper,
|
|
|
definition: definition,
|
|
definition: definition,
|
|
|
app: self.app,
|
|
app: self.app,
|