Sha256: 3761a2eaacb9242ed844f7e768d52bf8a20baf9719d1753c703ebb0c0f8d5e12

Contents?: true

Size: 793 Bytes

Versions: 3

Compression:

Stored size: 793 Bytes

Contents

(function($) {
  $.widget('pageflow.parentPageButton', {
    _create: function() {
      var element = this.element;

      element.click(function(event) {
        pageflow.slides.goToParentPage();
        event.preventDefault();
      });

      pageflow.slides.on('pageactivate', function(e, ui) {
        update();
      });

      update();

      function update() {
        var pagePermaId = parseInt(pageflow.slides.currentPage().attr('id'), 10);
        var chapterId = pageflow.entryData.getChapterIdByPagePermaId(pagePermaId);
        var chapterConfiguration = pageflow.entryData.getChapterConfiguration(chapterId);

        element.toggle(pageflow.slides.parentPageExists() &&
                       chapterConfiguration.display_parent_page_button);
      }
    }
  });
}(jQuery));

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pageflow-0.9.2 app/assets/javascripts/pageflow/widgets/parent_page_button.js
pageflow-0.9.1 app/assets/javascripts/pageflow/widgets/parent_page_button.js
pageflow-0.9.0 app/assets/javascripts/pageflow/widgets/parent_page_button.js