Skip to content

Commit

Permalink
Require connected account for adding reimbursement
Browse files Browse the repository at this point in the history
Just in the UI, so nothing gets reloaded by accident later
  • Loading branch information
raucao committed Mar 20, 2024
1 parent 39e01e4 commit 69ab491
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
16 changes: 16 additions & 0 deletions app/controllers/budget.js
Original file line number Diff line number Diff line change
@@ -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');
}
}
12 changes: 10 additions & 2 deletions app/templates/budget.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
<header class="with-nav">
<h2>Proposed Reimbursements</h2>
<nav>
<LinkTo @route="reimbursements.new" @title="Submit a reimbursement" class="button small green">add</LinkTo>
<button title="Submit a reimbursement"

Check failure on line 20 in app/templates/budget.hbs

View workflow job for this annotation

GitHub Actions / build (16.x)

All `<button>` elements should have a valid `type` attribute
class="button small green"
{{on "click" this.addReimbursement}}>
add
</button>
</nav>
</header>
<div class="content">
Expand All @@ -31,7 +35,11 @@
<header class="with-nav">
<h2>Confirmed Reimbursements</h2>
<nav>
<LinkTo @route="reimbursements.new" @title="Submit a reimbursement" class="button small green">add</LinkTo>
<button title="Submit a reimbursement"

Check failure on line 38 in app/templates/budget.hbs

View workflow job for this annotation

GitHub Actions / build (16.x)

All `<button>` elements should have a valid `type` attribute
class="button small green"
{{on "click" this.addReimbursement}}>
add
</button>
</nav>
</header>
<div class="content">
Expand Down

0 comments on commit 69ab491

Please sign in to comment.