Skip to content

Commit

Permalink
Added a presentations module to remoteStorage GH-8
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Jul 9, 2012
1 parent 24adf51 commit cb53f6e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 116 deletions.
1 change: 1 addition & 0 deletions client/src/main.coffee
Expand Up @@ -11,6 +11,7 @@ requirejs.config(
'vendor/amd/jszip-deflate': ['vendor/amd/jszip']
'vendor/amd/remoteStorage':
exports: 'remoteStorage'
'vendor/amd/presentations': ['vendor/amd/remoteStorage']
)

window.browserPrefix = ""
Expand Down
7 changes: 5 additions & 2 deletions client/src/storage/FileStorage.coffee
@@ -1,6 +1,9 @@
define([],
() ->
define(["vendor/amd/remoteStorage",
"vendor/amd/presentations"],
(remoteStorage, empty) ->
prefix = "Strut_"
remoteStorage.loadModule('presentations', '0.1', 'rw')
console.log remoteStorage.presentations.public
class FileStorage
constructor: () ->
# this should be configurable!
Expand Down
3 changes: 2 additions & 1 deletion client/web/scripts/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion client/web/scripts/storage/FileStorage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions client/web/scripts/vendor/amd/presentations.js
@@ -0,0 +1,44 @@
remoteStorage.defineModule('presentations', function(myPrivateBaseClient, myPublicBaseClient) {
var type = 'presentation';
function PresentationStorage(client) {
this.client = client;
}

PresentationStorage.prototype = {
list: function(directory) {
return this.client.getListing(directory + '/'); // TODO: do I need to do any trimming of /'s?
},

get: function(path) {
return this.client.getObject(path);
},

set: function(path, presentation) {
this.client.storeObject(type, path, presentation);
return this;
},

remove: function(path) {
this.client.remove(path); // TODO: directory removal?
return this;
}
};

return {
name: 'presentations',
dataVersion: '0.1',
dataHints: {
"module": "Presentations are things that you present or talk about to a group",

"objectType presentation": "Work to be presented",

"directory presentations/": "Default location for private presentations",
"directory public/presentations/": "Default location for public presentations"
},
codeVersion: '0.1.0',
exports: {
public: new PresentationStorage(myPublicBaseClient),
private: new PresentationStorage(myPrivateBaseClient)
}
};
});
112 changes: 0 additions & 112 deletions client/web/scripts/vendor/amd/tasks-0.1.js

This file was deleted.

0 comments on commit cb53f6e

Please sign in to comment.