Permalink
Browse files

Add remote home

  • Loading branch information...
1 parent 30068f4 commit 54baa853264845c099215ce7dfbcea85e4f275c3 @Techniv committed May 22, 2012
Showing with 41 additions and 10 deletions.
  1. +25 −6 libs/http-server/http-serv.js
  2. +1 −1 package.json
  3. +11 −2 views/layout_default.ejs
  4. +2 −0 views/remote-home.ejs
  5. +2 −1 views/slideshow-list.ejs
@@ -20,7 +20,7 @@ var paths = {
eventManager.on('ready', function(){
app.configure(function(){
- app.use(express.static(paths.root));
+ app.use(express['static'](paths.root));
app.set('views', paths.views);
app.set('view engine','ejs');
app.set('view options',{
@@ -43,23 +43,32 @@ eventManager.on('ready', function(){
var indexItem = index[i];
entry.id = indexItem.id;
entry.name = indexItem.name;
- entry.viewLink = '/slideshow/'+entry.id+'/view'
+ entry.viewLink = '/slideshow/'+entry.id+'/view';
+ entry.remoteLink = '/slideshow/'+entry.id+'/remote';
data.index[entry.id] = entry;
}
}
+ data.title = 'liste';
res.render('slideshow-list', data);
});
app.get('/slideshow/:id/view', function(req,res){
var args = req.params;
console.info('Requesting on /slideshow/view/'+args.id);
- var meta = slidesBrowser.getSlideMeta(args.id);
- meta.layout = 'layout_slide-viewer.ejs';
- meta.resourcePath = '/slideshow/'+args.id+'/resources/';
+ var meta = prepareMeta(args.id,{layout: 'layout_slide-viewer.ejs'});
res.render(meta.mainPath, meta);
});
+ app.get('/slideshow/:id/remote', function(req, res){
+ var args = req.params;
+ var meta = prepareMeta(args.id,{
+ title: 'remote slideshow'
+ });
+
+ res.render('remote-home', meta);
+ });
+
app.get('/slideshow/:id/resources/:resourceHandle/:resource', function(req,res){
console.info('Requesting ressouce on '+req.url);
var args = req.params;
@@ -95,7 +104,17 @@ eventManager.on('ready', function(){
res.end(data,resourceIndex.fileType);
});
}
- })
+ });
+
+ function prepareMeta(id,options){
+ var meta = slidesBrowser.getSlideMeta(id);
+ for(var property in options){
+ meta[property] = options[property];
+ }
+ meta.resourcePath = '/slideshow/'+id+'/resources/';
+ meta.viewLink = '/slideshow/'+id+'/view';
+ meta.remoteLink = '/slideshow/'+id+'/remote';
+ }
});
module.exports = app;
View
@@ -7,6 +7,6 @@
"colors": ">= 0.6.0",
"express": ">= 2.5.0",
"ejs": ">= 0.6.0",
- "cmd-conf": ">= 0.2.0"
+ "cmd-conf": ">= 0.2.1"
}
}
@@ -1,9 +1,18 @@
+<%
+ if(locals.title == undefined) {
+ title ='';
+ windowTitle = 'SlideShow';
+ } else {
+ windowTitle = 'SlideShow - '+title;
+ }
+%>
+
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
- <title>SlideShow List</title>
+ <title><%=windowTitle%></title>
<meta name="description" content="" />
<meta name="author" content="Vincent" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
@@ -14,7 +23,7 @@
<body>
<div>
<header>
- <h1>layout_default</h1>
+ <h1><%=title%></h1>
</header>
<nav>
@@ -0,0 +1,2 @@
+Rejoindre<br/>
+Créer
@@ -12,7 +12,8 @@
<div class='slideshow item'>
<h3 class='slideshow title'><%=entry.name%></h3>
<ul>
- <li><a href='<%=entry.viewLink%>'>Voir</a></li>
+ <li><a href="<%=entry.viewLink%>">Voir</a></li>
+ <li><a href="<%=entry.remoteLink%>">Remote</a></li>
</ul>
</div>
<% } %>

0 comments on commit 54baa85

Please sign in to comment.