Skip to content

Commit

Permalink
Feedback on Register Save, #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Oct 17, 2014
1 parent b155e9f commit c35f2f8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/client/views/register.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,25 @@ module.exports =
@button class: 'large info', click: 'recordRegister', "Record Register"

recordRegister: (event, element) ->
element.html('Saving.')

$('#registerBody input').each (el) ->
entry = RegisterEntry.for($(this).attr('data-register'), $(this).attr('data-pupil'))
RegisterEntry.update({
present: $(this).prop 'checked'
}, 'idRegisterEntry', entry.idRegisterEntry)

element.html('Saving..')

$('#registerBody select').each (el) ->
entry = RegisterEntry.for($(this).attr('data-register'), $(this).attr('data-pupil'))
RegisterEntry.update({
choiceId: $(this).val()
}, 'idRegisterEntry', entry.idRegisterEntry)

element.html('Saved!')


loadData: ->
$('#registerBody input').each (el) ->
registerentry = RegisterEntry.manualSelectQuery('registerId = ' + $(this).attr('data-register') + ' AND pupilId = ' + $(this).attr('data-pupil') + ' LIMIT 1')
Expand Down

0 comments on commit c35f2f8

Please sign in to comment.