[guadec-web-regcfp/develop] viewname
- From: Patrick Uiterwijk <puiterwijk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web-regcfp/develop] viewname
- Date: Sat, 8 Aug 2015 12:36:13 +0000 (UTC)
commit 720ce84ca0075ee4823d154097d13b320e53b54d
Author: Patrick Uiterwijk <puiterwijk redhat com>
Date: Sat Aug 8 14:35:45 2015 +0200
viewname
routes/index.js | 11 +++++++++++
views/index/index.hbs | 7 +++++++
views/index/view_user.hbs | 1 +
3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/routes/index.js b/routes/index.js
index 90fa2b7..957ec94 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -9,6 +9,8 @@ var RegistrationPayment = models.RegistrationPayment;
var env = process.env.NODE_ENV || "development";
var config = require(__dirname + '/../config/config.json')[env];
+var utils = require('../utils');
+
/* GET home page. */
router.get('/', function(req, res, next) {
@@ -27,4 +29,13 @@ router.get('/', function(req, res, next) {
}
});
+router.all('/view_name', utils.require_permission('registration/view_name'));
+router.post('/view_name', function(req, res, next) {
+ var userid = req.body.userid;
+ User.findOne({where: {id:userid}, include: [Registration]})
+ .then(function(user) {
+ res.render('index/view_user', { user: user });
+ });
+});
+
module.exports = router;
diff --git a/views/index/index.hbs b/views/index/index.hbs
index 92ee11f..3214c90 100644
--- a/views/index/index.hbs
+++ b/views/index/index.hbs
@@ -10,6 +10,13 @@ You can log in with your Persona Account or with a persona provider, for example
Welcome, {{name}}<br />
+{{#has_permission "registration/view_name"}}
+<form action="/view_name" method="post">
+ <input type="text" name="userid">
+ <input type="submit" name="View name">
+</form>
+{{/has_permission}}
+
{{#has_permission "registration/desk"}}
<div class="button"><a href="/desk">Desk</a></div>
{{/has_permission}}
diff --git a/views/index/view_user.hbs b/views/index/view_user.hbs
new file mode 100644
index 0000000..a1e24ab
--- /dev/null
+++ b/views/index/view_user.hbs
@@ -0,0 +1 @@
+<h1>{{user.name}}</h1>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]