Fix actions, etc.

This commit is contained in:
2020-05-11 10:06:12 +02:00
parent 018132034d
commit 22300c2980
11 changed files with 30 additions and 24 deletions
+3 -1
View File
@@ -45,7 +45,9 @@ export default Component.extend({
actions: {
submit () {
submit (evt) {
evt.preventDefault();
if (!this.isValid) {
alert('Invalid data. Please review and try again.');
return;
+1 -1
View File
@@ -1,4 +1,4 @@
<form {{on "submit" this.submit}}>
<form onsubmit={{action "submit"}}>
<label>
<p class="label">Contributor:</p>
<p>
+9 -3
View File
@@ -7,8 +7,8 @@ import { isAddress } from 'web3-utils';
export default Component.extend({
kredits: service(),
router: service(),
kredits: service(),
attributes: null,
@@ -60,9 +60,15 @@ export default Component.extend({
actions: {
submit () {
submit (evt) {
evt.preventDefault();
if (!this.kredits.currentUserIsCore) {
window.alert('Only core team members can edit profiles. Please ask someone to set you up.');
return;
}
if (!this.isValid) {
alert('Invalid data. Please review and try again.');
window.alert('Invalid data. Please review and try again.');
return;
}
+1 -1
View File
@@ -1,4 +1,4 @@
<form {{on "submit" this.submit}}>
<form onsubmit={{action "submit"}}>
<p>
<label for="c-account">Ethereum account</label>
<Input @name="account" @id="c-account"
@@ -24,12 +24,10 @@ export default Component.extend({
contributors: sort('kredits.contributors', 'contributorsSorting'),
contributorsActive: computed('contributors.[]', 'contributions', function() {
let activeIds = this.contributions.mapBy('contributorId')
.map(id => id.toString())
.uniq();
return this.contributors.filter(c => {
return activeIds.includes(c.id.toString());
});
const activeIds = new Set(this.contributions.mapBy('contributorId')
.map(id => id.toString()));
return this.contributors.filter(c => activeIds.has(c.id.toString()));
}),
contributionKinds: computed('contributions.[]', function() {
@@ -22,7 +22,7 @@
</label>
<label class="filter-contribution-size">
<Input type="checkbox" @checked={{this.hideSmallContributions}} />
<Input @type="checkbox" @checked={{this.hideSmallContributions}} />
Hide small contributions
</label>
</p>
@@ -32,8 +32,8 @@
<ul class="contribution-list">
{{#each this.contributionsFiltered as |contribution|}}
<li role="button" data-contribution-id={{contribution.id}}
{{on "click" (fn this.openContributionDetails contribution)}}
class="{{contribution-status contribution}}{{if (eq contribution.id @selectedContributionId) " selected"}}">
{{action "openContributionDetails" contribution}}
class="{{if (eq contribution.id @selectedContributionId) " selected"}}">
<p class="meta">
<span class="recipient"><UserAvatar @contributor={{contribution.contributor}} /></span>
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
@@ -45,9 +45,9 @@
{{#unless contribution.vetoed}}
{{#unless (is-confirmed-contribution contribution)}}
<p class="voting">
<Input @type="button" @class="button small danger" @value="veto"
@click={{fn this.veto contribution.id}}
@disabled={{contribution.hasPendingChanges}} />
{{input type="button" class="button small danger" value="veto"
click=(action "veto" contribution.id)
disabled=contribution.hasPendingChanges}}
</p>
{{/unless}}
{{/unless}}
+1 -1
View File
@@ -1,7 +1,7 @@
<tbody>
{{#each @contributorList as |c|}}
<tr role="button"
{{on "click" (fn this.openContributorDetails c.contributor)}}
onclick={{action "openContributorDetails" c.contributor}}
class="{{if (is-current-user c.contributor) "current-user"}} {{if (eq c.contributor.id @selectedContributorId) "selected"}}">
<td class="person">
<UserAvatar @contributor={{c.contributor}} /> {{c.contributor.name}}
@@ -9,9 +9,9 @@
{{/if}}
{{else}}
<span class="anonymous">Anonymous</span>
<button {{on "click" this.signup}} class="small" type="button">Sign up</button>
<button onclick={{action "signup"}} class="small" type="button">Sign up</button>
{{#if this.showConnectButton}}
<button {{on "click" this.connectAccount}} class="small green" type="button">Connect account</button>
<button onclick={{action "connectAccount"}} class="small green" type="button">Connect account</button>
{{/if}}
{{/if}}
{{/if}}