@@ -153,6 +153,34 @@ angular.module('myApp')
153153
154154} ) // end lessonsSideBarDirective
155155
156+ angular . module ( 'myApp' )
157+
158+ . controller ( 'lessonTestsController' , [ "$scope" , function ( $scope ) {
159+
160+ } ] )
161+
162+ angular . module ( 'myApp' )
163+
164+ . directive ( 'lessonTestsDirective' , function ( ) {
165+
166+ return {
167+ restrict : 'A' ,
168+ controller : 'lessonTestsController' ,
169+ link : function ( scope , ele , attr ) {
170+
171+ $ ( '.lesson-test' ) . click ( function ( ) {
172+ let testsParents = this . parentNode . parentNode . parentNode . parentNode ;
173+ // console.log(testsParents.id); // id of parent lesson name
174+ // $('.lesson-tests-wrapper').html('<span>' + testsParents.id + '</span>');
175+ $ ( '.lesson-tests-wrapper' ) . load ( './html/lessonTests/lessonFiles/' + testsParents . id + '.html' ) ;
176+ $ ( 'html, body' ) . animate ( { scrollTop : 0 } , 300 ) ;
177+ } )
178+
179+ }
180+ }
181+
182+ } )
183+
156184angular . module ( 'myApp' )
157185. controller ( 'loginController' , [ "$scope" , "loginService" , function ( $scope , loginService ) {
158186
@@ -247,31 +275,35 @@ angular.module("myApp")
247275
248276angular . module ( 'myApp' )
249277
250- . controller ( 'lessonTestsController' , [ "$scope" , function ( $scope ) {
278+ . controller ( 'navigationController' , [ "$scope" , "loginService" , function ( $scope , loginService ) {
279+
280+ $scope . logoutUser = function ( ) {
281+ loginService . logoutUser ( ) ;
282+ } ;
251283
252284} ] )
253285
254286angular . module ( 'myApp' )
255287
256- . directive ( 'lessonTestsDirective ' , function ( ) {
288+ . directive ( 'navigationDirective ' , function ( ) {
257289
258290 return {
259- restrict : 'A ' ,
260- controller : 'lessonTestsController ' ,
291+ restrict : 'E ' ,
292+ templateUrl : './html/navigation/navigationTemplate.html ' ,
261293 link : function ( scope , ele , attr ) {
294+ let profileMenu = $ ( '#menu-navigation' ) ;
262295
263- $ ( '.lesson-test' ) . click ( function ( ) {
264- let testsParents = this . parentNode . parentNode . parentNode . parentNode ;
265- // console.log(testsParents.id); // id of parent lesson name
266- // $('.lesson-tests-wrapper').html('<span>' + testsParents.id + '</span>');
267- $ ( '.lesson-tests-wrapper' ) . load ( './html/lessonTests/lessonFiles/' + testsParents . id + '.html' ) ;
268- $ ( 'html, body' ) . animate ( { scrollTop : 0 } , 300 ) ;
296+ $ ( '#profile-wrapper' ) . click ( function ( ) {
297+ profileMenu . toggle ( 'expand' )
269298 } )
270299
300+ profileMenu . click ( function ( ) {
301+ profileMenu . toggle ( 'expand' ) ;
302+ } )
271303 }
272304 }
273305
274- } )
306+ } ) // end navigationDirective
275307
276308angular . module ( 'myApp' )
277309 . controller ( 'mountainController' , [ '$scope' , 'loginService' , function ( $scope , loginService ) {
@@ -379,35 +411,3 @@ angular.module( 'myApp' )
379411 return dirDefinition ;
380412
381413 } ) // end mountainDirective
382-
383- angular . module ( 'myApp' )
384-
385- . controller ( 'navigationController' , [ "$scope" , "loginService" , function ( $scope , loginService ) {
386-
387- $scope . logoutUser = function ( ) {
388- loginService . logoutUser ( ) ;
389- } ;
390-
391- } ] )
392-
393- angular . module ( 'myApp' )
394-
395- . directive ( 'navigationDirective' , function ( ) {
396-
397- return {
398- restrict : 'E' ,
399- templateUrl : './html/navigation/navigationTemplate.html' ,
400- link : function ( scope , ele , attr ) {
401- let profileMenu = $ ( '#menu-navigation' ) ;
402-
403- $ ( '#profile-wrapper' ) . click ( function ( ) {
404- profileMenu . toggle ( 'expand' )
405- } )
406-
407- profileMenu . click ( function ( ) {
408- profileMenu . toggle ( 'expand' ) ;
409- } )
410- }
411- }
412-
413- } ) // end navigationDirective
0 commit comments