Sha256: e5a99a5e861fab9660e946a609c8f56edcc45b038b0a23f8260d29234ac366c8

Contents?: true

Size: 1.52 KB

Versions: 64

Compression:

Stored size: 1.52 KB

Contents

pageflow.ChapterFilter = pageflow.Object.extend({
  initialize: function(entryData) {
    this.entry = entryData;
  },

  strategies: {
    non: function() {
      return false;
    },

    current_storyline: function(currentChapterId, otherChapterId) {
      return this.entry.getStorylineIdByChapterId(currentChapterId) ===
        this.entry.getStorylineIdByChapterId(otherChapterId);
    },

    inherit_from_parent: function(currentChapterId, otherChapterId) {
      return this.chapterVisibleFromChapter(this.entry.getParentChapterId(currentChapterId), 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.current_storyline;
  },

  getNavigationBarMode: function(chapterId) {
    var storylineId = this.entry.getStorylineIdByChapterId(chapterId);
    return this.entry.getStorylineConfiguration(storylineId).navigation_bar_mode;
  }
});

pageflow.ChapterFilter.strategies = _(pageflow.ChapterFilter.prototype.strategies).keys();

pageflow.ChapterFilter.create = function() {
  return new pageflow.ChapterFilter(pageflow.entryData);
};

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.2 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.1 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.5.1 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.5.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.4.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.3.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.2.1 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.2.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.1.1 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.1.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.0.0 app/assets/javascripts/pageflow/chapter_filter.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/chapter_filter.js