From 69ab4913aa59e72f891470edd761da57a63c7303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 20 Mar 2024 18:18:10 +0100 Subject: [PATCH] Require connected account for adding reimbursement Just in the UI, so nothing gets reloaded by accident later --- app/controllers/budget.js | 16 ++++++++++++++++ app/templates/budget.hbs | 12 ++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) 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