Fix JS/Ember style

This commit is contained in:
2018-04-06 17:40:45 +02:00
parent f992fb10bd
commit 499b22af15
2 changed files with 16 additions and 16 deletions
+8 -8
View File
@@ -7,6 +7,7 @@ import Ember from 'ember';
import Service from 'ember-service'; import Service from 'ember-service';
import injectService from 'ember-service/inject'; import injectService from 'ember-service/inject';
import computed, { alias } from 'ember-computed'; import computed, { alias } from 'ember-computed';
import { isEmpty, isPresent } from 'ember-utils';
import config from 'kredits-web/config/environment'; import config from 'kredits-web/config/environment';
import Proposal from 'kredits-web/models/proposal'; import Proposal from 'kredits-web/models/proposal';
@@ -32,14 +33,14 @@ export default Service.extend({
currentUserAccounts: null, // default to not having an account. this is the wen web3 is loaded. currentUserAccounts: null, // default to not having an account. this is the wen web3 is loaded.
currentUser: null, currentUser: null,
currentUserIsContributor: computed('currentUser', function() { currentUserIsContributor: computed('currentUser', function() {
return Ember.isPresent(this.get('currentUser')); return isPresent(this.get('currentUser'));
}), }),
currentUserIsCore: alias('currentUser.isCore'), currentUserIsCore: alias('currentUser.isCore'),
hasAccounts: computed('currentUserAccounts', function() { hasAccounts: computed('currentUserAccounts', function() {
return !Ember.isEmpty(this.get('currentUserAccounts')); return !isEmpty(this.get('currentUserAccounts'));
}), }),
accountNeedsUnlock: computed('currentUserAccounts', function() { accountNeedsUnlock: computed('currentUserAccounts', function() {
return this.get('currentUserAccounts') && Ember.isEmpty(this.get('currentUserAccounts')); return this.get('currentUserAccounts') && isEmpty(this.get('currentUserAccounts'));
}), }),
// this is called called in the routes beforeModel(). So it is initialized before everything else // this is called called in the routes beforeModel(). So it is initialized before everything else
@@ -293,17 +294,16 @@ export default Service.extend({
}, },
getCurrentUser: computed('ethProvider', function() { getCurrentUser: computed('ethProvider', function() {
if (Ember.isEmpty(this.get('currentUserAccounts'))) { if (isEmpty(this.get('currentUserAccounts'))) {
return Ember.RSVP.resolve(); return RSVP.resolve();
} }
return this.get('contributorsContract') return this.get('contributorsContract')
.then((contract) => { .then((contract) => {
console.log('user accounts', this.get('currentUserAccounts')[0]); return contract.getContributorIdByAddress(this.get('currentUserAccounts.firstObject'))
return contract.getContributorIdByAddress(this.get('currentUserAccounts')[0])
.then((id) => { .then((id) => {
// check if the user is a contributor or not // check if the user is a contributor or not
if( id.toNumber() === 0) { if( id.toNumber() === 0) {
return Ember.RSVP.resolve(); return RSVP.resolve();
} else { } else {
return this.getContributorData(id.toNumber()); return this.getContributorData(id.toNumber());
} }
+8 -8
View File
@@ -1,13 +1,13 @@
{{#if kredits.hasAccounts }} {{#if kredits.hasAccounts }}
<section id="user-account"> <section id="user-account">
{{#if kredits.currentUser }} {{#if kredits.currentUser }}
{{ kredits.currentUser.name }} {{ kredits.currentUser.name }}
{{#if kredits.currentUserIsCore }} {{#if kredits.currentUserIsCore }}
(core) (core)
{{/if}}
Account: {{kredits.currentUser.address}}
{{/if}} {{/if}}
Account: {{kredits.currentUser.address}} </section>
{{/if}}
</section>
{{/if}} {{/if}}
<section id="contributors"> <section id="contributors">