WIP Details pane + contributor profiles
Adds a 3-pane layout option for showing details, as well as a dashboard sub-route for showing contributor details in the new details pane.
This commit is contained in:
Vendored
+5
-1
@@ -1,4 +1,5 @@
|
||||
import Model from 'kredits-web/models/contribution';
|
||||
import contributors from '../../tests/fixtures/contributors';
|
||||
|
||||
const items = [];
|
||||
|
||||
@@ -14,6 +15,9 @@ const data = [
|
||||
{ id: 9, contributorId: 3, confirmedAtBlock: 2000, claimed: false, vetoed: true, amount: 1500, kind: 'docs' },
|
||||
];
|
||||
|
||||
data.forEach(attrs => items.push(Model.create(attrs)));
|
||||
data.forEach(attrs => {
|
||||
attrs.contributor = contributors.findBy('id', attrs.contributorId.toString());
|
||||
items.push(Model.create(attrs))
|
||||
});
|
||||
|
||||
export default items;
|
||||
|
||||
Vendored
+3
-3
@@ -3,9 +3,9 @@ import Contributor from 'kredits-web/models/contributor';
|
||||
const contributors = [];
|
||||
|
||||
const data = [
|
||||
{ id: 1, name: 'Bumi', totalKreditsEarned: 11500 },
|
||||
{ id: 2, name: 'Râu Cao', totalKreditsEarned: 3000 },
|
||||
{ id: 3, name: 'Manuel', totalKreditsEarned: 0 }
|
||||
{ id: 1, name: 'Bumi', totalKreditsEarned: 11500, github_uid: 318 },
|
||||
{ id: 2, name: 'Râu Cao', totalKreditsEarned: 3000, github_uid: 842 },
|
||||
{ id: 3, name: 'Manuel', totalKreditsEarned: 0, github_uid: 54812 }
|
||||
];
|
||||
|
||||
data.forEach(attrs => contributors.push(Contributor.create(attrs)));
|
||||
|
||||
@@ -9,13 +9,13 @@ module('Integration | Component | contributor list', function(hooks) {
|
||||
|
||||
const toplist = [
|
||||
{
|
||||
contributor: Contributor.create({ id: 1, name: 'Bumi' }),
|
||||
contributor: Contributor.create({ id: 1, name: 'Bumi', github_uid: 318 }),
|
||||
amountConfirmed: 5500,
|
||||
amountUnconfirmed: 1000,
|
||||
amountTotal: 6500
|
||||
},
|
||||
{
|
||||
contributor: Contributor.create({ id: 2, name: 'Râu Cao' }),
|
||||
contributor: Contributor.create({ id: 2, name: 'Râu Cao', github_uid: 842 }),
|
||||
amountConfirmed: 1500,
|
||||
amountUnconfirmed: 2000,
|
||||
amountTotal: 3500
|
||||
@@ -28,8 +28,8 @@ module('Integration | Component | contributor list', function(hooks) {
|
||||
|
||||
assert.dom('tr:nth-child(1) td.person').hasText('Bumi');
|
||||
assert.dom('tr:nth-child(1) span.amount').hasText('6500');
|
||||
assert.dom('tr:nth-child(3) td.person').hasText('Râu Cao');
|
||||
assert.dom('tr:nth-child(3) span.amount').hasText('3500');
|
||||
assert.dom('tr:nth-child(2) td.person').hasText('Râu Cao');
|
||||
assert.dom('tr:nth-child(2) span.amount').hasText('3500');
|
||||
});
|
||||
|
||||
test('it renders confirmed kredits earned', async function(assert) {
|
||||
@@ -38,7 +38,7 @@ module('Integration | Component | contributor list', function(hooks) {
|
||||
|
||||
assert.dom('tr:nth-child(1) td.person').hasText('Bumi');
|
||||
assert.dom('tr:nth-child(1) span.amount').hasText('5500');
|
||||
assert.dom('tr:nth-child(3) td.person').hasText('Râu Cao');
|
||||
assert.dom('tr:nth-child(3) span.amount').hasText('1500');
|
||||
assert.dom('tr:nth-child(2) td.person').hasText('Râu Cao');
|
||||
assert.dom('tr:nth-child(2) span.amount').hasText('1500');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,13 +2,39 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import contributors from '../../../fixtures/contributors';
|
||||
|
||||
module('Integration | Component | user-avatar', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function(assert) {
|
||||
await render(hbs`{{user-avatar}}`);
|
||||
this.set('bumi', contributors.findBy('id', '1'));
|
||||
await render(hbs`{{user-avatar contributor=bumi}}`);
|
||||
|
||||
assert.equal(this.element.textContent.trim(), '');
|
||||
});
|
||||
|
||||
test('default image source URL', async function(assert) {
|
||||
this.set('bumi', contributors.findBy('id', '1'));
|
||||
await render(hbs`{{user-avatar contributor=bumi}}`);
|
||||
|
||||
assert.equal(this.element.querySelector('img').src,
|
||||
`https://avatars2.githubusercontent.com/u/318?v=3&s=128`);
|
||||
});
|
||||
|
||||
test('size-specific image source URLs', async function(assert) {
|
||||
this.set('bumi', contributors.findBy('id', '1'));
|
||||
this.set('size', 'medium');
|
||||
|
||||
await render(hbs`{{user-avatar contributor=bumi size=size}}`);
|
||||
|
||||
assert.equal(this.element.querySelector('img').src,
|
||||
`https://avatars2.githubusercontent.com/u/318?v=3&s=256`);
|
||||
|
||||
this.set('size', 'large');
|
||||
|
||||
assert.equal(this.element.querySelector('img').src,
|
||||
`https://avatars2.githubusercontent.com/u/318?v=3&s=512`);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import Contributor from 'kredits-web/models/contributor';
|
||||
|
||||
module('Unit | Model | contributor', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('#avatarURL() returns correct URL', function(assert) {
|
||||
let model = Contributor.create();
|
||||
model.set('github_uid', '318');
|
||||
|
||||
assert.equal(model.get('avatarURL'), 'https://avatars2.githubusercontent.com/u/318?v=3&s=128');
|
||||
});
|
||||
});
|
||||
// import { module, test } from 'qunit';
|
||||
// import { setupTest } from 'ember-qunit';
|
||||
// import Contributor from 'kredits-web/models/contributor';
|
||||
//
|
||||
// module('Unit | Model | contributor', function(hooks) {
|
||||
// setupTest(hooks);
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user