From e603610448612cc78e07e6b21f45b19ea9097057 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Wed, 7 Oct 2015 18:03:22 +0200 Subject: [PATCH 1/8] ajout de la page divers + lien de retour --- app.js | 1 + routes/movie.js | 4 ++-- routes/show.js | 5 +++-- routes/show_list.js | 2 +- views/channel.jade | 2 +- views/movie.jade | 12 ++++++++---- views/show.jade | 5 ++++- views/show_list.jade | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 28cfb98..9a71faf 100644 --- a/app.js +++ b/app.js @@ -52,6 +52,7 @@ app.use('/channel', require('./routes/channel')); app.use('/movie', require('./routes/movie')); app.use('/show_list', require('./routes/show_list')); app.use('/show', require('./routes/show')); +app.use('/divers', require('./routes/divers')); // catch 404 and forward to error handler app.use(function(req, res, next) { diff --git a/routes/movie.js b/routes/movie.js index 368a512..c5b6e4a 100644 --- a/routes/movie.js +++ b/routes/movie.js @@ -18,7 +18,7 @@ function humanFileSize(bytes, si) { } /* GET home page. */ -router.get('/:id', function(req, res, next) { +router.get('/:id/:incoming_chan', function(req, res, next) { var config = res.locals.config; var db = config.init_db(); @@ -41,7 +41,7 @@ router.get('/:id', function(req, res, next) { row.file.push(ligne); },function(){ - res.render('movie', { title: 'Détail vidéo',movie: row }); + res.render('movie', { title: 'Détail vidéo',movie: row,channel_id: req.params.incoming_chan }); }); }); diff --git a/routes/show.js b/routes/show.js index c1c2520..c171ef0 100644 --- a/routes/show.js +++ b/routes/show.js @@ -16,7 +16,7 @@ function addZero(v) { }; /* GET home page. */ -router.get('/:id', function(req, res, next) { +router.get('/:id/:incoming_chan', function(req, res, next) { var config = res.locals.config; var db = config.init_db(); var data = []; @@ -58,7 +58,8 @@ router.get('/:id', function(req, res, next) { } res.render('show',{ title: titre, - videos: data + videos: data, + channel_id: req.params.incoming_chan }); }); diff --git a/routes/show_list.js b/routes/show_list.js index 67e18e6..a1aa1a2 100644 --- a/routes/show_list.js +++ b/routes/show_list.js @@ -20,7 +20,7 @@ router.get('/:id', function(req, res, next) { //aprés toute les opération de la base function(){ console.log(shows); - res.render('show_list', { title: 'Liste des séries',shows: shows }); + res.render('show_list', { title: 'Liste des séries',shows: shows, channel: req.params.id }); }); }); diff --git a/views/channel.jade b/views/channel.jade index 0ddfbb6..6f07a9a 100644 --- a/views/channel.jade +++ b/views/channel.jade @@ -13,7 +13,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}")= video.title + a(href="/movie/#{video.id}/#{channel.id}")= video.title td= video.duree td= video.year script. diff --git a/views/movie.jade b/views/movie.jade index 7dc1c00..156c3f2 100644 --- a/views/movie.jade +++ b/views/movie.jade @@ -3,26 +3,30 @@ extends layout block content h1= movie.title + a(href="/channel/#{channel_id}") Retour à la liste + br + br + label Note p= movie.rating label Télécharger br each file, i in movie.file - a(href="/file/#{file.id}/#{file.filename}") #{file.size} #{file.filename} + a(href="/file/#{file.id}/#{file.filename}") #{file.size} #{file.filename} br - + br label Résumé p= movie.summary br - + br label Genre each tag, i in movie.tags_genre if(tag!='') span= tag |   br - + br label Acteurs each tag, i in movie.tags_star if(tag!='') diff --git a/views/show.jade b/views/show.jade index 47b1e7e..6dc0c9d 100644 --- a/views/show.jade +++ b/views/show.jade @@ -3,6 +3,9 @@ extends layout block content h1= title + a(href="/channel/#{channel_id}") Retour à la liste des séries + br + table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%") thead tr @@ -13,7 +16,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}")= video.titre + a(href="/movie/#{video.id}/#{channel_id}")= video.titre td= video.season_episode td= video.duree script. diff --git a/views/show_list.jade b/views/show_list.jade index 9d67806..73e1c48 100644 --- a/views/show_list.jade +++ b/views/show_list.jade @@ -12,7 +12,7 @@ block content each show, i in shows tr td - a(href="/show/#{show.id}")= show.title + a(href="/show/#{show.id}/#{channel}")= show.title td= show.year script. $(document).ready(function() { From a56104f7cc2aef9ce069d5f2d39c0c01b86eeb24 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Wed, 7 Oct 2015 18:04:19 +0200 Subject: [PATCH 2/8] ajout de la page divers + lien de retour --- routes/divers.js | 69 +++++++++++++++++++++++++++++++++++++++++++++++ views/divers.jade | 21 +++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 routes/divers.js create mode 100644 views/divers.jade diff --git a/routes/divers.js b/routes/divers.js new file mode 100644 index 0000000..582a3bd --- /dev/null +++ b/routes/divers.js @@ -0,0 +1,69 @@ +var express = require('express'); +var router = express.Router(); + +function secondsToString(seconds) { + seconds = Math.round(seconds); + + var years = Math.floor(seconds / 31536000); + var max =2; + var current = 0; + var str = ""; + if (years && current Date: Wed, 7 Oct 2015 18:16:39 +0200 Subject: [PATCH 3/8] modif du lien --- routes/show.js | 3 ++- views/show.jade | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/show.js b/routes/show.js index c171ef0..1878b60 100644 --- a/routes/show.js +++ b/routes/show.js @@ -59,7 +59,8 @@ router.get('/:id/:incoming_chan', function(req, res, next) { res.render('show',{ title: titre, videos: data, - channel_id: req.params.incoming_chan + channel_id: req.params.incoming_chan, + show_id: req.params.id }); }); diff --git a/views/show.jade b/views/show.jade index 6dc0c9d..5793045 100644 --- a/views/show.jade +++ b/views/show.jade @@ -3,7 +3,8 @@ extends layout block content h1= title - a(href="/channel/#{channel_id}") Retour à la liste des séries + a(href="/show_list/#{channel_id}") Retour à la liste des séries + br br table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%") From a901355238124b49c1c10e990cd532c2912ce924 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Wed, 7 Oct 2015 18:21:10 +0200 Subject: [PATCH 4/8] utilisation de lhistorique --- routes/movie.js | 4 ++-- views/channel.jade | 2 +- views/movie.jade | 4 ++-- views/show_list.jade | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/routes/movie.js b/routes/movie.js index c5b6e4a..368a512 100644 --- a/routes/movie.js +++ b/routes/movie.js @@ -18,7 +18,7 @@ function humanFileSize(bytes, si) { } /* GET home page. */ -router.get('/:id/:incoming_chan', function(req, res, next) { +router.get('/:id', function(req, res, next) { var config = res.locals.config; var db = config.init_db(); @@ -41,7 +41,7 @@ router.get('/:id/:incoming_chan', function(req, res, next) { row.file.push(ligne); },function(){ - res.render('movie', { title: 'Détail vidéo',movie: row,channel_id: req.params.incoming_chan }); + res.render('movie', { title: 'Détail vidéo',movie: row }); }); }); diff --git a/views/channel.jade b/views/channel.jade index 6f07a9a..0ddfbb6 100644 --- a/views/channel.jade +++ b/views/channel.jade @@ -13,7 +13,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}/#{channel.id}")= video.title + a(href="/movie/#{video.id}")= video.title td= video.duree td= video.year script. diff --git a/views/movie.jade b/views/movie.jade index 156c3f2..16f50c2 100644 --- a/views/movie.jade +++ b/views/movie.jade @@ -3,10 +3,10 @@ extends layout block content h1= movie.title - a(href="/channel/#{channel_id}") Retour à la liste + a(href="#",onclick="window.history.back();") Retour à la liste br br - + label Note p= movie.rating diff --git a/views/show_list.jade b/views/show_list.jade index 73e1c48..9d67806 100644 --- a/views/show_list.jade +++ b/views/show_list.jade @@ -12,7 +12,7 @@ block content each show, i in shows tr td - a(href="/show/#{show.id}/#{channel}")= show.title + a(href="/show/#{show.id}")= show.title td= show.year script. $(document).ready(function() { From 673813123e9a55226207f77b337f46982952e729 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Thu, 8 Oct 2015 12:07:47 +0200 Subject: [PATCH 5/8] ajout du lien --- routes/show_list.js | 2 +- views/show_list.jade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/show_list.js b/routes/show_list.js index a1aa1a2..8dc7c49 100644 --- a/routes/show_list.js +++ b/routes/show_list.js @@ -20,7 +20,7 @@ router.get('/:id', function(req, res, next) { //aprés toute les opération de la base function(){ console.log(shows); - res.render('show_list', { title: 'Liste des séries',shows: shows, channel: req.params.id }); + res.render('show_list', { title: 'Liste des séries',shows: shows, channel_id: req.params.id }); }); }); diff --git a/views/show_list.jade b/views/show_list.jade index 9d67806..e3fd721 100644 --- a/views/show_list.jade +++ b/views/show_list.jade @@ -12,7 +12,7 @@ block content each show, i in shows tr td - a(href="/show/#{show.id}")= show.title + a(href="/show/#{show.id}/#{channel_id}")= show.title td= show.year script. $(document).ready(function() { From b7fb967bee8c71189e60d9faf706e5ffa0cdc86b Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Thu, 8 Oct 2015 12:09:11 +0200 Subject: [PATCH 6/8] correctif de la page serie --- views/show.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/show.jade b/views/show.jade index 5793045..e262384 100644 --- a/views/show.jade +++ b/views/show.jade @@ -17,7 +17,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}/#{channel_id}")= video.titre + a(href="/movie/#{video.id}")= video.titre td= video.season_episode td= video.duree script. From c7f06fe967ede2ecb3a7b9567f0f42492bd5674c Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Thu, 8 Oct 2015 12:13:22 +0200 Subject: [PATCH 7/8] gestion des titres vides --- views/channel.jade | 2 +- views/show.jade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/views/channel.jade b/views/channel.jade index 0ddfbb6..19999be 100644 --- a/views/channel.jade +++ b/views/channel.jade @@ -13,7 +13,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}")= video.title + a(href="/movie/#{video.id}") #{video.titre}  td= video.duree td= video.year script. diff --git a/views/show.jade b/views/show.jade index e262384..7e9d6d8 100644 --- a/views/show.jade +++ b/views/show.jade @@ -17,7 +17,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}")= video.titre + a(href="/movie/#{video.id}") #{video.titre}  td= video.season_episode td= video.duree script. From 90a880cce06efb2a16af3f6d0858b8dcabce9fb2 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Thu, 8 Oct 2015 12:14:53 +0200 Subject: [PATCH 8/8] gestion des titres vides --- views/channel.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/channel.jade b/views/channel.jade index 19999be..a8016f9 100644 --- a/views/channel.jade +++ b/views/channel.jade @@ -13,7 +13,7 @@ block content each video, i in videos tr td - a(href="/movie/#{video.id}") #{video.titre}  + a(href="/movie/#{video.id}") #{video.title}  td= video.duree td= video.year script.