Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a2bd3f76b8 | |||
| a4ca37d882 | |||
| 143317d909 | |||
| d8bcc8ff67 | |||
| e4a39ec67c | |||
| 5b47ba9e11 | |||
| d8f565cd9e | |||
| a9480a09f1 | |||
| aa9c3648c0 | |||
| 9c18593529 | |||
| 52fe7ff026 | |||
| b02967c5ef | |||
| 7236b2d2b3 | |||
| fd1ae0a612 | |||
| 525a39479b | |||
| 612b76300c | |||
| 42fe01b349 | |||
| 80af572742 | |||
| d7a0817ac6 | |||
| c65880972a | |||
| c94319e6a8 | |||
| f9dbd47922 | |||
| 636ac30622 | |||
| 791943bb95 | |||
| d9ae654f42 | |||
| 8a156f964b | |||
| 743a4cc3ac |
+10
-2
@@ -1,7 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaVersion: 2017,
|
ecmaVersion: 2018,
|
||||||
sourceType: 'module'
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
@@ -41,7 +41,15 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
browser: false,
|
browser: false,
|
||||||
node: true
|
node: true
|
||||||
}
|
},
|
||||||
|
plugins: ['node'],
|
||||||
|
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
|
||||||
|
// add your custom rules and overrides for node files here
|
||||||
|
|
||||||
|
// this can be removed once the following is fixed
|
||||||
|
// https://github.com/mysticatea/eslint-plugin-node/issues/77
|
||||||
|
'node/no-unpublished-require': 'off'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
template: |
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
$CHANGES
|
||||||
+2
-1
@@ -4,6 +4,7 @@ module.exports = {
|
|||||||
extends: 'recommended',
|
extends: 'recommended',
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
'simple-unless': false
|
'simple-unless': false,
|
||||||
|
'no-nested-interactive': false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ env:
|
|||||||
# See https://git.io/vdao3 for details.
|
# See https://git.io/vdao3 for details.
|
||||||
- JOBS=1
|
- JOBS=1
|
||||||
|
|
||||||
before_install:
|
|
||||||
- npm config set spin false
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run lint:hbs
|
- npm run lint:hbs
|
||||||
- npm run lint:js
|
- npm run lint:js
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ With IPFS and Ethereum/ganache running, you can now start this Ember app.
|
|||||||
If you restart the devchain your network ID changes. So kredits-contracts does not find the correct DAO Kernel address.
|
If you restart the devchain your network ID changes. So kredits-contracts does not find the correct DAO Kernel address.
|
||||||
If that is the case the DAO address must be provided as `KREDITS_KERNEL_ADDRESS` environment variable.
|
If that is the case the DAO address must be provided as `KREDITS_KERNEL_ADDRESS` environment variable.
|
||||||
|
|
||||||
* `KREDITS_KERNEL_ADDRESS=<0xYOURADDRESS> npm run start:local` - find your address with the `npm run dao:address` command in the kredits-contracts repo.
|
* `npm run dao:address` in the kredits-contracts repo to find your address
|
||||||
|
* `KREDITS_KERNEL_ADDRESS=<0xYOURADDRESS> npm run start:local`
|
||||||
|
|
||||||
#### IPFS
|
#### IPFS
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import { and, notEmpty } from '@ember/object/computed';
|
import { and, notEmpty } from '@ember/object/computed';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
|
||||||
@@ -21,13 +22,13 @@ export default Component.extend({
|
|||||||
|
|
||||||
init () {
|
init () {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.set('defaultDate', new Date());
|
this.set('defaultDate', moment().startOf('hour').toDate());
|
||||||
|
|
||||||
// Default attributes used by reset
|
// Default attributes used by reset
|
||||||
this.set('attributes', {
|
this.set('attributes', {
|
||||||
contributorId: null,
|
contributorId: null,
|
||||||
kind: null,
|
kind: null,
|
||||||
date: [new Date()],
|
date: this.defaultDate,
|
||||||
amount: null,
|
amount: null,
|
||||||
description: null,
|
description: null,
|
||||||
url: null,
|
url: null,
|
||||||
@@ -49,8 +50,12 @@ export default Component.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const attributes = this.getProperties(Object.keys(this.attributes));
|
const attributes = this.getProperties(Object.keys(this.attributes));
|
||||||
const [ date/* , time */ ] = attributes.date[0].toISOString().split('T');
|
|
||||||
attributes.date = date;
|
let dateInput = (attributes.date instanceof Array) ?
|
||||||
|
attributes.date[0] : attributes.date;
|
||||||
|
|
||||||
|
const [ date, time ] = dateInput.toISOString().split('T');
|
||||||
|
[ attributes.date, attributes.time ] = [ date, time ];
|
||||||
|
|
||||||
this.set('inProgress', true);
|
this.set('inProgress', true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
<form {{action "submit" on="submit"}}>
|
<form {{action "submit" on="submit"}}>
|
||||||
|
<label>
|
||||||
|
<p class="label">Contributor:</p>
|
||||||
<p>
|
<p>
|
||||||
<select required onchange={{action (mut contributorId) value="target.value"}}>
|
<select required onchange={{action (mut contributorId) value="target.value"}}>
|
||||||
<option value="" selected disabled hidden>Contributor</option>
|
<option value="" selected disabled hidden></option>
|
||||||
{{#each contributors as |contributor|}}
|
{{#each contributors as |contributor|}}
|
||||||
<option value={{contributor.id}} selected={{eq contributorId contributor.id}}>{{contributor.name}}</option>
|
<option value={{contributor.id}} selected={{eq contributorId contributor.id}}>{{contributor.name}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<p class="label">Kind:</p>
|
||||||
<p>
|
<p>
|
||||||
<select required onchange={{action (mut kind) value="target.value"}}>
|
<select required onchange={{action (mut kind) value="target.value"}}>
|
||||||
<option value="" selected disabled hidden>Kind</option>
|
<option value="" selected disabled hidden></option>
|
||||||
<option value="community" selected={{eq kind "community"}}>Community</option>
|
<option value="community" selected={{eq kind "community"}}>Community</option>
|
||||||
<option value="design" selected={{eq kind "design"}}>Design</option>
|
<option value="design" selected={{eq kind "design"}}>Design</option>
|
||||||
<option value="dev" selected={{eq kind "dev"}}>Development</option>
|
<option value="dev" selected={{eq kind "dev"}}>Development</option>
|
||||||
@@ -18,37 +23,46 @@
|
|||||||
<option value="special" selected={{eq kind "special"}}>Special</option>
|
<option value="special" selected={{eq kind "special"}}>Special</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<p class="label">Date:</p>
|
||||||
<p>
|
<p>
|
||||||
{{ember-flatpickr
|
{{ember-flatpickr
|
||||||
allowInput=false
|
|
||||||
altFormat="F j, Y"
|
|
||||||
altInput=true
|
|
||||||
altInputClass="date-alt"
|
|
||||||
date=date
|
date=date
|
||||||
dateFormat="Y-m-d"
|
|
||||||
defaultDate=defaultDate
|
defaultDate=defaultDate
|
||||||
maxDate=defaultDate
|
maxDate=defaultDate
|
||||||
|
enableTime=true
|
||||||
|
time_24hr=true
|
||||||
onChange=(action (mut date))
|
onChange=(action (mut date))
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<p class="label">Amount:</p>
|
||||||
<p>
|
<p>
|
||||||
{{input type="text"
|
{{input type="text"
|
||||||
placeholder="500"
|
placeholder="500"
|
||||||
value=amount
|
value=amount
|
||||||
class=(if isValidAmount "valid" "")}}
|
class=(if isValidAmount "valid" "")}}
|
||||||
</p>
|
</p>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<p class="label">Description:</p>
|
||||||
<p>
|
<p>
|
||||||
{{input type="text"
|
{{input type="text"
|
||||||
placeholder="Description"
|
|
||||||
value=description
|
value=description
|
||||||
class=(if isValidDescription "valid" "")}}
|
class=(if isValidDescription "valid" "")}}
|
||||||
</p>
|
</p>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<p class="label">URL (optional):</p>
|
||||||
<p>
|
<p>
|
||||||
{{input type="text"
|
{{input type="text"
|
||||||
placeholder="URL (optional)"
|
|
||||||
value=url
|
value=url
|
||||||
class=(if isValidUrl "valid" "")}}
|
class=(if isValidUrl "valid" "")}}
|
||||||
</p>
|
</p>
|
||||||
|
</label>
|
||||||
|
|
||||||
<p class="actions">
|
<p class="actions">
|
||||||
{{input type="submit"
|
{{input type="submit"
|
||||||
disabled=inProgress
|
disabled=inProgress
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ import { inject as service } from '@ember/service';
|
|||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
|
||||||
|
router: service(),
|
||||||
|
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
classNames: ['contributions'],
|
classNames: ['contributions'],
|
||||||
|
|
||||||
|
selectedContribution: null,
|
||||||
|
|
||||||
showQuickFilter: false,
|
showQuickFilter: false,
|
||||||
hideSmallContributions: false,
|
hideSmallContributions: false,
|
||||||
contributorId: null,
|
contributorId: null,
|
||||||
@@ -57,6 +61,10 @@ export default Component.extend({
|
|||||||
} else {
|
} else {
|
||||||
window.alert('Only members can veto contributions. Please ask someone to set you up.');
|
window.alert('Only members can veto contributions. Please ask someone to set you up.');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
openContributionDetails(contribution) {
|
||||||
|
this.router.transitionTo('dashboard.contributions.show', contribution);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,17 +31,13 @@
|
|||||||
|
|
||||||
<ul class="contribution-list">
|
<ul class="contribution-list">
|
||||||
{{#each contributionsFiltered as |contribution|}}
|
{{#each contributionsFiltered as |contribution|}}
|
||||||
<li data-contribution-id={{contribution.id}} class="{{contribution-status contribution}} {{if contribution.vetoed "vetoed"}}">
|
<li role="button" {{action "openContributionDetails" contribution}}
|
||||||
|
data-contribution-id={{contribution.id}}
|
||||||
|
class="{{contribution-status contribution}}{{if contribution.vetoed " vetoed"}}{{if (eq contribution.id selectedContributionId) " selected"}}">
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
||||||
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
||||||
<span class="title">
|
<span class="title">{{contribution.description}}</span>
|
||||||
{{#if contribution.url}}
|
|
||||||
<a href={{contribution.url}} target="_blank" rel="noopener" title={{contribution.description}}>{{contribution.description}}</a>
|
|
||||||
{{else}}
|
|
||||||
{{contribution.description}}
|
|
||||||
{{/if}}
|
|
||||||
</span>
|
|
||||||
</p>
|
</p>
|
||||||
<p class="kredits-amount">
|
<p class="kredits-amount">
|
||||||
<span class="amount">{{contribution.amount}}</span><span class="symbol">₭S</span>
|
<span class="amount">{{contribution.amount}}</span><span class="symbol">₭S</span>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ export default Component.extend({
|
|||||||
|
|
||||||
tagName: 'table',
|
tagName: 'table',
|
||||||
classNames: 'contributor-list',
|
classNames: 'contributor-list',
|
||||||
selectedContributor: null,
|
|
||||||
|
selectedContributorId: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{#each contributorList as |c|}}
|
{{#each contributorList as |c|}}
|
||||||
<tr role="button" class={{if (is-current-user c.contributor) "current-user"}} {{action "openContributorDetails" c.contributor}}>
|
<tr role="button" {{action "openContributorDetails" c.contributor}}
|
||||||
|
class="{{if (is-current-user c.contributor) "current-user"}} {{if (eq c.contributor.id selectedContributorId) "selected"}}">
|
||||||
<td class="person">
|
<td class="person">
|
||||||
{{user-avatar contributor=c.contributor}} {{c.contributor.name}}
|
{{user-avatar contributor=c.contributor}} {{c.contributor.name}}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export default Controller.extend({
|
|||||||
kredits: service(),
|
kredits: service(),
|
||||||
|
|
||||||
showDetailsPane: false,
|
showDetailsPane: false,
|
||||||
|
selectedContributorId: null,
|
||||||
|
selectedContributionId: null,
|
||||||
|
|
||||||
currentBlock: alias('kredits.currentBlock'),
|
currentBlock: alias('kredits.currentBlock'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import EmberObject from '@ember/object';
|
import EmberObject, { computed } from '@ember/object';
|
||||||
import bignumber from 'kredits-web/utils/cps/bignumber';
|
import bignumber from 'kredits-web/utils/cps/bignumber';
|
||||||
|
|
||||||
export default EmberObject.extend({
|
export default EmberObject.extend({
|
||||||
@@ -18,11 +18,17 @@ export default EmberObject.extend({
|
|||||||
description: null,
|
description: null,
|
||||||
details: null,
|
details: null,
|
||||||
url: null,
|
url: null,
|
||||||
|
date: null,
|
||||||
|
time: null,
|
||||||
ipfsData: '',
|
ipfsData: '',
|
||||||
|
|
||||||
init () {
|
init () {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.set('details', {});
|
this.set('details', {});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
iso8601Date: computed('date', 'time', function() {
|
||||||
|
return this.time ? `${this.date}T${this.time}` : this.date;
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ Router.map(function() {
|
|||||||
this.route('contributors', function() {
|
this.route('contributors', function() {
|
||||||
this.route('show', { path: ':id' });
|
this.route('show', { path: ':id' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.route('contributions', function() {
|
||||||
|
this.route('show', { path: ':id' });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.route('proposals', function() {
|
this.route('proposals', function() {
|
||||||
this.route('new');
|
this.route('new');
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import Route from '@ember/routing/route';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
|
||||||
|
export default Route.extend({
|
||||||
|
|
||||||
|
kredits: service(),
|
||||||
|
contributions: alias('kredits.contributions'),
|
||||||
|
|
||||||
|
model (params) {
|
||||||
|
return this.contributions.findBy('id', parseInt(params.id));
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController (controller, model) {
|
||||||
|
this._super(controller, model);
|
||||||
|
|
||||||
|
this.controllerFor('dashboard')
|
||||||
|
.setProperties({
|
||||||
|
showDetailsPane: true,
|
||||||
|
selectedContributionId: model.id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
deactivate () {
|
||||||
|
this.controllerFor('dashboard')
|
||||||
|
.setProperties({
|
||||||
|
showDetailsPane: false,
|
||||||
|
selectedContributionId: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@@ -11,14 +11,22 @@ export default Route.extend({
|
|||||||
return this.contributors.findBy('id', params.id);
|
return this.contributors.findBy('id', params.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate () {
|
setupController (controller, model) {
|
||||||
|
this._super(controller, model);
|
||||||
|
|
||||||
this.controllerFor('dashboard')
|
this.controllerFor('dashboard')
|
||||||
.set('showDetailsPane', true);
|
.setProperties({
|
||||||
|
showDetailsPane: true,
|
||||||
|
selectedContributorId: model.id
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate () {
|
deactivate () {
|
||||||
this.controllerFor('dashboard')
|
this.controllerFor('dashboard')
|
||||||
.set('showDetailsPane', false);
|
.setProperties({
|
||||||
|
showDetailsPane: false,
|
||||||
|
selectedContributorId: null
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import ethers from 'npm:ethers';
|
import ethers from 'ethers';
|
||||||
import Kredits from 'npm:kredits-contracts';
|
import Kredits from 'kredits-contracts';
|
||||||
import RSVP from 'rsvp';
|
import RSVP from 'rsvp';
|
||||||
|
|
||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ section#add-proposal {
|
|||||||
p {
|
p {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
|
||||||
|
&.label {
|
||||||
|
margin-bottom: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
&.actions {
|
&.actions {
|
||||||
padding-top: 1.5rem;
|
padding-top: 1.5rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ section {
|
|||||||
@import "forms";
|
@import "forms";
|
||||||
|
|
||||||
@import "components/contribution-list";
|
@import "components/contribution-list";
|
||||||
|
@import "components/contribution-details";
|
||||||
@import "components/contributor-list";
|
@import "components/contributor-list";
|
||||||
@import "components/contributor-profile";
|
@import "components/contributor-profile";
|
||||||
@import "components/external-account-link";
|
@import "components/external-account-link";
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
section#contribution-details {
|
||||||
|
header {
|
||||||
|
nav {
|
||||||
|
.amount {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.symbol {
|
||||||
|
padding-left: 0.2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 1.5rem;
|
||||||
|
padding: 2rem 2rem;
|
||||||
|
|
||||||
|
border-top: 1px solid rgba(255,255,255,0.2);
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||||
|
background-color: rgba(255,255,255,0.1);
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.who-what-when {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
margin-bottom: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $primary-color;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: inherit;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,7 @@ ul.contribution-list {
|
|||||||
background-color: rgba(255,255,255,0.1);
|
background-color: rgba(255,255,255,0.1);
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.2);
|
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:first-of-type {
|
&:first-of-type {
|
||||||
border-top: 1px solid rgba(255,255,255,0.2);
|
border-top: 1px solid rgba(255,255,255,0.2);
|
||||||
@@ -52,6 +53,10 @@ ul.contribution-list {
|
|||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
background-color: rgba(255,255,255,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -4,56 +4,20 @@ table.contributor-list {
|
|||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
|
background-color: rgba(255,255,255,0.1);
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.2);
|
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:first-of-type {
|
&:first-of-type {
|
||||||
border-top: 1px solid rgba(255,255,255,0.2);
|
border-top: 1px solid rgba(255,255,255,0.2);
|
||||||
}
|
}
|
||||||
background-color: rgba(255,255,255,0.1);
|
|
||||||
|
|
||||||
&.current-user {
|
&.selected {
|
||||||
background-color: rgba(255,255,255,0.2);
|
background-color: rgba(255,255,255,0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.metadata {
|
&.current-user {
|
||||||
height: 0;
|
font-weight: 500;
|
||||||
visibility: hidden;
|
|
||||||
|
|
||||||
&:not(.visible) {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
padding: 0 1.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: $primary-color;
|
|
||||||
&:hover, &:active {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
list-style: none;
|
|
||||||
display: block;
|
|
||||||
overflow: hidden;
|
|
||||||
height: 0;
|
|
||||||
|
|
||||||
li {
|
|
||||||
display: inline;
|
|
||||||
&+li {
|
|
||||||
margin-left: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.visible {
|
|
||||||
height: auto;
|
|
||||||
visibility: visible;
|
|
||||||
ul {
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
@@ -71,20 +35,17 @@ table.contributor-list {
|
|||||||
|
|
||||||
&.kredits {
|
&.kredits {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
.amount {
|
.amount {
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.symbol {
|
.symbol {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
padding-left: 0.2rem;
|
padding-left: 0.2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
|
||||||
line-height: 1rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
</header>
|
</header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{contributor-list contributorList=kreditsToplist
|
{{contributor-list contributorList=kreditsToplist
|
||||||
showUnconfirmedKredits=showUnconfirmedKredits}}
|
showUnconfirmedKredits=showUnconfirmedKredits
|
||||||
|
selectedContributorId=selectedContributorId}}
|
||||||
|
|
||||||
<p class="stats">
|
<p class="stats">
|
||||||
<span class="number">{{await kredits.totalKreditsEarned}}</span> kredits confirmed and issued to
|
<span class="number">{{await kredits.totalKreditsEarned}}</span> kredits confirmed and issued to
|
||||||
@@ -52,6 +53,7 @@
|
|||||||
{{contribution-list contributions=contributionsUnconfirmedSorted
|
{{contribution-list contributions=contributionsUnconfirmedSorted
|
||||||
vetoContribution=(action "vetoContribution")
|
vetoContribution=(action "vetoContribution")
|
||||||
contractInteractionEnabled=kredits.hasAccounts
|
contractInteractionEnabled=kredits.hasAccounts
|
||||||
|
selectedContributionId=selectedContributionId
|
||||||
showQuickFilter=showQuickFilterUnconfirmed}}
|
showQuickFilter=showQuickFilterUnconfirmed}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -67,6 +69,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
{{contribution-list contributions=contributionsConfirmedSorted
|
{{contribution-list contributions=contributionsConfirmedSorted
|
||||||
vetoContribution=(action "vetoContribution")
|
vetoContribution=(action "vetoContribution")
|
||||||
|
selectedContributionId=selectedContributionId
|
||||||
showQuickFilter=showQuickFilterConfirmed}}
|
showQuickFilter=showQuickFilterConfirmed}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<section id="contribution-details">
|
||||||
|
<header class="with-nav">
|
||||||
|
<h2>Contribution #{{model.id}}</h2>
|
||||||
|
<nav>
|
||||||
|
<span class="amount">{{model.amount}}</span>
|
||||||
|
<span class="symbol">₭S</span>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<p class="who-what-when">
|
||||||
|
<span class="contributor">
|
||||||
|
{{user-avatar contributor=model.contributor}}
|
||||||
|
{{link-to model.contributor.name "dashboard.contributors.show" model.contributor}}
|
||||||
|
</span>
|
||||||
|
contributed
|
||||||
|
<span class="date" title={{model.iso8601Date}}>{{moment-from model.iso8601Date}}</span>:
|
||||||
|
</p>
|
||||||
|
<h3>{{model.description}}</h3>
|
||||||
|
<p>
|
||||||
|
Kind: {{model.kind}}
|
||||||
|
<br>Status: {{contribution-status model}}
|
||||||
|
</p>
|
||||||
|
{{#if model.url}}
|
||||||
|
<p>
|
||||||
|
<a href={{model.url}}
|
||||||
|
title={{model.description}}
|
||||||
|
class="button"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener">
|
||||||
|
Open URL
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<p>
|
||||||
|
{{#if model.ipfsHash}}
|
||||||
|
<a href="https://ipfs.io/ipfs/{{model.ipfsHash}}"
|
||||||
|
class="button small" target="_blank" rel="noopener">
|
||||||
|
Inspect IPFS data
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import ethers from 'npm:ethers';
|
import ethers from 'ethers';
|
||||||
|
|
||||||
export default function(dependentKey, converterMethod) {
|
export default function(dependentKey, converterMethod) {
|
||||||
return computed(dependentKey, {
|
return computed(dependentKey, {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import ethers from 'npm:ethers';
|
import ethers from 'ethers';
|
||||||
import formatKredits from 'kredits-web/utils/format-kredits';
|
import formatKredits from 'kredits-web/utils/format-kredits';
|
||||||
|
|
||||||
export default function(dependentKey, options = {}) {
|
export default function(dependentKey, options = {}) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import ethers from 'npm:ethers';
|
import ethers from 'ethers';
|
||||||
|
|
||||||
export default function(value, options = {}) {
|
export default function(value, options = {}) {
|
||||||
let etherValue = ethers.utils.formatEther(value);
|
let etherValue = ethers.utils.formatEther(value);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module.exports = function(environment) {
|
|||||||
EmberENV: {
|
EmberENV: {
|
||||||
FEATURES: {
|
FEATURES: {
|
||||||
// Here you can enable experimental features on an ember canary build
|
// Here you can enable experimental features on an ember canary build
|
||||||
// e.g. 'with-controller': true
|
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
|
||||||
},
|
},
|
||||||
EXTEND_PROTOTYPES: {
|
EXTEND_PROTOTYPES: {
|
||||||
// Prevent Ember Data from overriding Date.parse.
|
// Prevent Ember Data from overriding Date.parse.
|
||||||
|
|||||||
@@ -12,6 +12,23 @@ module.exports = function(defaults) {
|
|||||||
sourcemaps: {
|
sourcemaps: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
extensions: ['js']
|
extensions: ['js']
|
||||||
|
},
|
||||||
|
autoImport: {
|
||||||
|
webpack: {
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
// inline json files instead of using fs.readFileSync
|
||||||
|
enforce: 'post',
|
||||||
|
test: /kosmos-schemas\/index\.js$/,
|
||||||
|
loader: 'transform-loader?brfs'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
node: {
|
||||||
|
path: "empty" // needed for kosmos-schemas dependency
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Generated
+3117
-5764
File diff suppressed because it is too large
Load Diff
+22
-17
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "kredits-web",
|
"name": "kredits-web",
|
||||||
"version": "1.5.0",
|
"version": "1.7.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Contribution dashboard of the Kosmos project",
|
"description": "Contribution dashboard of the Kosmos project",
|
||||||
"repository": "https://github.com/67P/kredits-web",
|
"repository": "https://github.com/67P/kredits-web",
|
||||||
@@ -24,44 +24,49 @@
|
|||||||
"deploy": "git push 5apps master"
|
"deploy": "git push 5apps master"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ember/jquery": "^0.5.2",
|
"@ember/jquery": "^0.6.0",
|
||||||
"@ember/optional-features": "^0.6.3",
|
"@ember/optional-features": "^0.7.0",
|
||||||
"babel-preset-es2015": "^6.22.0",
|
"babel-preset-es2015": "^6.22.0",
|
||||||
"babelify": "^7.3.0",
|
"babelify": "^7.3.0",
|
||||||
"broccoli-asset-rev": "^2.7.0",
|
"brfs": "^2.0.2",
|
||||||
"ember-ajax": "^4.0.1",
|
"broccoli-asset-rev": "^3.0.0",
|
||||||
|
"ember-ajax": "^5.0.0",
|
||||||
|
"ember-auto-import": "^1.5.2",
|
||||||
"ember-awesome-macros": "0.41.0",
|
"ember-awesome-macros": "0.41.0",
|
||||||
"ember-browserify": "^1.1.13",
|
"ember-cli": "~3.10.1",
|
||||||
"ember-cli": "~3.8.1",
|
|
||||||
"ember-cli-app-version": "^3.2.0",
|
"ember-cli-app-version": "^3.2.0",
|
||||||
"ember-cli-babel": "^7.1.2",
|
"ember-cli-babel": "^7.7.3",
|
||||||
"ember-cli-chart": "^3.4.0",
|
"ember-cli-chart": "^3.4.0",
|
||||||
"ember-cli-dependency-checker": "^3.1.0",
|
"ember-cli-dependency-checker": "^3.1.0",
|
||||||
"ember-cli-eslint": "^4.2.3",
|
"ember-cli-eslint": "^5.1.0",
|
||||||
"ember-cli-htmlbars": "^3.0.0",
|
"ember-cli-htmlbars": "^3.0.1",
|
||||||
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
|
"ember-cli-htmlbars-inline-precompile": "^2.1.0",
|
||||||
"ember-cli-inject-live-reload": "^1.8.2",
|
"ember-cli-inject-live-reload": "^1.8.2",
|
||||||
|
"ember-cli-moment-shim": "^3.7.1",
|
||||||
"ember-cli-sass": "^7.2.0",
|
"ember-cli-sass": "^7.2.0",
|
||||||
"ember-cli-sri": "^2.1.1",
|
"ember-cli-sri": "^2.1.1",
|
||||||
"ember-cli-template-lint": "^1.0.0-beta.1",
|
"ember-cli-template-lint": "^1.0.0-beta.1",
|
||||||
"ember-cli-uglify": "^2.1.0",
|
"ember-cli-uglify": "^2.1.0",
|
||||||
"ember-cli-update": "^0.21.2",
|
|
||||||
"ember-export-application-global": "^2.0.0",
|
"ember-export-application-global": "^2.0.0",
|
||||||
"ember-flatpickr": "^2.14.0",
|
"ember-flatpickr": "^2.14.0",
|
||||||
"ember-load-initializers": "^1.1.0",
|
"ember-load-initializers": "^2.0.0",
|
||||||
"ember-macro-helpers": "0.17.0",
|
"ember-macro-helpers": "0.17.0",
|
||||||
"ember-maybe-import-regenerator": "^0.1.6",
|
"ember-maybe-import-regenerator": "^0.1.6",
|
||||||
|
"ember-moment": "^7.8.1",
|
||||||
"ember-promise-helpers": "1.0.6",
|
"ember-promise-helpers": "1.0.6",
|
||||||
"ember-qunit": "^3.4.1",
|
"ember-qunit": "^4.4.1",
|
||||||
"ember-resolver": "^5.0.1",
|
"ember-resolver": "^5.0.1",
|
||||||
"ember-source": "~3.8.0",
|
"ember-source": "~3.10.0",
|
||||||
"ember-truth-helpers": "github:jmurphyau/ember-truth-helpers#31a14373a31f1f82c77537720549b47a95c28e5f",
|
"ember-truth-helpers": "github:jmurphyau/ember-truth-helpers#31a14373a31f1f82c77537720549b47a95c28e5f",
|
||||||
"eslint-plugin-ember": "^5.2.0",
|
"eslint-plugin-ember": "^6.2.0",
|
||||||
|
"eslint-plugin-node": "^9.0.1",
|
||||||
"ethers": "^4.0.27",
|
"ethers": "^4.0.27",
|
||||||
"kosmos-schemas": "^2.0.0",
|
"kosmos-schemas": "^2.0.0",
|
||||||
"kredits-contracts": "^5.4.0",
|
"kredits-contracts": "^5.4.0",
|
||||||
"loader.js": "^4.7.0",
|
"loader.js": "^4.7.0",
|
||||||
"qunit-dom": "^0.8.0",
|
"ndjson": "github:hugomrdias/ndjson#feat/readable-stream3",
|
||||||
|
"qunit-dom": "^0.8.4",
|
||||||
|
"transform-loader": "^0.2.4",
|
||||||
"tv4": "^1.3.0"
|
"tv4": "^1.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"auto-import-fastboot.js"}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
//# sourceMappingURL=auto-import-fastboot-81f919f3d82c38703c7b0de8c4c4a874.map
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+66
-59
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+12730
-12328
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
-4
@@ -8,10 +8,10 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
|
|
||||||
|
|
||||||
<meta name="kredits-web/config/environment" content="%7B%22modulePrefix%22%3A%22kredits-web%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22kredits-web%22%2C%22version%22%3A%221.5.0%2Bfe16a605%22%7D%2C%22browserify%22%3A%7B%22tests%22%3Atrue%2C%22transform%22%3A%5B%5B%22babelify%22%2C%7B%22presets%22%3A%5B%22es2015%22%5D%2C%22global%22%3Atrue%7D%5D%5D%7D%2C%22web3ProviderUrl%22%3A%22https%3A%2F%2Frinkeby.infura.io%2Fv3%2Fd4f788b7a6584f7db2fc3c268d4d09e9%22%2C%22ipfs%22%3A%7B%22host%22%3A%22ipfs.kosmos.org%22%2C%22port%22%3A%225444%22%2C%22protocol%22%3A%22https%22%2C%22gatewayUrl%22%3A%22https%3A%2F%2Fipfs.kosmos.org%2Fipfs%22%7D%2C%22kreditsApmDomain%22%3A%22open.aragonpm.eth%22%2C%22exportApplicationGlobal%22%3Afalse%7D" />
|
<meta name="kredits-web/config/environment" content="%7B%22modulePrefix%22%3A%22kredits-web%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22kredits-web%22%2C%22version%22%3A%221.7.0%2Ba4ca37d8%22%7D%2C%22browserify%22%3A%7B%22tests%22%3Atrue%2C%22transform%22%3A%5B%5B%22babelify%22%2C%7B%22presets%22%3A%5B%22es2015%22%5D%2C%22global%22%3Atrue%7D%5D%5D%7D%2C%22web3ProviderUrl%22%3A%22https%3A%2F%2Frinkeby.infura.io%2Fv3%2Fd4f788b7a6584f7db2fc3c268d4d09e9%22%2C%22ipfs%22%3A%7B%22host%22%3A%22ipfs.kosmos.org%22%2C%22port%22%3A%225444%22%2C%22protocol%22%3A%22https%22%2C%22gatewayUrl%22%3A%22https%3A%2F%2Fipfs.kosmos.org%2Fipfs%22%7D%2C%22kreditsApmDomain%22%3A%22open.aragonpm.eth%22%2C%22exportApplicationGlobal%22%3Afalse%7D" />
|
||||||
|
|
||||||
<link integrity="" rel="stylesheet" href="/assets/vendor-179cf27a97ea5bbb0ce72403a401cc8c.css">
|
<link integrity="" rel="stylesheet" href="/assets/vendor-179cf27a97ea5bbb0ce72403a401cc8c.css">
|
||||||
<link integrity="" rel="stylesheet" href="/assets/kredits-web-87a975d1ebfb073f8c85b3f709cd0bcd.css">
|
<link integrity="" rel="stylesheet" href="/assets/kredits-web-e95be4cbe614c5aa4c7a891c6eedb028.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<script src="/assets/vendor-80a68be62538fc452f619ea272efa683.js" integrity="sha256-1SzKk/ufxNyb/CdyXniFRUByZMpFGEz+hUTtfJVw7mw= sha512-ixkdWl+f7KrwA+YRsH92A8FSnK9ZG31nJa74FIskk2y40KHDpm6zOln2VVeApLpKdkj+FF7huYSGqJZwE7PRvA==" ></script>
|
<script src="/assets/vendor-d84a577c9f0624a0b15861936fe740f2.js" integrity="sha256-o5SitqUpXKccldebvatDY/WvXTbEnAu/IA/TyvBxU0U= sha512-gDMabciAMuF89anreuu39lAYDOf6tXMMHxVRUxtqGpmhJdSAUQGFQ2MWTgE8mt+8GvGvPxw9QvnHuBJDK34YVw==" ></script>
|
||||||
<script src="/assets/kredits-web-2de55b3ff6969b257370b5e81cc2ea84.js" integrity="sha256-1slvruOM4AQ4rAeDnRnq5GfJhdaCztEDuvxYwmlaaXc= sha512-EHAQKlPE/+z5GjJ07T3CyBkKNHy7TNW+ILAP6AeXfC91iYcaEebXJ8cGbZoeXweF4RWPTza2gkpWSlucye+tsA==" ></script>
|
<script src="/assets/kredits-web-abcf1575c8eb056a923a583efdc2d00f.js" integrity="sha256-IEH1g/CviSkQ/8acQOgUqB1iPBlXgsJlGJqsAzs9iqg= sha512-znuWeezXPnfkekpebFEC/4uVT0DjHS52ORURS11H7+kCtgyMjLqvSS8it/GzLxSsameIUaoMsvctqhL8f+atMg==" ></script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ module('Integration | Component | user-avatar', function(hooks) {
|
|||||||
this.set('bumi', contributors.findBy('id', '1'));
|
this.set('bumi', contributors.findBy('id', '1'));
|
||||||
await render(hbs`{{user-avatar contributor=bumi}}`);
|
await render(hbs`{{user-avatar contributor=bumi}}`);
|
||||||
|
|
||||||
assert.equal(this.element.textContent.trim(), '');
|
assert.dom(this.element).hasText('');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('default image source URL', async function(assert) {
|
test('default image source URL', async function(assert) {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupTest } from 'ember-qunit';
|
||||||
|
|
||||||
|
module('Unit | Route | dashboard/contributions/show', function(hooks) {
|
||||||
|
setupTest(hooks);
|
||||||
|
|
||||||
|
test('it exists', function(assert) {
|
||||||
|
let route = this.owner.lookup('route:dashboard/contributions/show');
|
||||||
|
assert.ok(route);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -5,16 +5,15 @@ import { A } from '@ember/array';
|
|||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import groupBy from 'kredits-web/utils/group-by';
|
import groupBy from 'kredits-web/utils/group-by';
|
||||||
|
|
||||||
module('Unit | Utils | group-by');
|
module('Unit | Utils | group-by', function () {
|
||||||
|
let car1 = { name: 'Carrera', color: 'red' };
|
||||||
|
let car2 = { name: 'Veyron', color: 'red' };
|
||||||
|
let car3 = { name: 'Corvette', color: 'blue' };
|
||||||
|
let car4 = { name: 'Viper', color: 'blue' };
|
||||||
|
let car5 = { name: 'Cobra', color: 'green' };
|
||||||
|
let cars = A([car1, car2, car3, car4, car5]);
|
||||||
|
|
||||||
let car1 = { name: 'Carrera', color: 'red' };
|
test('it groups cars by color', function (assert) {
|
||||||
let car2 = { name: 'Veyron', color: 'red' };
|
|
||||||
let car3 = { name: 'Corvette', color: 'blue' };
|
|
||||||
let car4 = { name: 'Viper', color: 'blue' };
|
|
||||||
let car5 = { name: 'Cobra', color: 'green' };
|
|
||||||
let cars = A([car1, car2, car3, car4, car5]);
|
|
||||||
|
|
||||||
test('it groups cars by color', function(assert) {
|
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
let redGroup = { property: 'color', value: 'red', items: [car1, car2] };
|
let redGroup = { property: 'color', value: 'red', items: [car1, car2] };
|
||||||
let blueGroup = { property: 'color', value: 'blue', items: [car3, car4] };
|
let blueGroup = { property: 'color', value: 'blue', items: [car3, car4] };
|
||||||
@@ -24,18 +23,19 @@ test('it groups cars by color', function(assert) {
|
|||||||
let expected = [redGroup, blueGroup, greenGroup];
|
let expected = [redGroup, blueGroup, greenGroup];
|
||||||
|
|
||||||
assert.deepEqual(result, expected);
|
assert.deepEqual(result, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it does not fail with empty array', function(assert) {
|
test('it does not fail with empty array', function (assert) {
|
||||||
let cars = [];
|
let cars = [];
|
||||||
|
|
||||||
let result = groupBy(cars, 'color');
|
let result = groupBy(cars, 'color');
|
||||||
assert.deepEqual(result, []);
|
assert.deepEqual(result, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it does not failkwith null', function(assert) {
|
test('it does not failkwith null', function (assert) {
|
||||||
let cars = null;
|
let cars = null;
|
||||||
|
|
||||||
let result = groupBy(cars, 'color');
|
let result = groupBy(cars, 'color');
|
||||||
assert.deepEqual(result, []);
|
assert.deepEqual(result, []);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user