intial rendering of first page/tab/section of content on load

This commit is contained in:
Jason White 2016-08-18 21:12:15 -04:00
parent 12e2624eee
commit ac433305a9

View File

@ -18,6 +18,7 @@ define(['jquery',
render: function() { render: function() {
this.$el.html(this.model.get('content')); this.$el.html(this.model.get('content'));
this.makeFormsAjax(); this.makeFormsAjax();
this.initPagination();
this.ajaxifyAttackHref(); this.ajaxifyAttackHref();
$(window).scrollTop(0); //work-around til we get the scroll down sorted out $(window).scrollTop(0); //work-around til we get the scroll down sorted out
}, },
@ -35,6 +36,16 @@ define(['jquery',
$("form.attack-form").ajaxForm(options); $("form.attack-form").ajaxForm(options);
}, },
initPagination: function() {
//console.log(this.$el.find('.lesson-page-wrapper').length + ' pages of content');
this.currentPage = 0;
this.$contentPages = this.$el.find('.lesson-page-wrapper');
if (this.$contentPages.length > 1) {
this.$contentPages.hide();
this.$el.find(this.$contentPages[0]).show();
}
},
ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs
var self = this; var self = this;
// The current LessonAdapter#getLink() generates a hash-mark link. It will not match the mask below. // The current LessonAdapter#getLink() generates a hash-mark link. It will not match the mask below.
@ -53,6 +64,16 @@ define(['jquery',
renderFeedback: function(feedback) { renderFeedback: function(feedback) {
this.$el.find('feedback').html(feedback); this.$el.find('feedback').html(feedback);
},
addPaginationControls: function() {
// <div class="panel-body" id="lesson-page-controls">
// <span class="glyphicon-class glyphicon glyphicon-circle-arrow-left" id="show-prev-hint"></span>
// <span class="glyphicon-class glyphicon glyphicon-circle-arrow-right" id="show-next-hint"></span>
// <br/>
//
// </div>
} }
}); });