diff --git a/app/controllers/budget.js b/app/controllers/budget.js index f932b83..1f2ddc8 100644 --- a/app/controllers/budget.js +++ b/app/controllers/budget.js @@ -1,10 +1,26 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; import { alias } from '@ember/object/computed'; +import { action } from '@ember/object'; export default class BudgetController extends Controller { @service kredits; + @service router; @alias('kredits.reimbursementsUnconfirmed') reimbursementsUnconfirmed; @alias('kredits.reimbursementsConfirmed') reimbursementsConfirmed; + @alias('kredits.currentUserIsCore') currentUserIsCore; + + @action + addReimbursement () { + if (!this.kredits.currentUser) { + window.alert('You need to connect your RSK account first.'); + return false; + } + if (!this.kredits.currentUserIsCore) { + window.alert('Only core contributors can submit reimbursements.'); + return false; + } + this.router.transitionTo('reimbursements.new'); + } } diff --git a/app/templates/budget.hbs b/app/templates/budget.hbs index f801b88..598085d 100644 --- a/app/templates/budget.hbs +++ b/app/templates/budget.hbs @@ -17,7 +17,11 @@

Proposed Reimbursements

@@ -31,7 +35,11 @@

Confirmed Reimbursements