Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
feat(history): Add row-level coloring to history
Browse files Browse the repository at this point in the history
  • Loading branch information
devinus committed Jan 11, 2018
1 parent 89f6714 commit 0a04b76
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 9 deletions.
11 changes: 11 additions & 0 deletions app/components/account-history-entry/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Row from 'ember-light-table/components/lt-row';

import { alias, equal } from 'ember-decorators/object/computed';

export default Row.extend({
classNameBindings: ['isSend:text-danger', 'isReceive:text-success'],

@alias('row.content.type') type: null,
@equal('type', 'send') isSend: false,
@equal('type', 'receive') isReceive: false,
});
8 changes: 8 additions & 0 deletions app/components/account-history-entry/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{#each columns as |column|}}
{{component (concat 'light-table/cells/' column.cellType) column row
table=table
rawValue=(get row column.valuePath)
tableActions=tableActions
extra=extra
}}
{{/each}}
13 changes: 7 additions & 6 deletions app/components/account-history/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ export default Component.extend(PagedMixin, {
valuePath: 'type',
width: '10%',
},
{
label: 'Account',
valuePath: 'account',
width: '60%',
cellComponent: 'account-link',
},
{
label: 'Amount',
valuePath: 'amount',
width: '20%',
cellClassNames: 'text-truncate',
format(rawValue) {
return formatAmount(rawValue);
},
},
{
label: 'Account',
valuePath: 'account',
// width: '60%',
cellComponent: 'account-link',
},
];
},

Expand Down
2 changes: 1 addition & 1 deletion app/components/account-history/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{#light-table table tableClassNames='table table-striped' height='auto' as |t|}}
{{t.head}}

{{#t.body canSelect=false as |body|}}
{{#t.body canSelect=false rowComponent=(component 'account-history-entry') as |body|}}
{{#if (is-pending content)}}
{{#body.loader}}
{{fa-icon 'refresh' size=3 spin=true ariaLabel="Loading..."}}
Expand Down
4 changes: 2 additions & 2 deletions app/wallets/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
{{#navbar.content}}
{{#navbar.nav as |nav|}}
{{#nav.item}}
{{#nav.link-to 'wallets.overview' 'foo'}}
{{#nav.link-to 'wallets.overview' model}}
Overview
{{/nav.link-to}}
{{/nav.item}}
{{#nav.item}}
{{#nav.link-to 'wallets.send' 'foo'}}
{{#nav.link-to 'wallets.send' model}}
Send
{{/nav.link-to}}
{{/nav.item}}
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"ember-browserify": "^1.2.0",
"ember-changeset": "^1.4.1",
"ember-changeset-validations": "^1.2.9",
"ember-chrome-devtools": "^0.2.0",
"ember-cli": "^2.17.1",
"ember-cli-app-version": "^3.1.3",
"ember-cli-babel": "^6.11.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('account-history-entry', 'Integration | Component | account history entry', {
integration: true
});

test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });

this.render(hbs`{{account-history-entry}}`);

assert.equal(this.$().text().trim(), '');

// Template block usage:
this.render(hbs`
{{#account-history-entry}}
template block text
{{/account-history-entry}}
`);

assert.equal(this.$().text().trim(), 'template block text');
});

0 comments on commit 0a04b76

Please sign in to comment.