Skip to content

Commit

Permalink
Definalize button added #77
Browse files Browse the repository at this point in the history
  • Loading branch information
Csutorás Robin committed Sep 21, 2017
1 parent 3b2ee8f commit b81a445
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
18 changes: 16 additions & 2 deletions app/components/directory-settings-student-registration.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import Ember from 'ember';

export default Ember.Component.extend({

classNames: ['student-registration'],
semesterName: Ember.computed(function() {
return this.get('StudentRegistration.Semester').then(semester => {
return `${semester.get('academicyear')}/${semester.get('academicterm')}`;
});
})
}),
actions: {
definalize(deliverable) {
deliverable.set('success', false);
deliverable.set('error', '');
deliverable.set('finalized', false);
deliverable.save().then(() => {
deliverable.set('success', true);
}, (t) => {
if (t.errors && t.errors.length > 0 && t.errors[0].title) {
deliverable.set('error', t.errors[0].title);
}
});
return false;
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
<div style="margin-left: 1em;">
{{staff-laboratory-upload Deliverable=Deliverable}}
{{staff-laboratory-time-change Deliverable=Deliverable}}
<button type="button" disabled={{not Deliverable.finalized}} {{action 'definalize' Deliverable}}>Definalize</button>
{{#if Deliverable.success}}
<div class="success-box">
Saved successfully.
</div>
{{else}}
{{#unless (or (eq Deliverable.error '') (eq Deliverable.error undefined))}}
<div class="error-box">
{{Deliverable.error}}
</div>
{{/unless}}
{{/if}}
</div>
{{/if}}
{{/each}}
Expand Down

0 comments on commit b81a445

Please sign in to comment.