From 78215a7f5509409ab52795d93d536fade9b4c9cd Mon Sep 17 00:00:00 2001 From: Jason White Date: Sun, 13 Sep 2015 00:15:19 -0400 Subject: [PATCH] #28 reimplemented for 7.0/Backbone implementation --- .../main/webapp/WEB-INF/pages/main_new.jsp | 4 +-- .../js/goatApp/controller/LessonController.js | 7 +++-- .../webapp/js/goatApp/view/MenuButtonView.js | 27 +++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 webgoat-container/src/main/webapp/js/goatApp/view/MenuButtonView.js diff --git a/webgoat-container/src/main/webapp/WEB-INF/pages/main_new.jsp b/webgoat-container/src/main/webapp/WEB-INF/pages/main_new.jsp index dfcf9cda0..87b0cf0d6 100644 --- a/webgoat-container/src/main/webapp/WEB-INF/pages/main_new.jsp +++ b/webgoat-container/src/main/webapp/WEB-INF/pages/main_new.jsp @@ -37,8 +37,6 @@ - WebGoat @@ -51,7 +49,7 @@
-
diff --git a/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js b/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js index 424b654b6..b45b1db1d 100644 --- a/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js +++ b/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js @@ -12,7 +12,8 @@ define(['jquery', 'goatApp/view/ParamView', 'goatApp/model/ParamModel', 'goatApp/support/GoatUtils', - 'goatApp/view/UserAndInfoView' + 'goatApp/view/UserAndInfoView', + 'goatApp/view/MenuButtonView' ], function($, _, @@ -28,7 +29,8 @@ define(['jquery', ParamView, ParamModel, GoatUtils, - UserAndInfoView + UserAndInfoView, + MenuButtonView ) { 'use strict' @@ -43,6 +45,7 @@ define(['jquery', this.listenTo(this.lessonContent,'contentLoaded',this.onContentLoaded); //'static' elements of page/app this.userAndInfoView = new UserAndInfoView(); + this.menuButtonView = new MenuButtonView(); }; //load View, which can pull data this.loadLesson = function(scr,menu,stage) { diff --git a/webgoat-container/src/main/webapp/js/goatApp/view/MenuButtonView.js b/webgoat-container/src/main/webapp/js/goatApp/view/MenuButtonView.js new file mode 100644 index 000000000..b82e62b89 --- /dev/null +++ b/webgoat-container/src/main/webapp/js/goatApp/view/MenuButtonView.js @@ -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(); + } + }); +}); \ No newline at end of file