diff --git a/.template-lintrc.js b/.template-lintrc.js index b45e96f..02bee12 100644 --- a/.template-lintrc.js +++ b/.template-lintrc.js @@ -1,5 +1,9 @@ 'use strict'; module.exports = { - extends: 'recommended' + extends: 'recommended', + + rules: { + 'simple-unless': false + } }; diff --git a/app/components/add-contributor/component.js b/app/components/add-contributor/component.js index 32800c1..7e3b821 100644 --- a/app/components/add-contributor/component.js +++ b/app/components/add-contributor/component.js @@ -2,7 +2,6 @@ import Component from '@ember/component'; import { and, notEmpty } from '@ember/object/computed'; import { inject as service } from '@ember/service'; - export default Component.extend({ kredits: service(), @@ -14,6 +13,7 @@ export default Component.extend({ isValidURL: notEmpty('url'), isValidGithubUID: notEmpty('github_uid'), isValidGithubUsername: notEmpty('github_username'), + isValidGiteaUsername: notEmpty('gitea_username'), isValidWikiUsername: notEmpty('wiki_username'), isValid: and( 'isValidAccount', @@ -21,10 +21,11 @@ export default Component.extend({ 'isValidGithubUID' ), + inProgress: false, + init () { this._super(...arguments); - // Default attributes used by reset this.set('attributes', { account: null, name: null, @@ -32,8 +33,8 @@ export default Component.extend({ url: null, github_username: null, github_uid: null, - wiki_username: null, - isCore: false + gitea_username: null, + wiki_username: null }); }, @@ -53,17 +54,19 @@ export default Component.extend({ return; } - let attributes = Object.keys(this.attributes); - let contributor = this.getProperties(attributes); - let saved = this.save(contributor); + const attributes = Object.keys(this.attributes); + const contributor = this.getProperties(attributes); - // The promise handles inProgress - this.set('inProgress', saved); + this.set('inProgress', true); - saved.then(() => { + this.save(contributor).then(() => { this.reset(); window.scroll(0,0); - window.alert('Contributor added.'); + }).catch(err => { + console.log(err); + window.alert('Something went wrong. Please check the browser console.'); + }).finally(() => { + this.set('inProgress', false); }); } } diff --git a/app/components/add-contributor/template.hbs b/app/components/add-contributor/template.hbs index 235c535..fe98c5f 100644 --- a/app/components/add-contributor/template.hbs +++ b/app/components/add-contributor/template.hbs @@ -1,13 +1,4 @@
-

- {{input name="is-core" - type="checkbox" - id="is-core" - checked=isCore}} - -

{{input name="account" type="text" @@ -49,6 +40,13 @@ value=github_username class=(if isValidGithubUsername "valid" "")}}

+

+ {{input name="gitea_username" + type="text" + placeholder="Gitea username" + value=gitea_username + class=(if isValidGiteaUsername "valid" "")}} +

{{input name="wiki_username" type="text" @@ -58,7 +56,7 @@

{{input type="submit" - disabled=(is-pending inProgress) - value=(if (is-pending inProgress) "Processing" "Save")}} + disabled=inProgress + value=(if inProgress "Processing" "Save")}}

diff --git a/app/components/contribution-list/component.js b/app/components/contribution-list/component.js index c490f86..f85da1d 100644 --- a/app/components/contribution-list/component.js +++ b/app/components/contribution-list/component.js @@ -5,16 +5,16 @@ export default Component.extend({ tagName: 'ul', classNames: ['contribution-list'], - // actions: { - // - // veto (contributionId) { - // if (this.contractInteractionEnabled) { - // this.vetoContribution(contributionId); - // } else { - // window.alert('Only members can veto contributions. Please ask someone to set you up.'); - // } - // } - // - // } + actions: { + + veto (contributionId) { + if (this.contractInteractionEnabled) { + this.vetoContribution(contributionId); + } else { + window.alert('Only members can veto contributions. Please ask someone to set you up.'); + } + } + + } }); diff --git a/app/components/contribution-list/template.hbs b/app/components/contribution-list/template.hbs index d53ad52..29a5760 100644 --- a/app/components/contribution-list/template.hbs +++ b/app/components/contribution-list/template.hbs @@ -1,5 +1,5 @@ {{#each contributions as |contribution|}} -
  • +
  • {{user-avatar contributor=contribution.contributor}} ({{contribution.kind}}) @@ -14,5 +14,12 @@

    {{contribution.amount}}₭S

    + {{#unless contribution.vetoed}} + {{#unless (is-confirmed-contribution contribution)}} +

    + +

    + {{/unless}} + {{/unless}}
  • {{/each}} \ No newline at end of file diff --git a/app/components/contributor-list/template.hbs b/app/components/contributor-list/template.hbs index 765ebd9..ec319e4 100644 --- a/app/components/contributor-list/template.hbs +++ b/app/components/contributor-list/template.hbs @@ -19,7 +19,7 @@