Sha256: 466f9c939669a8bd12b38145c091f7e686d5871714d501b62d6a80c6df359eb8
Contents?: true
Size: 1.77 KB
Versions: 3
Compression:
Stored size: 1.77 KB
Contents
pageflow.ChapterFilter = pageflow.Object.extend({ initialize: function(entryData) { this.entry = entryData; }, strategies: { all: function() { return true; }, non: function() { return false; }, current_chapter: function(currentChapterId, otherChapterId) { return otherChapterId === currentChapterId; }, inherit_from_parent: function(currentChapterId, otherChapterId) { return this.chapterVisibleFromChapter(this.entry.getParentChapterId(currentChapterId), otherChapterId); }, same_parent_page: function(currentChapterId, otherChapterId) { return this.entry.getParentPagePermaId(currentChapterId) === this.entry.getParentPagePermaId(otherChapterId); }, same_parent_chapter: function(currentChapterId, otherChapterId) { return this.entry.getParentChapterId(currentChapterId) === this.entry.getParentChapterId(otherChapterId); } }, chapterVisibleFromPage: function(currentPagePermaId, chapterId) { var currentChapterId = this.entry.getChapterIdByPagePermaId(currentPagePermaId); return this.chapterVisibleFromChapter(currentChapterId, chapterId); }, chapterVisibleFromChapter: function(currentChapterId, otherChapterId) { return this.getStrategy(currentChapterId) .call(this, currentChapterId, otherChapterId); }, getStrategy: function(chapterId) { return this.strategies[this.getNavigationBarMode(chapterId)] || this.strategies.all; }, getNavigationBarMode: function(chapterId) { return this.entry.getChapterConfiguration(chapterId).navigation_bar_mode; } }); pageflow.ChapterFilter.strategies = _(pageflow.ChapterFilter.prototype.strategies).keys(); pageflow.ChapterFilter.create = function() { return new pageflow.ChapterFilter(pageflow.entryData); };
Version data entries
3 entries across 3 versions & 1 rubygems