Fix actions, etc.
This commit is contained in:
@@ -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,4 +1,4 @@
|
||||
<form {{on "submit" this.submit}}>
|
||||
<form onsubmit={{action "submit"}}>
|
||||
<label>
|
||||
<p class="label">Contributor:</p>
|
||||
<p>
|
||||
|
||||
@@ -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,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,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}}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<ul class="external-accounts">
|
||||
{{#each this.model.accounts as |account|}}
|
||||
<li>
|
||||
<ExternalAccountLink @account={{this.account}} />
|
||||
<ExternalAccountLink @account={{account}} />
|
||||
</li>
|
||||
{{/each}}
|
||||
{{#if this.model.url}}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</form>
|
||||
<p class="actions">
|
||||
<button disabled={{this.signupButtonDisabled}}
|
||||
{{on "click" this.completeSignup}}
|
||||
onclick={{action "completeSignup"}}
|
||||
type="button">
|
||||
Complete my profile
|
||||
</button>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
connecting one of the following accounts:
|
||||
</p>
|
||||
<p class="actions">
|
||||
<button {{on "click" this.connectGithub}} class="icon" type="button">
|
||||
<button onclick={{action "connectGithub"}} class="icon" type="button">
|
||||
<IconAccountGithubCom />
|
||||
Connect GitHub
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user