this.after('initialize', function () { model.sections = []; this.on(document, 'AddSelection', this.addBlankSection); this.on(document, 'StageUpdated', this.updateModel);//stage rerendered this.on(document, 'ThumbNailSelected', this.toggleCurrentSection);//thumbnail swithed this.on(document, 'DeleteSelectedThumbnail', this.deleteCurrentSelection); this.on(document, 'SendPagesToBackend', this.sendHtmlAndXml);//export confirm clicked this.on(document, 'RequestCurrentSection', this.sendCurrentSection); var template = utils.tmpl(progressTmpl); $('body').append(template); //prepare the confirm dialog html });//end of initialize
this.onAddPage = function() { //create thumbnail var newSectionId = this.now(); var param = {id: newSectionId}; var template = utils.tmpl(thumbTmpl); this.select('slideContainer').append(template(param)); //cache new thumbnail var newchild= this.select('slideContainer').children().last(); newchild.data('id', newSectionId);//save data by jquery api thumbitems.push(newchild); //prepare toggle selection this.clearSelection(); //select the new thumbnail newchild.addClass(this.attr.selectedClass); this.notifyModel(newSectionId); //save the current page to delete... currentThumbnail = newchild; };