diff options
author | zefanja <zefanja@freenet.de> | 2013-07-13 19:37:04 +0200 |
---|---|---|
committer | zefanja <zefanja@freenet.de> | 2013-07-13 19:37:04 +0200 |
commit | dbe994f06deed37c4d8c6741d9c4139a9bbeb8cf (patch) | |
tree | 55268c865c47abd1936ac7ebe068ba9ee3b0de1e /source/moduleManager.js | |
parent | f95ccd9d57fb256ff6e10b94b6e8cd320c6648a6 (diff) | |
download | biblez-ng-dbe994f06deed37c4d8c6741d9c4139a9bbeb8cf.tar.gz |
* initial commit
* basic UI
Diffstat (limited to 'source/moduleManager.js')
-rw-r--r-- | source/moduleManager.js | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/source/moduleManager.js b/source/moduleManager.js new file mode 100644 index 0000000..f518dcb --- /dev/null +++ b/source/moduleManager.js @@ -0,0 +1,80 @@ +enyo.kind({ + name: "biblez.moduleManager", + kind: "enyo.FittableRows", + fit: true, + classes: "app-panels", + arrangerKind: "CollapsingArranger", + events: { + onBack: "" + }, + components: [ + {kind: "onyx.MoreToolbar", components: [ + {kind: "onyx.Button", content: $L("<"), ontap: "doBack"}, + {content: $L("Module Manager")}, + {kind: "onyx.PickerDecorator", components: [ + {}, + {name: "repoPicker", kind: "onyx.Picker"} + ]} + ]}, + {name: "panel", kind: "Panels", components: [ + {name: "panelLang", components: [ + {name: "langList", kind: "List", fit: true, onSetupItem: "setupLangItem", components: [ + {classes: "item", ontap: "itemTap", components: [ + {name: "lang"}, + {name: "index", style: "float: right;"} + ]} + ]} + ]}, + {name: "panelModules"}, + {name: "panelDescription"} + ]} + + ], + + lang: [], + repos: [], + modules: [], + + rendered: function () { + this.inherited(arguments); + if (!api.get("lastRepoUpdate")) + this.getRepos(); + else + this.setupRepoPicker(); + }, + + getRepos: function () { + sword.installMgr.getRepositories(enyo.bind(this, function (inError, inRepos) { + console.log(inError, inRepos); + api.set("repos", inRepos); + api.set("lastRepoUpdate", {time: new Date().getTime()}); + this.setupRepoPicker(inRepos); + })); + }, + + setupRepoPicker: function (inRepos) { + if(!inRepos) + inRepos = api.get("repos"); + + var items = []; + inRepos.forEach(function(repo,idx) { + if (repo.name === "CrossWire") items.push({content: repo.name, index: idx, active: true}); + else items.push({content: repo.name, index: idx}); + }); + + this.repos = inRepos; + this.$.repoPicker.createComponents(items, {owner: this}); + this.$.repoPicker.render(); + + + }, + + setupLangItem: function(inSender, inEvent) { + var data = this.lang[inEvent.index]; + //this.$.name.setContent(data.name); + //this.$.index.setContent(inEvent.index); + }, + handleLanguage: function(inSender, inEvent) { + //alert("You tapped on row: " + inEvent.index); + } +});
\ No newline at end of file |