First attempt to remove JSP and move to Thymeleaf and update to Spring Boot. The Thymeleaf templates can be loaded as snippets which makes it more easy to move away from ECS and create normal HTML pages for a lesson.
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/CookieCollection'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
CookieCollection) {
|
||||
return Backbone.View.extend({
|
||||
el:'#cookies-view',
|
||||
|
||||
initialize: function() {
|
||||
this.collection = new CookieCollection();
|
||||
this.listenTo(this.collection,'reset',this.render)
|
||||
this.collection.fetch({reset:true});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html('')
|
||||
var cookieTable;
|
||||
this.collection.each(function(model) {
|
||||
cookieTable = $('<table>',{'class':'cookie-table table-striped table-nonfluid'});
|
||||
_.each(model.keys(), function(attribute) {
|
||||
var newRow = $('<tr>');
|
||||
newRow.append($('<th>',{text:_.escape(attribute)}))
|
||||
newRow.append($('<td>',{text:_.escape(model.get(attribute))}));
|
||||
cookieTable.append(newRow);
|
||||
});
|
||||
});
|
||||
this.$el.append($('<h4>',{text:'Cookie/s'}));
|
||||
this.$el.append(cookieTable);
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,67 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/controller/LessonController',
|
||||
'goatApp/controller/MenuController',
|
||||
'goatApp/view/LessonContentView',
|
||||
'goatApp/view/MenuView',
|
||||
'goatApp/view/DeveloperControlsView'
|
||||
], function ($,
|
||||
_,
|
||||
Backbone,
|
||||
LessonController,
|
||||
MenuController,
|
||||
LessonContentView,
|
||||
MenuView,
|
||||
DeveloperControlsView) {
|
||||
|
||||
var lessonView = new LessonContentView();
|
||||
var menuView = new MenuView();
|
||||
var developerControlsView = new DeveloperControlsView();
|
||||
|
||||
var GoatAppRouter = Backbone.Router.extend({
|
||||
routes: {
|
||||
'welcome':'welcomeRoute',
|
||||
'attack/:scr/:menu':'attackRoute',
|
||||
'attack/:scr/:menu/:stage':'attackRoute',
|
||||
'attack/:scr/:menu/*stage/:num':'attackRoute',
|
||||
},
|
||||
|
||||
lessonController: new LessonController({
|
||||
lessonView: lessonView
|
||||
}),
|
||||
|
||||
menuController: new MenuController({
|
||||
menuView: menuView
|
||||
}),
|
||||
|
||||
init:function() {
|
||||
goatRouter = new GoatAppRouter();
|
||||
this.lessonController.start();
|
||||
// this.menuController.initMenu();
|
||||
|
||||
goatRouter.on('route:attackRoute', function(scr,menu,stage,num) {
|
||||
this.lessonController.loadLesson(scr,menu,stage,num);
|
||||
this.menuController.updateMenu(scr,menu);
|
||||
});
|
||||
goatRouter.on('route:welcomeRoute', function() {
|
||||
this.lessonController.loadWelcome();
|
||||
});
|
||||
goatRouter.on("route", function(route, params) {
|
||||
|
||||
});
|
||||
|
||||
Backbone.history.start();
|
||||
this.listenTo(this.lessonController, 'menu:reload',this.reloadMenu)
|
||||
},
|
||||
|
||||
reloadMenu: function (curLesson) {
|
||||
this.menuController.updateMenu();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
return GoatAppRouter;
|
||||
|
||||
});
|
@ -0,0 +1,62 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone'],
|
||||
function($,_,Backbone) {
|
||||
return Backbone.View.extend({
|
||||
el:'#help-controls', //Check this
|
||||
|
||||
initialize: function (options) {
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
this.hasPlan = options.hasPlan;
|
||||
this.hasSolution = options.hasSolution;
|
||||
this.hasSource = options.hasSource;
|
||||
this.hasHints = options.hasHints;
|
||||
},
|
||||
|
||||
render:function(title) {
|
||||
//this.$el.html();
|
||||
// if still showing, hide
|
||||
$('#show-source-button').hide();
|
||||
$('#show-solution-button').hide();
|
||||
$('#show-plan-button').hide();
|
||||
$('#show-hints-button').hide();
|
||||
|
||||
if (this.hasSource) {
|
||||
this.$el.find('#show-source-button').unbind().on('click',_.bind(this.showSource,this)).show();
|
||||
}
|
||||
if (this.hasSolution) {
|
||||
this.$el.find('#show-solution-button').unbind().on('click',_.bind(this.showSolution,this)).show();
|
||||
}
|
||||
if (this.hasPlan) {
|
||||
this.$el.find('#show-plan-button').unbind().on('click',_.bind(this.showPlan,this)).show();
|
||||
}
|
||||
if (this.hasHints) {
|
||||
this.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
|
||||
}
|
||||
|
||||
this.$el.find('#restart-lesson-button').unbind().on('click',_.bind(this.restartLesson,this)).show();
|
||||
//this.$el.append(this.helpButtons.restartLesson);
|
||||
},
|
||||
|
||||
showSource: function() {
|
||||
this.trigger('source:show','source');
|
||||
},
|
||||
|
||||
showSolution: function() {
|
||||
this.trigger('solution:show','solution');
|
||||
},
|
||||
|
||||
showPlan: function() {
|
||||
this.trigger('plan:show','plan');
|
||||
},
|
||||
|
||||
showHints: function() {
|
||||
this.trigger('hints:show','hints');
|
||||
},
|
||||
restartLesson: function() {
|
||||
this.trigger('lesson:restart');
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/SourceModel'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
SourceModel) {
|
||||
return Backbone.View.extend({
|
||||
el:'#lessonHelpWrapper .lessonHelp.lessonPlan', //Check this
|
||||
initialize: function() {
|
||||
this.model = new SourceModel();
|
||||
this.listenTo(this.model,'loaded',this.onModelLoaded);
|
||||
this.model.loadData();
|
||||
},
|
||||
render:function(title) {
|
||||
|
||||
},
|
||||
onModelLoaded: function() {
|
||||
this.trigger(this.loadedMessage,this.helpElement);
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,77 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/HintCollection'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
HintCollection) {
|
||||
return Backbone.View.extend({
|
||||
el:'#lesson-hint-container',
|
||||
events: {
|
||||
"click #show-next-hint": "showNextHint",
|
||||
"click #show-prev-hint": "showPrevHint"
|
||||
},
|
||||
initialize: function() {
|
||||
this.curHint=0;
|
||||
this.collection = new HintCollection();
|
||||
this.listenTo(this.collection,'loaded',this.onModelLoaded);
|
||||
this.hideHints();
|
||||
},
|
||||
|
||||
render:function() {
|
||||
if (this.$el.is(':visible')) {
|
||||
this.$el.hide(350);
|
||||
} else {
|
||||
this.$el.show(350);
|
||||
}
|
||||
|
||||
if (this.collection.length > 0) {
|
||||
this.hideShowPrevNextButtons();
|
||||
}
|
||||
this.displayHint(this.curHint);
|
||||
|
||||
},
|
||||
|
||||
onModelLoaded: function() {
|
||||
this.trigger('hints:loaded',{'helpElement':'hints','value':true})
|
||||
},
|
||||
|
||||
hideHints: function() {
|
||||
if (this.$el.is(':visible')) {
|
||||
this.$el.hide(350);
|
||||
}
|
||||
},
|
||||
|
||||
showNextHint: function() {
|
||||
this.curHint = (this.curHint < this.collection.length -1) ? this.curHint+1 : this.curHint;
|
||||
this.hideShowPrevNextButtons();
|
||||
this.displayHint(this.curHint);
|
||||
},
|
||||
|
||||
showPrevHint: function() {
|
||||
this.curHint = (this.curHint > 0) ? this.curHint-1 : this.curHint;
|
||||
this.hideShowPrevNextButtons();
|
||||
this.displayHint(this.curHint);
|
||||
},
|
||||
|
||||
displayHint: function(curHint) {
|
||||
this.$el.find('#lesson-hint-content').html(this.collection.models[curHint].get('hint'));
|
||||
},
|
||||
|
||||
hideShowPrevNextButtons: function() {
|
||||
if (this.curHint === this.collection.length -1) {
|
||||
this.$el.find('#show-next-hint').css('visibility','hidden');
|
||||
} else {
|
||||
this.$el.find('#show-next-hint').css('visibility','visible');
|
||||
}
|
||||
|
||||
if (this.curHint === 0) {
|
||||
this.$el.find('#show-prev-hint').css('visibility','hidden');
|
||||
} else {
|
||||
this.$el.find('#show-prev-hint').css('visibility','visible');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
@ -0,0 +1,64 @@
|
||||
//LessonContentView
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'libs/jquery.form'],
|
||||
function(
|
||||
$,
|
||||
_,
|
||||
Backbone,
|
||||
JQueryForm) {
|
||||
return Backbone.View.extend({
|
||||
el:'#lesson-content-wrapper', //TODO << get this fixed up in DOM
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.model.get('content'));
|
||||
this.makeFormsAjax();
|
||||
this.ajaxifyAttackHref();
|
||||
$(window).scrollTop(0); //work-around til we get the scroll down sorted out
|
||||
},
|
||||
|
||||
//TODO: reimplement this in custom fashion maybe?
|
||||
makeFormsAjax: function () {
|
||||
var options = {
|
||||
success:this.reLoadView.bind(this),
|
||||
url: this.model.urlRoot,
|
||||
type:'GET'
|
||||
// $.ajax options can be used here too, for example:
|
||||
//timeout: 3000
|
||||
};
|
||||
//hook forms //TODO: clarify form selectors later
|
||||
$("form").ajaxForm(options);
|
||||
},
|
||||
|
||||
ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs
|
||||
var self = this;
|
||||
// The current LessonAdapter#getLink() generates a hash-mark link. It will not match the mask below.
|
||||
// Besides, the new MVC code registers an event handler that will reload the lesson according to the route.
|
||||
$.each($('a[href^="attack?"]'),function(i,el) {
|
||||
var url = $(el).attr('href');
|
||||
$(el).unbind('click').attr('href','#').attr('link',url);
|
||||
//TODO pull currentMenuId
|
||||
$(el).click(function(event) {
|
||||
event.preventDefault();
|
||||
var _url = $(el).attr('link');
|
||||
console.log("About to GET " + _url);
|
||||
$.get(_url)
|
||||
.done(self.reLoadView.bind(self))
|
||||
.fail(function() { alert("failed to GET " + _url); });
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
reLoadView: function(content) {
|
||||
this.model.setContent(content);
|
||||
this.render();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
@ -0,0 +1,27 @@
|
||||
//
|
||||
//UserAndInfoView
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone'],
|
||||
function($,
|
||||
_,
|
||||
Backbone) {
|
||||
return Backbone.View.extend({
|
||||
el:'#toggle-menu', //Check this,
|
||||
|
||||
initialize: function() {
|
||||
this.$el.on('click',this.toggleMenu);
|
||||
},
|
||||
|
||||
toggleMenu: function() {
|
||||
//left
|
||||
if (!$('.sidebarRight').hasClass('.sidebar-toggle-right')) {
|
||||
$('.sidebarRight').removeClass('sidebar-toggle-right');
|
||||
$('.main-content-wrapper').removeClass('main-content-toggle-right');
|
||||
}
|
||||
$('.sidebar').toggleClass('sidebar-toggle');
|
||||
$('.main-content-wrapper').toggleClass('main-content-toggle-left');
|
||||
//e.stopPropagation();
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,30 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/support/GoatUtils',
|
||||
'goatApp/view/MenuItemView'],
|
||||
function(
|
||||
$,
|
||||
_,
|
||||
Backbone,
|
||||
GoatUtils,
|
||||
MenuItemView) {
|
||||
|
||||
return Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.items = options.items;
|
||||
},
|
||||
render: function() {
|
||||
var viewItems = [];
|
||||
for (var i=0;i<this.items.length;i++) {
|
||||
var listItem = $('<li>',{text:this.items[i].name});
|
||||
//viewItems
|
||||
viewItems.push(listItem);
|
||||
}
|
||||
return viewItems;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone'], function($,_,Backbone) {
|
||||
|
||||
return Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
@ -0,0 +1,135 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/MenuCollection',
|
||||
'goatApp/view/MenuItemView',
|
||||
'goatApp/support/GoatUtils'],
|
||||
function(
|
||||
$,
|
||||
_,
|
||||
Backbone,
|
||||
MenuCollection,
|
||||
MenuItemView,
|
||||
GoatUtils) {
|
||||
return Backbone.View.extend({
|
||||
el:'#menu-container',
|
||||
//TODO: set template
|
||||
initialize: function() {
|
||||
this.collection = new MenuCollection();
|
||||
this.addSpinner();
|
||||
this.listenTo(this.collection,'menuData:loaded',this.render);
|
||||
// this.listenTo(this,'menu:click',this.accordionMenu);
|
||||
this.curLessonLinkId = '';
|
||||
},
|
||||
|
||||
addSpinner: function() {
|
||||
//<i class="fa fa-spinner fa-spin"></i>
|
||||
this.$el.append($('<i>',{class:'fa fa-3x fa-spinner fa-spin'}));
|
||||
},
|
||||
|
||||
removeSpinner: function() {
|
||||
this.$el.find('i.fa-spinner').remove();
|
||||
},
|
||||
|
||||
// rendering top level menu
|
||||
render: function (){
|
||||
//for now, just brute force
|
||||
//TODO: refactor into sub-views/components
|
||||
this.removeSpinner();
|
||||
var items, catItems, stages;
|
||||
items = this.collection.models; // top level items
|
||||
var menuMarkup = '';
|
||||
var menuUl = $('<ul>',{class:'nano-content'});
|
||||
for(var i=0;i<items.length;i++) { //CATEGORY LEVEL
|
||||
var catId, category, catLink, catArrow, catLinkText, lessonName, stageName;
|
||||
catId = GoatUtils.makeId(items[i].get('name'));
|
||||
category = $('<li>',{class:'sub-menu ng-scope'});
|
||||
catLink = $('<a>',{'category':catId});
|
||||
catArrow = $('<i>',{class:'fa fa-angle-right pull-right'});
|
||||
catLinkText = $('<span>',{text:items[i].get('name')});
|
||||
|
||||
catLink.append(catArrow);
|
||||
catLink.append(catLinkText);
|
||||
var self = this;
|
||||
catLink.click(_.bind(this.expandCategory,this,catId));
|
||||
category.append(catLink);
|
||||
// lesson level (first children level)
|
||||
//var lessons = new MenuItemView({items:items[i].get('children')}).render();
|
||||
var lessons=items[i].get('children');
|
||||
if (lessons) {
|
||||
var categoryLessonList = $('<ul>',{class:'slideDown lessonsAndStages',id:catId}); //keepOpen
|
||||
for (var j=0; j < lessons.length;j++) {
|
||||
var lessonItem = $('<li>',{class:'lesson'});
|
||||
var lessonName = lessons[j].name;
|
||||
var lessonId = catId + '-' + GoatUtils.makeId(lessonName);
|
||||
if (this.curLessonLinkId === lessonId) {
|
||||
lessonItem.addClass('selected');
|
||||
}
|
||||
var lessonLink = $('<a>',{href:lessons[j].link,text:lessonName,id:lessonId});
|
||||
lessonLink.click(_.bind(this.onLessonClick,this,lessonId));
|
||||
lessonItem.append(lessonLink);
|
||||
//check for lab/stages
|
||||
categoryLessonList.append(lessonItem);
|
||||
if (lessons[j].complete) {
|
||||
lessonItem.append($('<span>',{class:'glyphicon glyphicon-check lesson-complete'}));
|
||||
}
|
||||
var stages = lessons[j].children;
|
||||
for (k=0; k < stages.length; k++) {
|
||||
var stageItem = $('<li>',{class:'stage'});
|
||||
var stageName = stages[k].name;
|
||||
var stageId = lessonId + '-stage' + k;
|
||||
if (this.curLessonLinkId === stageId) {
|
||||
stageItem.addClass('selected');
|
||||
}
|
||||
var stageLink = $('<a>',{href:stages[k].link,text:stageName,id:stageId});
|
||||
stageLink.click(_.bind(this.onLessonClick,this,stageId));
|
||||
stageItem.append(stageLink);
|
||||
categoryLessonList.append(stageItem);
|
||||
if (stages[k].complete) {
|
||||
stageItem.append($('<span>',{class:'glyphicon glyphicon-check lesson-complete'}));
|
||||
}
|
||||
}
|
||||
}
|
||||
category.append(categoryLessonList);
|
||||
}
|
||||
|
||||
menuUl.append(category);
|
||||
}
|
||||
this.$el.html(menuUl);
|
||||
//if we need to keep a menu open
|
||||
if (this.openMenu) {
|
||||
$('#'+this.openMenu).show();
|
||||
}
|
||||
},
|
||||
|
||||
updateMenu: function() {
|
||||
//for now ...
|
||||
this.collection.fetch();
|
||||
},
|
||||
|
||||
onLessonClick: function (elementId) {
|
||||
$('#'+this.curLessonLinkId).removeClass('selected');
|
||||
//update
|
||||
$('#'+elementId).addClass('selected');
|
||||
this.curLessonLinkId = elementId;
|
||||
},
|
||||
|
||||
expandCategory: function (id) {
|
||||
if (id) {
|
||||
this.accordionMenu(id);
|
||||
}
|
||||
},
|
||||
|
||||
accordionMenu: function(id) {
|
||||
if (this.openMenu !== id) {
|
||||
this.$el.find('#' + this.openMenu).slideUp(200);
|
||||
this.$el.find('#' + id).slideDown(300);
|
||||
this.openMenu = id;
|
||||
} else { //it's open
|
||||
this.$el.find('#' + id).slideUp(300).attr('isOpen', 0);
|
||||
this.openMenu = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,36 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/ParamModel'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
ParamModel) {
|
||||
return Backbone.View.extend({
|
||||
el:'#params-view',
|
||||
|
||||
initialize: function(options) {
|
||||
this.model = options.model;
|
||||
if (options.model) {
|
||||
this.listenTo(this.model,'change',this.render);
|
||||
}
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html('');
|
||||
var paramsTable = $('<table>',{'class':'param-table table-striped table-nonfluid'});
|
||||
var self = this;
|
||||
_.each(this.model.keys(), function(attribute) {
|
||||
var attributeLabel = attribute.replace(/Param/,'');
|
||||
var newRow = $('<tr>');
|
||||
newRow.append($('<th>',{text:_.escape(attributeLabel)}))
|
||||
newRow.append($('<td>',{text:_.escape(self.model.get(attribute))}));
|
||||
paramsTable.append(newRow);
|
||||
});
|
||||
|
||||
this.$el.append($('<h4>',{text:'Parameters'}));
|
||||
this.$el.append(paramsTable);
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/LessonPlanModel'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
LessonPlanModel) {
|
||||
return Backbone.View.extend({
|
||||
el:'#lessonHelpWrapper .lessonHelp.lessonPlan', //Check this
|
||||
initialize: function() {
|
||||
this.model = new LessonPlanModel();
|
||||
this.listenTo(this.model,'loaded',this.onModelLoaded);
|
||||
this.model.loadData();
|
||||
},
|
||||
|
||||
render:function(title) {
|
||||
|
||||
},
|
||||
|
||||
onModelLoaded: function() {
|
||||
this.trigger('plan:loaded',{'helpElement':'plan','value':true});
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/SolutionModel'],
|
||||
//TODO: create a base 'HelpView class'
|
||||
function($,_,Backbone,SolutionModel) {
|
||||
return Backbone.View.extend({
|
||||
el:'#lessonHelpWrapper .lessonHelp.lessonSolution', //Check this
|
||||
initialize: function() {
|
||||
this.model = new SolutionModel();
|
||||
this.listenTo(this.model,'loaded',this.onModelLoaded);
|
||||
this.model.loadData();
|
||||
//TODO: handle error cases
|
||||
},
|
||||
render:function(title) {
|
||||
|
||||
},
|
||||
onModelLoaded: function() {
|
||||
this.trigger('solution:loaded',{'helpElement':'solution','value':true});
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/SourceModel',
|
||||
'goatApp/view/HelpView'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
SourceModel,
|
||||
HelpView) {
|
||||
return HelpView.extend({
|
||||
helpElement:{'helpElement':'source','value':true},
|
||||
loadedMessage:'source:loaded',
|
||||
el:'#lessonHelpWrapper .lessonHelp.lessonPlan', //Check this
|
||||
initialize: function() {
|
||||
this.model = new SourceModel();
|
||||
this.listenTo(this.model,'loaded',this.onModelLoaded);
|
||||
this.model.loadData();
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone'],
|
||||
function($,_,Backbone) {
|
||||
return Backbone.View.extend({
|
||||
el:'#header #lesson-title-wrapper',
|
||||
|
||||
render:function(title) {
|
||||
var lessonTitleEl = $('<h1>',{id:'lesson-title',text:title});
|
||||
this.$el.html(lessonTitleEl);
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,45 @@
|
||||
//UserAndInfoView
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone'],
|
||||
function($,
|
||||
_,
|
||||
Backbone) {
|
||||
return Backbone.View.extend({
|
||||
el:'#user-and-info-nav', //Check this,
|
||||
|
||||
events: {
|
||||
'click #about-button': 'showAboutModal',
|
||||
'click #user-menu': 'showUserMenu'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
|
||||
},
|
||||
|
||||
render:function(title) {
|
||||
},
|
||||
|
||||
showUserMenu: function() {
|
||||
var menu = this.$el.find('.dropdown-menu');
|
||||
if (menu.is(':visible')) {
|
||||
menu.hide(200);
|
||||
} else {
|
||||
menu.show(400);
|
||||
/*menu.on('mouseout', function() {
|
||||
$('#user-and-info-nav .dropdown-menu').hide(200);
|
||||
});*/
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
showAboutModal: function() {
|
||||
$('#about-modal').show(400);
|
||||
$('#about-modal div.modal-header button.close, #about-modal div.modal-footer button').unbind('click').on('click', function() {
|
||||
$('#about-modal').hide(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user