This commit is contained in:
Thomas FORGIONE 2015-07-27 16:59:53 +02:00
parent 55b653296b
commit abeafc27fd
7 changed files with 93 additions and 17 deletions

View File

@ -2,6 +2,17 @@ extends ../../../views/base.jade
block extrahead
link(rel="stylesheet", href="/static/css/signin.css")
link(rel="stylesheet", href="/static/css/star-rating.min.css")
block extrajs
script(src="/static/js/star-rating.min.js")
script.
$('#3dgames').rating({
showClear: false,
showCaption: false,
size: 'xs'
});
$('#3dgames').rating('update', 3);
block extrabody
if identificationFailed
@ -16,16 +27,44 @@ block content
h2 Please sign in
label(for='inputId').sr-only Id
input#inputId.form-control(name="inputId", type="text", placeholder='Id', required, autofocus)
label(for='inputAge').sr-only Age
input#inputAge.form-control(name="inputAge", type="number", placeholder='Age', min="18", required)
div(style={'text-align': 'center', 'margin-top':'10px', 'margin-bottom':'10px'})
label.radio-inline
input(type='radio', name='inputGender', value="male", checked)
| Male
label.radio-inline
input(type='radio', name='inputGender', value="female")
| Female
.form-group
label Gender
.form-group
label.radio-inline
input(type='radio', name='inputGender', value="male", checked)
| Male
label.radio-inline
input(type='radio', name='inputGender', value="female")
| Female
.form-group
label(for='sel1') How old are you ?
select.form-control#sel1(name="inputAge")
option(value='-20') Less than 20
option(value='20-25') Between 20 and 25
option(value='25-30') Between 25 and 30
option(value='30-35') Between 30 and 35
option(value='35-40') Between 35 and 40
option(value='40-45') Between 40 and 45
option(value='45-50') Between 45 and 50
option(value='50-55') Between 50 and 55
option(value='55-60') Between 55 and 60
option(value='60-') More than 60
label(for='3dgames') Rate your 3D game skills (1 star if you never played)
input#3dgames(type='number', class='rating', min='0', max='5', step='1', default='3', name='input3dskills')
.form-group
label(for='se21') When is the last time you played a 3D video game ?
select.form-control#sel2(name="inputLastTime")
option(value='3') This week
option(value='2') This month
option(value='1') This year
option(value='0') I never played a 3D video game
button.btn.btn-lg.btn-primary.btn-block(type='submit') Sign in

View File

@ -6,7 +6,10 @@ else
CLOSURE=../utils/simple-compiler/compiler.sh
endif
all: L3D L3DP Socket Three Stats Bouncing Multisphere StreamingSimulator PrototypeReplay PrototypeInteractive Tutorial TestList CoinCreator CoinViewer
all: L3D L3DP Socket Three Stats Bouncing Multisphere StreamingSimulator PrototypeReplay PrototypeInteractive Tutorial TestList CoinCreator CoinViewer StarRating
StarRating:
cp star-rating.min.js ../static/js/
L3D:
$(CLOSURE) $(OPT) \

10
js/star-rating.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,11 @@ var db = require('../../controllers/prototype/dbrequests.js');
var Log = require('../../lib/NodeLog.js');
module.exports.index = function(req, res) {
for (var key in req.body) {
console.log(key, req.body[key]);
}
db.checkUserName(req.body.inputId, function(ok) {
if (!ok) {
db.tryUser(req.session.user_id, function(id) {
@ -12,8 +17,15 @@ module.exports.index = function(req, res) {
pg.connect(secret.url, function(err, client, release) {
client.query(
"UPDATE Users SET worker_id = $1, age = $2, male = $3 WHERE id = $4;",
[req.body.inputId, req.body.inputAge, req.body.inputGender === 'male', req.session.user_id],
"UPDATE Users SET worker_id = $1, age = $2, male = $3, rating = $5, lasttime = $6 WHERE id = $4;",
[
req.body.inputId,
req.body.inputAge,
req.body.inputGender === 'male',
req.session.user_id,
req.body.input3dskills,
req.body.inputLastTime
],
function(err, result) {
if (err !== null)
Log.dberror(err + ' in identfication');

View File

@ -36,8 +36,10 @@ CREATE TYPE CAMERA AS(
-- Base tables
CREATE TABLE Users(
id SERIAL PRIMARY KEY,
worker_id varchar(50),
age INTEGER,
worker_id VARCHAR(50),
age VARCHAR(10),
rating INT,
lasttime INT,
male BOOLEAN
);

View File

@ -5,7 +5,7 @@ body {
}
.form-signin {
max-width: 330px;
max-width: 500px;
padding: 15px;
margin: 0 auto;
}
@ -34,6 +34,6 @@ body {
}
.form-signin label {
margin-right: 50px;
margin-left: 50px;
margin-right: 0px;
margin-left: 0px;
}

10
static/css/star-rating.min.css vendored Normal file
View File

@ -0,0 +1,10 @@
/*!
* @copyright © Kartik Visweswaran, Krajee.com, 2013 - 2015
* @version 3.5.3
*
* A simple yet powerful JQuery star rating plugin that allows rendering
* fractional star ratings and supports Right to Left (RTL) input.
*
* For more JQuery/Bootstrap plugins and demos visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/.rating-loading{width:25px;height:25px;font-size:0;color:#fff;background:transparent url(../img/loading.gif) top left no-repeat;border:none}.rating-fa{font-family:FontAwesome;padding-left:1px}.rating-fa .rating-stars:before{padding-left:1px}.rating-gly{font-family:'Glyphicons Halflings'}.rating-gly-star{font-family:'Glyphicons Halflings';padding-left:2px}.rating-gly-star .rating-stars:before{padding-left:2px}.rating-lg .rating-gly-star,.rating-lg .rating-gly-star .rating-stars:before{padding-left:4px}.rating-xl .rating-gly-star,.rating-xl .rating-gly-star .rating-stars:before{padding-left:2px}.rating-active{cursor:default}.rating-disabled{cursor:not-allowed}.rating-uni{font-size:1.2em;margin-top:-5px}.rating-container{position:relative;vertical-align:middle;display:inline-block;color:#e3e3e3;overflow:hidden}.rating-container:before{content:attr(data-content)}.rating-container .rating-stars{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden;color:#fde16d;transition:all .25s ease-out;-o-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-webkit-transition:all .25s ease-out}.rating-container .rating-stars:before{content:attr(data-content);text-shadow:0 0 1px rgba(0,0,0,.7)}.rating-container-rtl{position:relative;vertical-align:middle;display:inline-block;overflow:hidden;color:#fde16d}.rating-container-rtl:before{content:attr(data-content);text-shadow:0 0 1px rgba(0,0,0,.7)}.rating-container-rtl .rating-stars{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden;color:#e3e3e3;transition:all .25s ease-out;-o-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-webkit-transition:all .25s ease-out}.rating-container-rtl .rating-stars:before{content:attr(data-content)}.rating-xl{font-size:4.89em}.rating-lg{font-size:3.91em}.rating-md{font-size:3.13em}.rating-sm{font-size:2.5em}.rating-xs{font-size:2em}.star-rating .clear-rating,.star-rating-rtl .clear-rating{color:#aaa;cursor:not-allowed;display:inline-block;vertical-align:middle;font-size:60%}.clear-rating-active{cursor:pointer!important}.clear-rating-active:hover{color:#843534}.star-rating .clear-rating{padding-right:5px}.star-rating .caption,.star-rating-rtl .caption{color:#999;display:inline-block;vertical-align:middle;font-size:55%}.star-rating .caption{padding-left:5px}.star-rating-rtl .caption{padding-right:5px}