From 499b22af151c0c6a8225ac668569584189086861 Mon Sep 17 00:00:00 2001 From: bumi Date: Fri, 6 Apr 2018 17:40:45 +0200 Subject: [PATCH] Fix JS/Ember style --- app/services/kredits.js | 16 ++++++++-------- app/templates/index.hbs | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/services/kredits.js b/app/services/kredits.js index 8f2f527..3af0ecd 100644 --- a/app/services/kredits.js +++ b/app/services/kredits.js @@ -7,6 +7,7 @@ import Ember from 'ember'; import Service from 'ember-service'; import injectService from 'ember-service/inject'; import computed, { alias } from 'ember-computed'; +import { isEmpty, isPresent } from 'ember-utils'; import config from 'kredits-web/config/environment'; 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. currentUser: null, currentUserIsContributor: computed('currentUser', function() { - return Ember.isPresent(this.get('currentUser')); + return isPresent(this.get('currentUser')); }), currentUserIsCore: alias('currentUser.isCore'), hasAccounts: computed('currentUserAccounts', function() { - return !Ember.isEmpty(this.get('currentUserAccounts')); + return !isEmpty(this.get('currentUserAccounts')); }), 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 @@ -293,17 +294,16 @@ export default Service.extend({ }, getCurrentUser: computed('ethProvider', function() { - if (Ember.isEmpty(this.get('currentUserAccounts'))) { - return Ember.RSVP.resolve(); + if (isEmpty(this.get('currentUserAccounts'))) { + return RSVP.resolve(); } return this.get('contributorsContract') .then((contract) => { - console.log('user accounts', this.get('currentUserAccounts')[0]); - return contract.getContributorIdByAddress(this.get('currentUserAccounts')[0]) + return contract.getContributorIdByAddress(this.get('currentUserAccounts.firstObject')) .then((id) => { // check if the user is a contributor or not if( id.toNumber() === 0) { - return Ember.RSVP.resolve(); + return RSVP.resolve(); } else { return this.getContributorData(id.toNumber()); } diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 37617ce..49817d1 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -1,13 +1,13 @@ {{#if kredits.hasAccounts }} -
- {{#if kredits.currentUser }} - {{ kredits.currentUser.name }} - {{#if kredits.currentUserIsCore }} - (core) +
+ {{#if kredits.currentUser }} + {{ kredits.currentUser.name }} + {{#if kredits.currentUserIsCore }} + (core) + {{/if}} + Account: {{kredits.currentUser.address}} {{/if}} - Account: {{kredits.currentUser.address}} - {{/if}} -
+
{{/if}}