From 6d15160966c535f6ddf7f3139d81f8ade9fa304b Mon Sep 17 00:00:00 2001 From: zefanja Date: Fri, 14 Feb 2014 13:48:28 +0700 Subject: * added book title to cha --- assets/back.png | Bin 289 -> 384 bytes lib/sword | 2 +- source/App.css | 6 ++++++ source/bcSelector.js | 19 ++++++++++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/assets/back.png b/assets/back.png index 918eedc..1dcdac2 100644 Binary files a/assets/back.png and b/assets/back.png differ diff --git a/lib/sword b/lib/sword index 7420c0b..7cd74d3 160000 --- a/lib/sword +++ b/lib/sword @@ -1 +1 @@ -Subproject commit 7420c0b47b03884e14a54631a1cb6bb8491afa1f +Subproject commit 7cd74d363e4d8fca0355de9abc6edbd19be6f100 diff --git a/source/App.css b/source/App.css index fcd3296..9efc318 100644 --- a/source/App.css +++ b/source/App.css @@ -144,6 +144,12 @@ background-color: #F0E68C; } +.text-ellipsis { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + /* POPUPs */ .message-popup { text-align: center; diff --git a/source/bcSelector.js b/source/bcSelector.js index 43a5231..ab75075 100644 --- a/source/bcSelector.js +++ b/source/bcSelector.js @@ -23,9 +23,9 @@ enyo.kind({ ]} ]}, {name: "chapterPanel", kind: "enyo.FittableRows", components: [ - {kind: "onyx.Toolbar", components: [ - {kind: "onyx.IconButton", src: "assets/back.png", ontap: "handleBack"}, - {content: $L("Chapters")} + {name: "tbChapter", kind: "onyx.Toolbar", components: [ + {kind: "onyx.IconButton", src: "assets/back.png", ontap: "handleBack"}, + {name: "chapterLabel", content: $L("Chapters"), classes: "text-ellipsis"} ]}, {kind: "enyo.Scroller", fit: true, touch: true, components: [ {name: "chapterRepeater", kind: "Repeater", count: 0, onSetupItem: "setChapterItems", components: [ @@ -68,7 +68,14 @@ enyo.kind({ handleBook: function (inSender, inEvent) { this.currentBook = this.books[inEvent.index]; this.$.chapterRepeater.setCount(this.currentBook.maxChapter); + this.$.chapterLabel.setContent($L("Chapters in ") + this.currentBook.name); this.$.bcPanel.setIndex(1); + //truncate text if the label's width is longer than window.innerWidth + if(window.innerWidth - 60 < this.$.chapterLabel.hasNode().clientWidth) { + var w = this.$.tbChapter.hasNode().clientWidth - 60 + "px"; + this.$.chapterLabel.applyStyle("width", w); + } + }, setChapterItems: function (inSender, inEvent) { @@ -78,5 +85,11 @@ enyo.kind({ handleChapter: function (inSender, inEvent) { this.doSelect({book: this.currentBook, chapter: inEvent.index+1, osis: this.currentBook.abbrev + "." + (inEvent.index+1), label: this.currentBook.abbrev + " " + (inEvent.index+1)}); this.$.bcPanel.setIndex(0); + }, + + resizeHandler: function () { + this.inherited(arguments); + var w = this.$.tbChapter.hasNode().clientWidth - 60 + "px"; + this.$.chapterLabel.applyStyle("width", w); } }); \ No newline at end of file -- cgit