Added log out button, corrected buttons
This commit is contained in:
		
							parent
							
								
									01f7fabd6c
								
							
						
					
					
						commit
						c8d10094d9
					
				
							
								
								
									
										9
									
								
								controllers/logout/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								controllers/logout/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | module.exports.index = function(req, res) { | ||||||
|  |     req.session = null; | ||||||
|  |     res.locals.session = null; | ||||||
|  |     res.setHeader('Content-Type', 'text/html'); | ||||||
|  | 
 | ||||||
|  |     res.render('index.jade', res.locals, function(err, out) { | ||||||
|  |         res.send(out); | ||||||
|  |     }); | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								controllers/logout/urls.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								controllers/logout/urls.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | module.exports = { | ||||||
|  |     '/logout': 'index' | ||||||
|  | } | ||||||
							
								
								
									
										38
									
								
								controllers/logout/views/index.jade
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								controllers/logout/views/index.jade
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | |||||||
|  | extends ../../../views/main | ||||||
|  | 
 | ||||||
|  | block title | ||||||
|  |     title #{title} - Index | ||||||
|  | 
 | ||||||
|  | block content | ||||||
|  |     h2 Index | ||||||
|  |     ul | ||||||
|  |         li | ||||||
|  |             a(href="#{urls.bouncing}") A bouncing cube that jumps when you click on it | ||||||
|  |             p. | ||||||
|  |                 Jumps and bounce when you click on it. | ||||||
|  | 
 | ||||||
|  |         li | ||||||
|  |             a(href="#{urls.multisphere}") Sphere with multi-resolution | ||||||
|  |             p. | ||||||
|  |                 Lots of obj files loaded and displayed. When you click | ||||||
|  |                 somewhere, the current obj is hidden and the next one, with a | ||||||
|  |                 better resolution is shown. | ||||||
|  | 
 | ||||||
|  |         li | ||||||
|  |             a(href="#{urls.prototype}") A proto of the real thing | ||||||
|  |             p. | ||||||
|  |                 You can move the camera with the arrow keys and move the angle of | ||||||
|  |                 the camera with 2, 4, 6 and 8 (the arrows of the numpad), or you | ||||||
|  |                 can do a drag-and-drop like (click on the mouse to grap the scene, | ||||||
|  |                 and move the mouse to rotate the camera). You can also select a | ||||||
|  |                 camera by clicking on the red part of it, and get back to the free | ||||||
|  |                 camera by clicking again.  You can also select a camera by simply | ||||||
|  |                 clicking on the object you want to see. The program will choose the | ||||||
|  |                 camera that you want, and move to it progressively. | ||||||
|  | 
 | ||||||
|  |         li | ||||||
|  |             a(href="#{urls.stream}") Streaming simulation | ||||||
|  |             p. | ||||||
|  |                 A mesh of a sphere is fully loaded, and displayed | ||||||
|  |                 progressively.  This test is here to prove that we can | ||||||
|  |                 dynamically add vertices and faces to a mesh. | ||||||
| @ -27,6 +27,7 @@ app.use(bodyParser.json()); | |||||||
| app.use(function(req, res, next) { | app.use(function(req, res, next) { | ||||||
|     res.locals.title = "3DUI"; |     res.locals.title = "3DUI"; | ||||||
|     res.locals.urls = urls; |     res.locals.urls = urls; | ||||||
|  |     res.locals.session = req.session; | ||||||
|     next(); |     next(); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| @ -42,6 +43,11 @@ app.use(function(req, res, next) { | |||||||
|     next(); |     next(); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | app.use(function(req, res, next) { | ||||||
|  |     console.log(req.session.user_id); | ||||||
|  |     next(); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
| // Load controllers
 | // Load controllers
 | ||||||
| console.log("Loading controllers :"); | console.log("Loading controllers :"); | ||||||
| require('./lib/controllers')(app, { verbose: !module.parent }); | require('./lib/controllers')(app, { verbose: !module.parent }); | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								urls.js
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								urls.js
									
									
									
									
									
								
							| @ -8,3 +8,4 @@ module.exports.stream = '/stream/'; | |||||||
| module.exports.reverse = '/prototype/reverse/'; | module.exports.reverse = '/prototype/reverse/'; | ||||||
| module.exports.replay_index = '/prototype/replay/'; | module.exports.replay_index = '/prototype/replay/'; | ||||||
| module.exports.tutorial = '/prototype/tutorial'; | module.exports.tutorial = '/prototype/tutorial'; | ||||||
|  | module.exports.logout = '/logout'; | ||||||
|  | |||||||
| @ -1,3 +1,9 @@ | |||||||
|  | mixin button_link(href) | ||||||
|  |     form.navbar-form.navbar-left(role="search", action="#{href}", method='GET') | ||||||
|  |         button.btn.btn-default(type="submit") | ||||||
|  |             block | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| doctype html | doctype html | ||||||
| html(lang='fr') | html(lang='fr') | ||||||
|     head |     head | ||||||
| @ -45,21 +51,29 @@ html(lang='fr') | |||||||
|                                     a(href="#{urls.tutorial}") Tutorial |                                     a(href="#{urls.tutorial}") Tutorial | ||||||
|                         li |                         li | ||||||
|                             a(href="#{urls.stream}") Streaming simulator |                             a(href="#{urls.stream}") Streaming simulator | ||||||
|  |                         li.divider | ||||||
|  |                         if (session && session.user_id) | ||||||
|  |                             li | ||||||
|  |                                 +button_link(urls.logout) | ||||||
|  |                                     span.glyphicon.glyphicon-log-out(aria-hidden=true, style={"margin-right":"10px"}) | ||||||
|  |                                     span Log out | ||||||
| 
 | 
 | ||||||
|                     ul.navbar-nav.navbar-right |  | ||||||
|                         a.btn.btn-default.navbar-btn(type="button", href="https://github.com/tforgione/3dinterface", style={margin: "0px 5px"}) |  | ||||||
|                             img(src="/static/GitHub-Mark/PNG/GitHub-Mark-32px.png", width="17px") |  | ||||||
|                             span(style={'margin-left':'5px'}) Github Repo |  | ||||||
|                         a.btn.btn-default.navbar-btn(type="button", href="https://github.com/tforgione/3dinterface/wiki", style={margin: "0px 5px"}) |  | ||||||
|                             span.glyphicon.glyphicon-book(aria-hidden=true, style={"margin-right":"10px"}) |  | ||||||
|                             span Github wiki |  | ||||||
| 
 | 
 | ||||||
|                         a.btn.btn-default.navbar-btn(type="button", href="mailto:thomas.forgione@gmail.com", style={'margin-right': "10px", 'margin-left': '5px'}) |                     ul.nav.navbar-nav.navbar-right | ||||||
|  |                         li | ||||||
|  |                             +button_link('https://github.com/tforgione/3dinterface') | ||||||
|  |                                 img(src="/static/GitHub-Mark/PNG/GitHub-Mark-32px.png", width="17px", style={align:vertical}) | ||||||
|  |                                 span(style={'margin-left':'5px', align:vertical}) Github Repo | ||||||
|  |                         li | ||||||
|  |                             +button_link('https://github.com/tforgione/3dinterface/wiki') | ||||||
|  |                                 span.glyphicon.glyphicon-book(aria-hidden=true) | ||||||
|  |                                 span(style={'margin-left':'5px'}) Github wiki | ||||||
|  | 
 | ||||||
|  |                         li | ||||||
|  |                             +button_link('mailto:thomas.forgione@gmail.com') | ||||||
|                                 span.glyphicon.glyphicon-envelope(aria-hidden=true) |                                 span.glyphicon.glyphicon-envelope(aria-hidden=true) | ||||||
|                                 span(style={'margin-left':'5px'}) Contact |                                 span(style={'margin-left':'5px'}) Contact | ||||||
| 
 | 
 | ||||||
|                         div |  | ||||||
| 
 |  | ||||||
|         section#main-section.container |         section#main-section.container | ||||||
|             if alertCookie |             if alertCookie | ||||||
|                 .alert.alert-warning.alert-dismissible(role="alert", style={'margin-top':'20px'}) |                 .alert.alert-warning.alert-dismissible(role="alert", style={'margin-top':'20px'}) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user