Skip to content

Commit

Permalink
finalize button added #44
Browse files Browse the repository at this point in the history
  • Loading branch information
Csutorás Robin committed Sep 21, 2017
1 parent 44d5d0d commit 3b2ee8f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 9 additions & 8 deletions app/controllers/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,6 @@ export default Ember.Controller.extend({
this.actions.changeDeliverable.apply(this, [{ meta: deliverable }]);
return false;
},
toggleFinalized() {
this.toggleProperty('selectedDeliverable.finalized');
return false;
},
toggleGrading() {
this.toggleProperty('selectedDeliverable.gradingCache');
return false;
},
book() {
this.set('success', false);
this.set('error', '');
Expand Down Expand Up @@ -199,6 +191,15 @@ export default Ember.Controller.extend({
if (this.get('selectedDeliverable.imsc') === '') {
this.set('selectedDeliverable.imsc', null);
}
if (this.get('selectedDeliverable.grade') === null) {
this.set('error', 'No grade provided.');
return;
}
if (this.get('selectedDeliverable.comment') === null) {
this.set('error', 'No comment provided.');
return;
}
this.set('selectedDeliverable.finalized', true);
this.get('selectedDeliverable').save().then(() => {
this.set('success', true);
}, (t) => {
Expand Down
17 changes: 11 additions & 6 deletions app/templates/evaluator.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
{{#unless (eq selectedDeliverable.Corrector.id model.user.id)}}
<div class="text">Sorry, you have not been chosen for grading this. First select this for grading, go to the 'Select for grading' menu.</div>
{{else}}
<button type="button" {{action 'unbook'}}>Unbook</button>
{{#unless selectedDeliverable.finalized}}
<button type="button" {{action 'unbook'}}>Unbook</button>
{{/unless}}
<div class="text label">Event name and deliverable description:</div>
<div class="text">{{selectedEvent.EventTemplate.name}} {{selectedDeliverable.DeliverableTemplate.description}}</div>
<div class="text label">Student</div>
Expand All @@ -96,13 +98,16 @@
<div class="text">Not uploaded.</div>
{{/if}}
<div class="text label">Grade</div>
{{input type=nubmer value=selectedDeliverable.grade placeholder="grade"}}
{{input type=nubmer value=selectedDeliverable.grade placeholder="grade" disabled=selectedDeliverable.finalized}}
<div class="text label">Comment</div>
{{textarea value=selectedDeliverable.comment cols="9" rows="9" placeholder="comment" }}
{{textarea value=selectedDeliverable.comment cols="9" rows="9" placeholder="comment" disabled=selectedDeliverable.finalized}}
<div class="text label">Imsc</div>
{{input type=nubmer value=selectedDeliverable.imsc placeholder="imsc"}}
<button type="button" class="btn--toggle {{if selectedDeliverable.finalized 'active'}}" {{action 'toggleFinalized'}}>finalized</button><br/>
<button type="button" {{action 'save'}}>Save</button>
{{input type=nubmer value=selectedDeliverable.imsc placeholder="imsc" disabled=selectedDeliverable.finalized}}
{{#if selectedDeliverable.finalized}}
<div class="text">Finalized. If you want to change ask the administrator.</div>
{{else}}
<button type="button" {{action 'save'}}>Finalize</button>
{{/if}}
{{#if success}}
<div class="success-box">
Saved successfully.
Expand Down

0 comments on commit 3b2ee8f

Please sign in to comment.