storage: do not hardcode directory list to synchronize in gadget logic
This commit is contained in:
parent
6569a6ffe2
commit
fc36423b57
|
@ -0,0 +1,9 @@
|
|||
/
|
||||
/style/
|
||||
/dev/
|
||||
/dev/codemirror/
|
||||
/dev/codemirror/addon/
|
||||
/dev/codemirror/mode/
|
||||
/dev/codemirror/theme/
|
||||
/dev/test/
|
||||
/priv/
|
|
@ -59,19 +59,7 @@
|
|||
rJS(window)
|
||||
.ready(function () {
|
||||
var gadget = this;
|
||||
|
||||
gadget.directory_list = [
|
||||
"/",
|
||||
"/style/",
|
||||
"/dev/",
|
||||
"/dev/codemirror/",
|
||||
"/dev/codemirror/addon/",
|
||||
"/dev/codemirror/mode/",
|
||||
"/dev/codemirror/theme/",
|
||||
"/dev/test/",
|
||||
"/priv/",
|
||||
];
|
||||
|
||||
gadget.directory_list = [];
|
||||
return RSVP.Queue();
|
||||
})
|
||||
|
||||
|
@ -88,9 +76,19 @@
|
|||
});
|
||||
|
||||
return getDAVStorageConnector(gadget)
|
||||
.push(function(connector) {
|
||||
.push(function (connector) {
|
||||
gadget.dav_storage = connector;
|
||||
return RSVP.Queue();
|
||||
return gadget.local_storage.getAttachment("/dev/", "directory_list.txt", {"format": "text"});
|
||||
})
|
||||
.push(function (text) {
|
||||
return text;
|
||||
}, function (error) {
|
||||
// We couldn't find the file locally, let's try online.
|
||||
// This happens probably because it is the first synchro.
|
||||
return gadget.dav_storage.getAttachment("/dev/", "directory_list.txt", {"format": "text"});
|
||||
})
|
||||
.push(function (text) {
|
||||
gadget.directory_list = text.split('\n');
|
||||
});
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue