Skip to content

Commit

Permalink
Identify who called in an answer
Browse files Browse the repository at this point in the history
Show their gravatar next to the "submitted to hq" checkbox.
  • Loading branch information
Torgen committed Jan 18, 2019
1 parent 498bdbd commit 1c2bb76
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion callins.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1>Quips</h1>
<td>{{pretty_ts this.created}}</td>
<td>{{#with lastAttempt}}{{pretty_ts timestamp}} <small>({{pretty_ts timestamp=timestamp style="brief duration"}})</small>{{else}}-{{/with}}</td>
{{#if mynick}}
<td><input type="checkbox" class="bb-submitted-to-hq" checked={{submitted_to_hq}}></td>
<td><input type="checkbox" class="bb-submitted-to-hq" checked={{submitted_to_hq}}>{{#with submitted_by}} by {{gravatar id=nickEmail image="wavatar" size=20 title=(nickOrName this)}}{{/with}}</td>
<td><div class="btn-group">
<button class="btn btn-success bb-callin-correct">Correct</button>
<button class="btn btn-danger bb-callin-incorrect">Incorrect</button>
Expand Down
26 changes: 17 additions & 9 deletions client/callins.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict'

import { nickEmail } from './imports/nickEmail.coffee'

model = share.model # import
settings = share.settings # import

Expand Down Expand Up @@ -82,6 +85,7 @@ Template.callin_row.helpers
for wrong in @puzzle?.incorrectAnswers
return true if wrong.answer is @answer
return false
nickEmail: -> nickEmail @

Template.callin_row.events
"click .bb-callin-correct": (event, template) ->
Expand All @@ -94,15 +98,19 @@ Template.callin_row.events
Meteor.call 'cancelCallIn', id: @_id

"change .bb-submitted-to-hq": (event, template) ->
checked = !!event.currentTarget.checked
Meteor.call 'setField',
type: 'callins'
object: @_id
fields: submitted_to_hq: checked
checked = !!event.currentTarget.checked
Meteor.call 'setField',
type: 'callins'
object: @_id
fields:
submitted_to_hq: checked
submitted_by: if checked then Meteor.userId() else null

"click .copy-and-go": (event, template) ->
Meteor.call 'setField',
type: 'callins'
object: @_id
fields: submitted_to_hq: true
Meteor.call 'setField',
type: 'callins'
object: @_id
fields:
submitted_to_hq: true
submitted_by: Meteor.userId()

1 change: 1 addition & 0 deletions lib/model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ if Meteor.isServer
# created: timestamp
# created_by: canon of Nick
# submitted_to_hq: true/false
# submitted_by: canon of Nick
# backsolve: true/false
# provided: true/false
CallIns = BBCollection.callins = new Mongo.Collection "callins"
Expand Down

0 comments on commit 1c2bb76

Please sign in to comment.