diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
commit | c45f7f84001c2731909db04dd82e1c1f290386eb (patch) | |
tree | b7e57420a1f65dfbbacc1a532bf489c9bea6125d /controllers/views.js | |
parent | cda021079ff455cc0fd0eb95a5395fa808ab63d1 (diff) | |
download | PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.gz PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.zst PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.zip |
Infile code reorganization
Diffstat (limited to 'controllers/views.js')
-rw-r--r-- | controllers/views.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/controllers/views.js b/controllers/views.js index ebd97380e..1bb4ffe70 100644 --- a/controllers/views.js +++ b/controllers/views.js | |||
@@ -1,24 +1,29 @@ | |||
1 | ;(function () { | 1 | ;(function () { |
2 | 'use strict' | 2 | 'use strict' |
3 | 3 | ||
4 | function getPartial (req, res) { | ||
5 | var directory = req.params.directory | ||
6 | var name = req.params.name | ||
7 | |||
8 | res.render('partials/' + directory + '/' + name) | ||
9 | } | ||
10 | |||
11 | function getIndex (req, res) { | ||
12 | res.render('index') | ||
13 | } | ||
14 | |||
15 | var express = require('express') | 4 | var express = require('express') |
5 | |||
16 | var middleware = require('../middlewares').misc | 6 | var middleware = require('../middlewares').misc |
17 | 7 | ||
18 | var router = express.Router() | 8 | var router = express.Router() |
19 | 9 | ||
20 | router.get('/partials/:directory/:name', middleware.cache(), getPartial) | ||
21 | router.get(/^\/(index)?$/, middleware.cache(), getIndex) | 10 | router.get(/^\/(index)?$/, middleware.cache(), getIndex) |
11 | router.get('/partials/:directory/:name', middleware.cache(), getPartial) | ||
12 | |||
13 | // --------------------------------------------------------------------------- | ||
22 | 14 | ||
23 | module.exports = router | 15 | module.exports = router |
16 | |||
17 | // --------------------------------------------------------------------------- | ||
18 | |||
19 | function getIndex (req, res) { | ||
20 | res.render('index') | ||
21 | } | ||
22 | |||
23 | function getPartial (req, res) { | ||
24 | var directory = req.params.directory | ||
25 | var name = req.params.name | ||
26 | |||
27 | res.render('partials/' + directory + '/' + name) | ||
28 | } | ||
24 | })() | 29 | })() |