[guadec-web-regcfp/develop] Re-add gender
- From: Patrick Uiterwijk <puiterwijk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web-regcfp/develop] Re-add gender
- Date: Wed, 24 Jun 2015 15:15:43 +0000 (UTC)
commit d9ff38547b2e78cbc86d088a3076a0cfbf5d6766
Author: Patrick Uiterwijk <puiterwijk redhat com>
Date: Wed Jun 24 17:15:30 2015 +0200
Re-add gender
models/registration.js | 1 +
routes/registration.js | 9 +++++++--
views/registration/register.hbs | 11 +++++++++++
3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/models/registration.js b/models/registration.js
index c924b94..f884018 100644
--- a/models/registration.js
+++ b/models/registration.js
@@ -6,6 +6,7 @@ module.exports = function(sequelize, DataTypes) {
is_public: DataTypes.BOOLEAN,
badge_printed: DataTypes.BOOLEAN,
receipt_sent: DataTypes.BOOLEAN,
+ gender: DataTypes.ENUM('male', 'female', 'other'),
country: DataTypes.STRING,
}, {
classMethods: {
diff --git a/routes/registration.js b/routes/registration.js
index 092fd49..9a30e9d 100644
--- a/routes/registration.js
+++ b/routes/registration.js
@@ -14,6 +14,8 @@ var config = require('../config/config.json')[env];
var paypal = require('paypal-rest-sdk');
paypal.configure(config['paypal']);
+var genders = ['male', 'female', 'other'];
+
router.all('/', utils.require_feature("registration"));
router.all('/list', utils.require_permission('registration/view_public'));
@@ -225,10 +227,11 @@ router.get('/register', function(req, res, next) {
req.user.getRegistration()
.complete(function(err, reg) {
res.render('registration/register', { registration: reg,
- ask_regfee: reg == null});
+ ask_regfee: reg == null,
+ allGenders: genders });
});
} else {
- res.render('registration/register', { registration: {is_public: true}, ask_regfee: true });
+ res.render('registration/register', { registration: {is_public: true}, ask_regfee: true, allGenders:
genders });
};
});
@@ -263,6 +266,7 @@ function handle_registration(req, res, next) {
.complete(function(err, reg) {
var reg_info = {
irc: req.body.irc.trim(),
+ gender: req.body.gender,
country: req.body.country.trim(),
is_public: req.body.is_public.indexOf('false') == -1,
badge_printed: false,
@@ -299,6 +303,7 @@ function handle_registration(req, res, next) {
} else {
// Update
reg.irc = reg_info.irc;
+ reg.gender = reg_info.gender;
reg.country = reg_info.country;
reg.is_public = reg_info.is_public;
reg.save().complete(function (err, reg){
diff --git a/views/registration/register.hbs b/views/registration/register.hbs
index e5b4b3d..5d3c48c 100644
--- a/views/registration/register.hbs
+++ b/views/registration/register.hbs
@@ -19,6 +19,17 @@ Please note that we can only provide receipts for payments over {{config.registr
{{/unless}}</p>
</tr>
+-<tr><td>Gender</td>
+<td>
+{{#each allGenders}}
+<input type="radio" name="gender" value="{{this}}" id="gender_{{this}}"
+{{#ifEqual ../registration.gender this}}
+checked
+{{/ifEqual}}
+><label for="gender_{{this}}">{{this}}</label>
+{{/each}}
+<br/><p class="note">We will not publish gender data.<br/> It will only be used for attendee
statistics.</p></td></tr>
+
-<tr><td>Country</td><td><input type="text" name="country" value="{{registration.country}}"
placeholder="(optional)"><br/><p class="note">We will not publish country data.<br/> It will only be used for
attendee statistics.</p></td></tr>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]