diff --git a/ninja-store/app.js b/ninja-store/app.js index 8fbaa82..9352978 100644 --- a/ninja-store/app.js +++ b/ninja-store/app.js @@ -93,13 +93,7 @@ app.get('/logout', function(req, res) { app.listen(3000); console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env); -var emitdata = function(channel,data) { -io.sockets.on('connection', function (socket) { - io.sockets.emit(channel, data); - }); -}; - - + var io = require('socket.io'); io = io.listen(app); io.configure('development', function(){ @@ -117,14 +111,14 @@ io.sockets.on('connection', function(socket) { if (result) console.log('Added!' + result); }); }); - - // client add new employee -io.sockets.on('add employee', function(data) { - console.log("addemployee ") - addemployee(data); }); - - }); +function emitdata(channel,data) { + console.log('This Is What I should Emit ' +JSON.stringify(data)); + io.sockets.on('connection', function (socket) { + console.log('This Is What I Emit ' +JSON.stringify(data)); + socket.emit(channel, data); + }); +}; diff --git a/ninja-store/public/stylesheets/style.css b/ninja-store/public/stylesheets/style.css index 6856e1f..ce28b5e 100644 --- a/ninja-store/public/stylesheets/style.css +++ b/ninja-store/public/stylesheets/style.css @@ -42,3 +42,13 @@ input[type="text"] { border: 1px solid #ccc; vertical-align: middle; } +#Activity { + display: none; + position: absolute; + width: 70%; + padding: 10px; + background: #eee; + color: #000; + border: 1px solid #1a1a1a; + font-size: 90%; +} diff --git a/ninja-store/public/stylesheets/style.styl b/ninja-store/public/stylesheets/style.styl index bd78e37..d745f18 100644 --- a/ninja-store/public/stylesheets/style.styl +++ b/ninja-store/public/stylesheets/style.styl @@ -41,3 +41,14 @@ input[type="text"] padding-right:10px border:1px solid #cccccc vertical-align: middle + + +#Activity + display: none + position: absolute + width: 70% + padding: 10px + background: #eeeeee + color: #000000 + border: 1px solid #1a1a1a + font-size: 90% diff --git a/ninja-store/views/items.jade b/ninja-store/views/items.jade index 50ec77d..8341404 100644 --- a/ninja-store/views/items.jade +++ b/ninja-store/views/items.jade @@ -8,29 +8,30 @@ input(type='Button', id='AddAct', value='Add Activity') - div(id='Activity',style='display: none') + div(id='Activity',style='display: none',) form#myForm input(type='submit', id='save', value='Save') div(Class='ActivityBlock_T', style='display: none') - input(type='button', class='AddNeut', value='Add note Field', data-field='note_area', data-area='note_', data-limit='0', data-jsontag='activity.note') - input(type='button', class='AddNeut', value='Add exercise Field', data-field='exercise_area', data-area='exercise_', data-limit='0',data-jsontag='activity.exercise') - input(type='button', class='RemNeut', value='Remove note Field', data-field='note_area', data-area='note_', data-limit='0', data-jsontag='activity.note', disabled='disabled') - input(type='button', class='RemNeut', value='Remove exercise Field', data-field='exercise_area', data-area='exercise_', data-limit='0',data-jsontag='activity.exercise', disabled='disabled' ) - ul(class='Activity_area') - li(class='exercise_T', style='display: none') + input(type='button', class='AddNeut', value='Add note Field', data-field='note_area', data-area='note', data-limit='1') + input(type='button', class='AddNeut', value='Add exercise Field', data-field='exercise_area', data-area='exercise', data-limit='1') + input(type='button', class='RemNeut noterem', value='Remove note Field', data-field='note_area', data-area='note', data-limit='0', disabled='disabled') + input(type='button', class='RemNeut exerciserem', value='Remove exercise Field', data-field='exercise_area', data-area='exercise', data-limit='0', disabled='disabled' ) + ul(class='activity') + li(class='activity', style='display: none') label Activity input(type='text', name='activity.name', value='Name', disabled='disabled') - ul(class='note_area') + input(type='text', class='datefield', disabled='disabled' ) + ul(class='note') li(class='note_T', style='display: none') label Note - input(type='text', name='activity.note[]', value='Note', disabled='disabled') - ul(class='exercise_area') + input(type='text', name='activity.note[i]', value='Note', disabled='disabled') + ul(class='exercise') li(class='exercise_T', style='display: none') label Exercise - input(type='text', name='activity.exercise[].name', value='Name', disabled='disabled') - input(type='text', name='activity.exercise[].sets', value='Sets', disabled='disabled', class='numericonly') - input(type='text', name='activity.exercise[].reps', value='Reps', disabled='disabled') - input(type='text', name='activity.exercise[].weight', value='Weight', disabled='disabled') + input(type='text', name='activity.exercise[i].name', value='Name', disabled='disabled') + input(type='text', name='activity.exercise[i].sets', value='Sets', disabled='disabled', class='numericonly') + input(type='text', name='activity.exercise[i].reps', value='Reps', disabled='disabled') + input(type='text', name='activity.exercise[i].weight', value='Weight', disabled='disabled') ul#employees diff --git a/ninja-store/views/layout.jade b/ninja-store/views/layout.jade index 211aff7..664c45b 100644 --- a/ninja-store/views/layout.jade +++ b/ninja-store/views/layout.jade @@ -3,34 +3,77 @@ html head title= title link(rel='stylesheet', href='/stylesheets/style.css') - script(src='http://code.jquery.com/jquery-1.6.1.min.js') + script(src='/javascripts/jquery-1.7.2.min.js') + script(src='/javascripts/jquery-ui-1.8.20.custom.min.js') + script(src='/javascripts/jsrender.js') script(src='/socket.io/socket.io.js') script(src='/form2js/form2js.js') script(src='/form2js/jquery.toObject.js') script(src='/form2js/json2.js') + link(rel='stylesheet', href="stylesheets/smoothness/jquery-ui-1.8.20.custom.css") + script#movieTemplate1(type="text/x-jsrender"). +
Activity - '+ bb + '
'; - $.each (activity.note, function (cc) { - content += 'Note - '+ cc + '
'; - }); - $.each (activity.exercise, function (cc) { - content += 'Exercise '+ cc +' - name:' + activity.exercise[cc].name +'
'; - content += 'Exercise '+ cc +' - sets:' + activity.exercise[cc].sets +'
'; - content += 'Exercise '+ cc +' - reps:' + activity.exercise[cc].reps +'
'; - content += 'Exercise '+ cc +' - weight:' + activity.exercise[cc].weight +'
'; - }); + // $.each (json, function (bb) { + // var activity = json[bb].activity; + // content += 'Activity - '+ bb + '
'; + // if (typeof activity.name !== 'undefined') { + // content += 'Name - '+ activity.name + '
'; + // }; + // if (typeof activity.note !== 'undefined') { + // $.each (activity.note, function (cc) { + // content += 'Note - '+ cc + '
'; + // }); + // }; + // if (typeof activity.exercise !== 'undefined') { + // $.each (activity.exercise, function (cc) { + // content += 'Exercise '+ cc +' - name:' + activity.exercise[cc].name +'
'; + // content += 'Exercise '+ cc +' - sets:' + activity.exercise[cc].sets +'
'; + // content += 'Exercise '+ cc +' - reps:' + activity.exercise[cc].reps +'
'; + // content += 'Exercise '+ cc +' - weight:' + activity.exercise[cc].weight +'
'; + // }); + // }; - }); - $(content).appendTo("#employees"); + // }); + // $(content).appendTo("#employees"); + // $.templates({ + // titleTemplate: "