From 328556250b7168ab5bf1f7ae245b4f4f756a3c3b Mon Sep 17 00:00:00 2001 From: zefanja Date: Fri, 3 Jan 2014 07:19:54 +0700 Subject: * fixed bug in api.getUserData() * fixed bug in dataView (data won't refresh if you select the same category) * improved Module Manager to persist downloaded modules to improve UX --- source/dataView.js | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'source/dataView.js') diff --git a/source/dataView.js b/source/dataView.js index c9444a8..e5d3a21 100644 --- a/source/dataView.js +++ b/source/dataView.js @@ -39,19 +39,19 @@ enyo.kind({ return true; }, + updateSection: function (inSection) { + if(inSection) + this.section = inSection; + this.sectionChanged(); + }, + sectionChanged: function (inSender, inEvent) { if (this.section === "bookmarks") { this.$.rbBm.setActive(true); api.getAllBookmarks(enyo.bind(this, function (inError, inData) { if(!inError) { this.data = inData; - this.$.dataList.setCount(this.data.length); - if(this.data.length === 0) { - this.$.noData.show(); - this.$.noData.setContent($L("No Bookmarks.") + " " + $L("Tap on a verse number to add one.")); - } else - this.$.noData.hide(); - this.$.dataList.refresh(); + this.updateList(); } else this.handleError(inError); })); @@ -60,12 +60,7 @@ enyo.kind({ api.getAllNotes(enyo.bind(this, function (inError, inData) { if(!inError) { this.data = inData; - this.$.dataList.setCount(this.data.length); - if(this.data.length === 0) { - this.$.noData.show(); - this.$.noData.setContent($L("No Bookmarks.") + " " + $L("Tap on a verse number to add one.")); - } else - this.$.noData.hide(); + this.updateList(); this.$.dataList.refresh(); } else this.handleError(inError); @@ -75,19 +70,29 @@ enyo.kind({ api.getAllHighlights(enyo.bind(this, function (inError, inData) { if(!inError) { this.data = inData; - if(this.data.length === 0) { - this.$.noData.show(); - this.$.noData.setContent($L("No Bookmarks.") + " " + $L("Tap on a verse number to add one.")); - } else - this.$.noData.hide(); - this.$.dataList.setCount(this.data.length); - this.$.dataList.refresh(); + this.updateList(); } else this.handleError(inError); })); } }, + updateList: function () { + this.$.dataList.setCount(this.data.length); + if(this.data.length === 0) { + this.$.noData.show(); + if(this.section === "bookmarks") + this.$.noData.setContent($L("No Bookmarks.") + " " + $L("Tap on a verse number to add one.")); + else if(this.section === "note") + this.$.noData.setContent($L("No Notes.") + " " + $L("Tap on a verse number to add one.")); + else if(this.section === "highlights") + this.$.noData.setContent($L("No Highlights.") + " " + $L("Tap on a verse number to add one.")); + } else + this.$.noData.hide(); + this.$.dataList.refresh(); + this.$.dataList.reflow(); + }, + setupItem: function(inSender, inEvent) { var data = this.data[inEvent.index]; this.$.itemOsis.setContent(api.formatOsis(data.osisRef)); -- cgit