@@ -3,6 +3,7 @@ import { and, notEmpty } from '@ember/object/computed';
|
|||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
|
||||||
kredits: service(),
|
kredits: service(),
|
||||||
|
|
||||||
attributes: null,
|
attributes: null,
|
||||||
@@ -36,10 +37,7 @@ export default Component.extend({
|
|||||||
gitea_username: null,
|
gitea_username: null,
|
||||||
wiki_username: null
|
wiki_username: null
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
didInsertElement() {
|
|
||||||
this._super(...arguments);
|
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -48,7 +46,8 @@ export default Component.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
submit() {
|
|
||||||
|
submit () {
|
||||||
if (!this.isValid) {
|
if (!this.isValid) {
|
||||||
alert('Invalid data. Please review and try again.');
|
alert('Invalid data. Please review and try again.');
|
||||||
return;
|
return;
|
||||||
@@ -63,12 +62,13 @@ export default Component.extend({
|
|||||||
this.reset();
|
this.reset();
|
||||||
window.scroll(0,0);
|
window.scroll(0,0);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err);
|
console.warn(err);
|
||||||
window.alert('Something went wrong. Please check the browser console.');
|
window.alert('Something went wrong. Please check the browser console.');
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.set('inProgress', false);
|
this.set('inProgress', false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
|
export default Controller.extend({
|
||||||
|
|
||||||
|
kredits: service(),
|
||||||
|
|
||||||
|
contributors: alias('kredits.contributors'),
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
|
||||||
|
save (contributor) {
|
||||||
|
return this.kredits.addContributor(contributor)
|
||||||
|
.then(contributor => {
|
||||||
|
this.transitionToRoute('index');
|
||||||
|
return contributor;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@@ -37,14 +37,6 @@ export default Controller.extend({
|
|||||||
this.kredits.vote(proposalId).then(transaction => {
|
this.kredits.vote(proposalId).then(transaction => {
|
||||||
console.debug('[controllers:index] Vote submitted to Ethereum blockhain: '+transaction.hash);
|
console.debug('[controllers:index] Vote submitted to Ethereum blockhain: '+transaction.hash);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
save (contributor) {
|
|
||||||
return this.kredits.addContributor(contributor)
|
|
||||||
.then(contributor => {
|
|
||||||
this.contributors.pushObject(contributor);
|
|
||||||
return contributor;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ Router.map(function() {
|
|||||||
this.route('contributions', function() {
|
this.route('contributions', function() {
|
||||||
this.route('new');
|
this.route('new');
|
||||||
});
|
});
|
||||||
|
this.route('contributors', function() {
|
||||||
|
this.route('new');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Router;
|
export default Router;
|
||||||
|
|||||||
@@ -190,7 +190,9 @@ export default Service.extend({
|
|||||||
return this.kredits.Contributor.add(attributes, { gasLimit: 350000 })
|
return this.kredits.Contributor.add(attributes, { gasLimit: 350000 })
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.debug('[kredits] add contributor response', data);
|
console.debug('[kredits] add contributor response', data);
|
||||||
return Contributor.create(attributes);
|
const contributor = Contributor.create(attributes);
|
||||||
|
this.contributors.pushObject(contributor);
|
||||||
|
return contributor;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<main class="center-column">
|
||||||
|
|
||||||
|
<section id="add-contributor">
|
||||||
|
<header>
|
||||||
|
<h2>Add contributor profile</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{{add-contributor contributors=contributors save=(action "save")}}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
+6
-17
@@ -2,8 +2,13 @@
|
|||||||
|
|
||||||
<div id="stats">
|
<div id="stats">
|
||||||
<section id="people">
|
<section id="people">
|
||||||
<header>
|
<header class="with-nav">
|
||||||
<h2>Contributors</h2>
|
<h2>Contributors</h2>
|
||||||
|
{{#if kredits.hasAccounts}}
|
||||||
|
<nav>
|
||||||
|
{{link-to "add" "contributors.new" title="Add contributor profile" class="button small green"}}
|
||||||
|
</nav>
|
||||||
|
{{/if}}
|
||||||
</header>
|
</header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{contributor-list contributorList=kreditsToplist
|
{{contributor-list contributorList=kreditsToplist
|
||||||
@@ -61,20 +66,4 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if kredits.hasAccounts}}
|
|
||||||
<section id="add-contributor">
|
|
||||||
<header>
|
|
||||||
<h2>Add Contributor</h2>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="content">
|
|
||||||
{{#if kredits.currentUser.isCore}}
|
|
||||||
{{add-contributor contributors=contributors save=(action "save")}}
|
|
||||||
{{else}}
|
|
||||||
Only core team members can add new contributors. Please ask someone to set you up.
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user