Require connected account for adding reimbursement
Just in the UI, so nothing gets reloaded by accident later
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
class="button small green"
|
||||
{{on "click" this.addReimbursement}}>
|
||||
add
|
||||
</button>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="content">
|
||||
@@ -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"
|
||||
class="button small green"
|
||||
{{on "click" this.addReimbursement}}>
|
||||
add
|
||||
</button>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="content">
|
||||
|
||||
Reference in New Issue
Block a user