ajout de la page de presentation

This commit is contained in:
Antoine WEBER 2015-09-15 18:34:50 +02:00
parent 04ae473f75
commit 9e9737902f
5 changed files with 66 additions and 17 deletions

13
app.js
View File

@ -5,10 +5,10 @@ var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
/*var routes = require('./routes/index');
var users = require('./routes/users');
var file = require('./routes/file');
var channel = require('./routes/channel');
var channel = require('./routes/channel');*/
var app = express();
@ -24,10 +24,11 @@ app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', routes);
app.use('/users', users);
app.use('/file', file);
app.use('/channel', channel);
app.use('/', require('./routes/index'));
app.use('/users', require('./routes/users'));
app.use('/file', require('./routes/file'));
app.use('/channel', require('./routes/channel'));
app.use('/movie', require('./routes/movie'));
// catch 404 and forward to error handler
app.use(function(req, res, next) {

View File

@ -42,16 +42,6 @@ router.get('/:id/:filename', function (req, res, next) {
db.close();
})
module.exports = router;

29
routes/movie.js Normal file
View File

@ -0,0 +1,29 @@
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/:id', function(req, res, next) {
var config = require('../config');
var db = config.init_db();
var data;
db.get("SELECT id,title,original_title,studio,rating,summary,duration,tags_genre,tags_star,year FROM metadata_items WHERE id = ?",req.params.id, function(err, row) {
row.tags_genre = row.tags_genre.split('|');
row.tags_star = row.tags_star.split('|');
row.rating = Math.round(row.rating,2);
data = row;
res.render('movie', { title: 'Détail vidéo',movie: data });
});
db.close();
});
module.exports = router;

View File

@ -15,7 +15,7 @@ block content
each video, i in videos
tr
td
a(href="/file/#{video.id}/#{video.filename}")= video.title
a(href="/movie/#{video.id}")= video.title
if(channel.type == 2)
td
if(typeof video.info_meta !== 'undefined' && typeof video.info_meta.show !== 'undefined')

29
views/movie.jade Normal file
View File

@ -0,0 +1,29 @@
extends layout
block content
h1= movie.title
label Note
p= movie.rating
label Télécharger
a(href="/file/#{movie.id}/#{movie.title}")= movie.title
br
label Résumé
p= movie.summary
br
label Genre
each tag, i in movie.tags_genre
if(tag!='')
span= tag
|  
br
label Acteurs
each tag, i in movie.tags_star
if(tag!='')
span= tag
|  
br