Skip to content

Commit

Permalink
Merge in @ldworkin's changes. Fixes #32 and fixes #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzao committed Aug 14, 2015
1 parent 2970abe commit 70ebdf5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
10 changes: 7 additions & 3 deletions admin/admin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,20 @@ Meteor.methods
</ExternalQuestion>
"""

hit = null
hitId = null
try
hit = TurkServer.mturk "CreateHIT", params
hitId = TurkServer.mturk "CreateHIT", params
catch e
throw new Meteor.Error(500, e.toString())

HITs.insert
HITId: hit
HITId: hitId
HITTypeId: hitType.HITTypeId

this.unblock()
# Immediately refresh HIT data after creation
Meteor.call("ts-admin-refresh-hit", hitId)

This comment has been minimized.

Copy link
@mizzao

mizzao Aug 14, 2015

Author Member

@ldworkin Can you see if this refreshes the HIT data right after creation, so it's not blank?


return

"ts-admin-refresh-hit": (HITId) ->
Expand Down
3 changes: 0 additions & 3 deletions admin/mturkAdmin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,6 @@ Template.tsAdminCompletedAssignmentsTable.events
"click .ts-admin-pay-bonus": ->
TurkServer._displayModal Template.tsAdminPayBonus, this

"click .ts-admin-email-worker": ->
TurkServer._displayModal Template.tsAdminEmailWorker, this

Template.tsAdminCompletedAssignmentRow.helpers
labelStatus: ->
switch @mturkStatus
Expand Down
5 changes: 0 additions & 5 deletions admin/mturkAdmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,6 @@ <h3>Maintenance</h3>
</button>
{{/if}}
</dd>
<dt>Email</dt>
<dd><button class="btn btn-xs btn-info ts-admin-email-worker">
<span class="glyphicon glyphicon-envelope"></span>
</button>
</dd>
</dl>
</td>
<td>{{> tsDescList exitdata}}</td>
Expand Down
10 changes: 8 additions & 2 deletions admin/util.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ Template.tsAdminPayBonus.events
Template.tsAdminEmailWorker.events
"submit form": (e, t) ->
e.preventDefault()
subject = t.find("textarea[name=subject]").value
subject = t.find("input[name=subject]").value
message = t.find("textarea[name=message]").value
recipients = [@workerId]

emailId = WorkerEmails.insert({ subject, message, recipients })
Meteor.call "ts-admin-send-message", emailId

Meteor.call "ts-admin-send-message", emailId, (err) ->
bootbox.alert(err) if err

This comment has been minimized.

Copy link
@mizzao

mizzao Aug 14, 2015

Author Member

Added this line to throw up the error if something is thrown.


$(t.firstNode).closest(".bootbox.modal").modal('hide')

Expand Down Expand Up @@ -101,6 +103,10 @@ Template.tsUserPill.helpers
labelClass: userLabelClass
identifier: userIdentifier

Template.tsUserPill.events
"click .ts-admin-email-worker": ->
TurkServer._displayModal Template.tsAdminEmailWorker, this

Template.tsDescList.helpers
properties: ->
result = []
Expand Down
16 changes: 12 additions & 4 deletions admin/util.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</template>

<template name="tsAdminPayBonus">
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">WorkerId</label>
Expand Down Expand Up @@ -90,10 +91,11 @@
</div>
<button class="btn btn-primary" type="submit">Pay Bonus</button>
</form>
</div>
</template>

<template name="tsAdminEmailWorker">
<div class="clear"></div>
<div class="modal-body">

This comment has been minimized.

Copy link
@mizzao

mizzao Aug 14, 2015

Author Member

This makes the form display properly using BS3 styles without the need for the clearfix.

<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">WorkerId</label>
Expand All @@ -104,17 +106,18 @@
<div class="form-group">
<label class="col-sm-3 control-label">Subject</label>
<div class="col-sm-9">
<textarea class="form-control" name="subject" rows="1" required></textarea>
<input class="form-control" type="text" name="subject" required>
</div>
</div>
<div class="form-group">
<div class="form-group">
<label class="col-sm-3 control-label">Message</label>
<div class="col-sm-9">
<textarea class="form-control" name="message" rows="4" required></textarea>
<textarea class="form-control" name="message" rows="10" required></textarea>
</div>
</div>
<button class="btn btn-primary" type="submit">Send Message</button>
</form>
</div>
</template>

<!-- Template for displaying a worker in a dropdown list -->
Expand Down Expand Up @@ -157,6 +160,11 @@
{{/if}}</dd>
<dt>State:</dt>
<dd>{{turkserver.state}}</dd>
<dt>Contact:</dt>
<dd><button class="btn btn-xs btn-info ts-admin-email-worker">
<span class="glyphicon glyphicon-envelope"></span>
</button>
</dd>

This comment has been minimized.

Copy link
@mizzao

mizzao Aug 14, 2015

Author Member

Moved this into the worker popover.

</dl>

{{#if status.online}}
Expand Down
2 changes: 0 additions & 2 deletions client/ts_client.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ html, body
.form-control.width-long
width: 240px

.clear
clear: both

0 comments on commit 70ebdf5

Please sign in to comment.