aboutsummaryrefslogtreecommitdiffstats
path: root/source/main.js
diff options
context:
space:
mode:
authorzefanja <zefanja@freenet.de>2013-12-27 21:58:52 +0700
committerzefanja <zefanja@freenet.de>2013-12-27 21:58:52 +0700
commit4befa8b70deb1c413363e43b7ce579b3907b83e6 (patch)
tree454cfe82e6e32f8e7560e573777c6d252d99dc87 /source/main.js
parentcc465575749685e7f633d694c841d1b3ee875fab (diff)
downloadbiblez-ng-4befa8b70deb1c413363e43b7ce579b3907b83e6.tar.gz
* added settings panel
* removed deploy folder → it's in the gh-pages branch (like before) * you test the app under http://zefanja.github.io/biblez-ng/app/
Diffstat (limited to 'source/main.js')
-rw-r--r--source/main.js46
1 files changed, 43 insertions, 3 deletions
diff --git a/source/main.js b/source/main.js
index 3f57ea3..f6b69aa 100644
--- a/source/main.js
+++ b/source/main.js
@@ -4,6 +4,7 @@ enyo.kind({
fit: true,
events: {
onOpenModuleManager: "",
+ onOpenPreferences: "",
onModuleChanged: "",
onOpenBC: ""
},
@@ -22,8 +23,27 @@ enyo.kind({
{kind: "onyx.Menu", name: "moduleMenu"}
]},
{kind: "onyx.Button", name: "btnPassage", ontap: "handleBcSelector"},
- {fit: true},
- {name: "plus", kind: "onyx.IconButton", src: "assets/add.png", style:"position:absolute;right:0;", ontap: "doOpenModuleManager"},
+ //{fit: true},
+ {name: "actionSelector", kind: "onyx.MenuDecorator", onSelect: "actionSelected", components: [
+ {kind: "onyx.IconButton", src: "assets/menu.png"},
+ {kind: "onyx.Menu", name: "actionMenu", style: "width: 200px;", components: [
+ {action: "moduleManager", components: [
+ {kind: "onyx.IconButton", src: "assets/add.png"},
+ {content: $L("Module Manager")}
+ ]},
+ {action: "preferences", components: [
+ {kind: "onyx.IconButton", src: "assets/settings.png"},
+ {content: $L("Preferences")}
+ ]},
+ {action: "bookmarks", components: [
+ {kind: "onyx.IconButton", src: "assets/bookmarks.png"},
+ {content: $L("Bookmarks")}
+ ]}
+
+ ]}
+ ]},
+ //{name: "btnPrefs", kind:"onyx.IconButton", src: "assets/settings.png", ontap: "handlePrefs"},
+ //{name: "plus", kind: "onyx.IconButton", src: "assets/add.png", style:"position:absolute;right:0;", ontap: "doOpenModuleManager"},
{name: "bcPopup", classes: "biblez-bc-popup", kind: "onyx.Popup", modal: true, floating: true, components: [
{kind: "biblez.bcSelector", name: "bcSelector", onSelect: "passageChanged", onBack: "closePopup"}
]}
@@ -78,6 +98,18 @@ enyo.kind({
this.inherited(arguments);
},
+ handleSettings: function (inSender, inEvent) {
+ api.get("settings", enyo.bind(this, function(inError, inSettings) {
+ if(!inError) {
+ this.settings = (inSettings) ? inSettings: this.settings;
+ if(inEvent.setting === "linebreak")
+ this.handlePassage();
+ } else {
+ this.handleError("Couldn't load settings!");
+ }
+ }));
+ },
+
getInstalledModules: function (inSender, inEvent) {
sword.moduleMgr.getModules(enyo.bind(this, function(inError, inModules) {
if (!inError) {
@@ -166,7 +198,7 @@ enyo.kind({
this.handleUnload();
this.$.btnPassage.setContent(this.currentPassage.label);
- this.currentModule.renderText(this.currentPassage.osis, {oneVersePerLine: false}, enyo.bind(this, function (inError, inText) {
+ this.currentModule.renderText(this.currentPassage.osis, {oneVersePerLine: this.settings.linebreak ? this.settings.linebreak : false}, enyo.bind(this, function (inError, inText) {
this.$.spinner.stop();
if(!inError) {
this.$.verseScroller.scrollToTop();
@@ -251,6 +283,14 @@ enyo.kind({
return true;
},
+ /*Action Menu*/
+ actionSelected: function (inSender, inEvent) {
+ if(inEvent.originator.action === "moduleManager")
+ this.doOpenModuleManager();
+ else if(inEvent.originator.action === "preferences")
+ this.doOpenPreferences();
+ },
+
handlePanelIndex: function (inSender, inEvent) {
this.panelIndex = inEvent.toIndex;
},