Permalink
Browse files

use datepicker widgets

  • Loading branch information...
1 parent bdfc746 commit 110f3fd2ab7b654b2b2417a39a05541cb6b3f725 @spang committed Jan 28, 2012
Showing with 77 additions and 59 deletions.
  1. +2 −1 app.js
  2. +6 −2 views/layout.jade
  3. +69 −56 views/trip/new.jade
View
3 app.js
@@ -15,6 +15,7 @@ var models = require('./models');
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
+ app.set('view options', { layout: false });
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: '0rC+Na99I0GPv7jNN3Xl7cHW6v2BR8rb' }));
@@ -69,7 +70,7 @@ app.post('/trip/new/done',
else {
// Or, use filtered data from the form object
console.log("trip name:", req.form.trip_name);
- console.log("trip description:", req.form.password);
+ console.log("trip description:", req.form.trip_description);
}
}
);
View
8 views/layout.jade
@@ -2,6 +2,10 @@
html
head
title #{title}
+ link(type='text/css', href="/stylesheets/jquery-ui-1.8.17.custom.css", rel="stylesheet")
+ script(type='text/javascript', src='/javascripts/jquery-1.7.1.min.js')
+ script(type='text/javascript', src='/javascripts/jquery-ui-1.8.17.custom.min.js')
+
+ block scripts
body
- #main
- != body
+ block content
View
125 views/trip/new.jade
@@ -1,56 +1,69 @@
-h2 Yeeehaw! We're making a new trip.
-
-//- TODO: make error-handling prettier and more useful
-if typeof flash != 'undefined'
- if flash.error
- #error= flash.error
- if flash.info
- #info= flash.info
-
-form#trip-form(method='post', action='/trip/new/done')
- p
- label(for='trip_name') trip name:
- label(for='trip_start') from
- label(for='trip_end') to
- p
- input(type='text', name='trip_name', id='trip_name', size='30')
- input(type='text', name='trip_start', id='trip_start', size='10')
- input(type='text', name='trip_end', id='trip_end', size='10')
- p
- label(for='trip_description') description / other info:
- p
- textarea(name='trip_description', id='trip_description')
- p
- label(for='signup_start') sign up open from
- input(type='text', name='signup_start', id='signup_start', size='10')
- label(for='signup_end') to
- input(type='text', name='signup_end', id='signup_end', size='10')
- p
- label(for='allow_early_drivers') allow some drivers to sign up early?
- input(type='checkbox', name='allow_early_drivers', id='allow_early_drivers')
- //- use some client-side js to hide this option if the above checkbox
- //- is unchecked
- p
- | Ok!
- input(type='text', name='num_early_drivers', id='num_early_drivers', size='1', value='2')
- | driver(s) can sign up
- input(type='text', name='early_signup_days', id='early_signup_days', size='1', value='1')
- | day(s) early.
- p
- label(for='trip_fee') trip fee
- input(type='text', name='trip_fee', id='trip_fee', size='2', value='$0')
-
- h3 leader info (that's you, probably)
-
- p
- label(for='leader_name') name:
- input(type='text', name='leader_name', id='leader_name', size='20')
- p
- label(for='leader_email') email
- input(type='text', name='leader_email', id='leader_email', size='20')
-
- //- TODO: additional questions
- //- TODO: leader signup info (car, answer extra questions yourself (in a new
- //- page)
-
- input(type='submit', value='Make it!')
+extends ../layout
+
+block scripts
+ script(type='text/javascript')
+ $(function(){
+ $('#trip_start').datepicker();
+ $('#trip_end').datepicker();
+ $('#signup_start').datepicker();
+ $('#signup_end').datepicker();
+ });
+
+block content
+ h2 Yeeehaw! We're making a new trip.
+
+ //- TODO: make error-handling prettier and more useful
+ if typeof flash != 'undefined'
+ if flash.error
+ #error= flash.error
+ if flash.info
+ #info= flash.info
+
+ form#trip-form(method='post', action='/trip/new/done')
+ p
+ label(for='trip_name') trip name:
+ p
+ input(type='text', name='trip_name', id='trip_name', size='30')
+ p
+ label(for='trip_start') starts
+ input(type='text', name='trip_start', id='trip_start', size='10')
+ label(for='trip_end') ends
+ input(type='text', name='trip_end', id='trip_end', size='10')
+ p
+ label(for='trip_description') description / other info:
+ p
+ textarea(name='trip_description', id='trip_description', rows='10', cols='60')
+ p
+ label(for='signup_start') sign up open from
+ input(type='text', name='signup_start', id='signup_start', size='10')
+ label(for='signup_end') to
+ input(type='text', name='signup_end', id='signup_end', size='10')
+ p
+ label(for='allow_early_drivers') allow some drivers to sign up early?
+ input(type='checkbox', name='allow_early_drivers', id='allow_early_drivers')
+ //- use some client-side js to hide this option if the above checkbox
+ //- is unchecked
+ p
+ | Ok!
+ input(type='text', name='num_early_drivers', id='num_early_drivers', size='1', value='2')
+ | driver(s) can sign up
+ input(type='text', name='early_signup_days', id='early_signup_days', size='1', value='1')
+ | day(s) early.
+ p
+ label(for='trip_fee') trip fee
+ input(type='text', name='trip_fee', id='trip_fee', size='2', value='$0')
+
+ h3 leader info (that's you, probably)
+
+ p
+ label(for='leader_name') name
+ input(type='text', name='leader_name', id='leader_name', size='20')
+ p
+ label(for='leader_email') email
+ input(type='text', name='leader_email', id='leader_email', size='20')
+
+ //- TODO: additional questions
+ //- TODO: leader signup info (car, answer extra questions yourself (in a new
+ //- page)
+
+ input(type='submit', value='Make it!')

0 comments on commit 110f3fd

Please sign in to comment.