diff --git a/data/schemas/exercise.js b/data/schemas/exercise.js
index 15424a1..b2169fc 100644
--- a/data/schemas/exercise.js
+++ b/data/schemas/exercise.js
@@ -1,20 +1,13 @@
var Schema = require('mongoose').Schema;
-var Datafield = new Schema({
- datafieldname: { type: String},
- datafieldtype: { type: String}
-});
-
-
var exerciseSchema = new Schema({
name: {type: String, unique: true, required: true},
- type: String,
description: String,
difficulty: Number,
musclearray: [Number],
keywords: [String],
alternatives: [String],
- datafields: [Datafield]
+ datafields: [String]
});
module.exports = exerciseSchema;
\ No newline at end of file
diff --git a/public/javascripts/newexercisevalidation.js b/public/javascripts/newexercisevalidation.js
index 156fcac..243806f 100644
--- a/public/javascripts/newexercisevalidation.js
+++ b/public/javascripts/newexercisevalidation.js
@@ -37,8 +37,7 @@ $("#newexercise").validate({
required: true,
maxlength: 24
},
- type: {
- notEqual: "notselected",
+ keywords: {
required: true
}
},
diff --git a/public/javascripts/scripts.js b/public/javascripts/scripts.js
index ff548cf..820d184 100644
--- a/public/javascripts/scripts.js
+++ b/public/javascripts/scripts.js
@@ -27,6 +27,9 @@ $(document).ready(function() {
cancel: ':input, button' ,
placeholder: "ui-state-highlight",
revert: true,
+ start: function(e, ui){
+ ui.placeholder.height(ui.item.height());
+ },
stop: function(event, ui) {
$('#newworkout').trigger('sortupdate');
}
@@ -78,6 +81,9 @@ $(document).ready(function() {
cancel: ':input, button' ,
placeholder: "ui-state-highlight",
revert: true,
+ start: function(e, ui){
+ ui.placeholder.height(ui.item.height());
+ },
stop: function(event, ui) {
$('#newworkout').trigger('sortupdate');
}
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index 9084e9f..3b706b8 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -7,23 +7,22 @@ a {
color: #00B7FF;
}
-li {
+ul, menu, dir {
list-style-type: none;
-}
#sortable ul {
list-style-type: none;
}
-#sortable li {
+/*#sortable li {
margin: 0 3px 3px 3px;
padding: 0.4em;
padding-left: 1.5em;
height: 24px;
list-style-type: none;
}
-
+*/
label {
margin-left: 5px;
margin-right: 5px;
diff --git a/routes/workouts.js b/routes/workouts.js
index 7dcadf2..2b5211a 100644
--- a/routes/workouts.js
+++ b/routes/workouts.js
@@ -9,6 +9,8 @@ var notLoggedIn = require('./middleware/not_logged_in');
var loadWorkout = require('./middleware/load_workout');
var loggedIn = require('./middleware/logged_in');
var maxWorkoutsPerPage = 5;
+var Exercise = require('../data/models/exercise');
+var loadExercise = require('./middleware/load_exercise');
var Moment = require('moment');
module.exports = function(app) {
@@ -57,6 +59,22 @@ module.exports = function(app) {
res.render('workouts/new', {title: "New workout"});
});
+ app.get('/workouts/exerciselist', function(req, res) {
+ res.contentType('json');
+ Exercise.find({})
+ .exec(function(err, exercises) {
+ if (err) {
+ return next(err);
+ }
+ if (! exercise) {
+ return res.send(JSON.stringify({ "error": "true" }));
+ }
+ res.send(exercises);
+ });
+
+ });
+
+
app.get('/workouts/:_id', loadWorkout, function(req, res, next){
console.log("time" + Moment.utc(req.workout.workoutDate).format("ddd, hA"));
res.render('workouts/workout', {title: req.workout.title,
diff --git a/views/admin/newexercise.jade b/views/admin/newexercise.jade
index 344e381..4cdc93a 100644
--- a/views/admin/newexercise.jade
+++ b/views/admin/newexercise.jade
@@ -11,16 +11,6 @@ block content
li
label(for="name") Exercise Name
input#name(name="name")
- li
- label(for="type") Exercise Type
- select#type(name="type")
- option(value='notselected') Select One
- option(value='freeweights') Free Weights
- option(value='machine') Exercise Machines
- option(value='bodyweight') Bodyweight
- option(value='kettlebells') Kettlebells
- option(value='cardio') Cardio
-
li
label(for="type") Exercise Description
input#description(name="description", class="needsnumber")
@@ -36,9 +26,20 @@ block content
- }
li
label(for="type") Keywords
+ select#type(name="keywords", multiple="multiple")
+ option(value='Free Weights') Free Weights
+ option(value='Exercise Machine') Exercise Machines
+ option(value='Bodyweight') Bodyweight
+ option(value='Kettlebells') Kettlebells
+ option(value='Cardio') Cardio
li
label(for="type") Alternatives
li
- label(for="type") Datafields
+ label(for="datafields") Datafields
+ select#type(name="datafields", multiple="multiple")
+ option(value='Reps') Reps
+ option(value='Weight') Weight
+ option(value='Time') Time
+ option(value='Distance') Distance
li
input(type="submit", value="Create")
\ No newline at end of file
diff --git a/views/layout.jade b/views/layout.jade
index dbf3a82..10bbbe6 100644
--- a/views/layout.jade
+++ b/views/layout.jade
@@ -2,7 +2,6 @@
html
head
title BodyREP - #{title}
- link(rel='stylesheet', '/stylesheets/style.css')
include scripts
block additionalscripts
body
diff --git a/views/scripts.jade b/views/scripts.jade
index 3fe1b38..3dbc4fc 100644
--- a/views/scripts.jade
+++ b/views/scripts.jade
@@ -2,6 +2,9 @@ script(src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js')
script(src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js')
script(src='http://jzaefferer.github.com/jquery-validation/jquery.validate.js')
script(src='/javascripts/scripts.js')
+
//script(src='/javascripts/livevalidation_standalone.compressed.js')
//link(rel='stylesheet', href='/stylesheets/smoothness/jquery-ui-1.8.20.custom.css',type='text/css' )
+
link(rel='stylesheet', href='/stylesheets/redmond/jquery-ui-1.10.0.custom.css',type='text/css' )
+link(rel='stylesheet', href='/stylesheets/style.css')
\ No newline at end of file