Move loading of developer controls so they do not reload every time. Also reload current lesson after reloading labels. Ref webgoat/webgoat#93.

This commit is contained in:
Daniel Kvist 2016-03-31 22:56:17 +02:00
parent 2be4248ea3
commit 58ae7f3727
3 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,6 @@ define(['jquery',
'goatApp/view/CookieView', 'goatApp/view/CookieView',
'goatApp/view/ParamView', 'goatApp/view/ParamView',
'goatApp/model/ParamModel', 'goatApp/model/ParamModel',
'goatApp/view/DeveloperControlsView',
'goatApp/support/GoatUtils', 'goatApp/support/GoatUtils',
'goatApp/view/UserAndInfoView', 'goatApp/view/UserAndInfoView',
'goatApp/view/MenuButtonView', 'goatApp/view/MenuButtonView',
@ -31,7 +30,6 @@ define(['jquery',
CookieView, CookieView,
ParamView, ParamView,
ParamModel, ParamModel,
DeveloperControlsView,
GoatUtils, GoatUtils,
UserAndInfoView, UserAndInfoView,
MenuButtonView, MenuButtonView,
@ -118,7 +116,6 @@ define(['jquery',
this.sourceView = new SourceView(); this.sourceView = new SourceView();
this.lessonHintView = new HintView(); this.lessonHintView = new HintView();
this.cookieView = new CookieView(); this.cookieView = new CookieView();
this.developerControlsView = new DeveloperControlsView();
//TODO: instantiate model with values (not sure why was not working before) //TODO: instantiate model with values (not sure why was not working before)
var paramModel = new ParamModel({}); var paramModel = new ParamModel({});

View File

@ -22,9 +22,9 @@ function(
}, },
onLabelsLoaded: function(model) { onLabelsLoaded: function(model) {
$('#' + model.id).find('td').text('Enabled: ' + model.enabled);
this.models[1] = model; this.models[1] = model;
this.render(); this.render();
Backbone.history.loadUrl(Backbone.history.getFragment());
}, },
initialize: function(options) { initialize: function(options) {

View File

@ -4,17 +4,20 @@ define(['jquery',
'goatApp/controller/LessonController', 'goatApp/controller/LessonController',
'goatApp/controller/MenuController', 'goatApp/controller/MenuController',
'goatApp/view/LessonContentView', 'goatApp/view/LessonContentView',
'goatApp/view/MenuView' 'goatApp/view/MenuView',
'goatApp/view/DeveloperControlsView'
], function ($, ], function ($,
_, _,
Backbone, Backbone,
LessonController, LessonController,
MenuController, MenuController,
LessonContentView, LessonContentView,
MenuView) { MenuView,
DeveloperControlsView) {
var lessonView = new LessonContentView(); var lessonView = new LessonContentView();
var menuView = new MenuView(); var menuView = new MenuView();
var developerControlsView = new DeveloperControlsView();
var GoatAppRouter = Backbone.Router.extend({ var GoatAppRouter = Backbone.Router.extend({
routes: { routes: {
@ -25,11 +28,11 @@ define(['jquery',
}, },
lessonController: new LessonController({ lessonController: new LessonController({
lessonView:lessonView lessonView: lessonView
}), }),
menuController: new MenuController({ menuController: new MenuController({
menuView:menuView menuView: menuView
}), }),
init:function() { init:function() {