Mark contributor in list as selected when opening details

This commit is contained in:
2019-07-12 16:02:32 +02:00
parent 8a156f964b
commit d9ae654f42
6 changed files with 26 additions and 13 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ export default Component.extend({
tagName: 'table',
classNames: 'contributor-list',
selectedContributor: null,
selectedContributorId: null,
actions: {
+3 -1
View File
@@ -1,6 +1,8 @@
<tbody>
{{#each contributorList as |c|}}
<tr role="button" class={{if (is-current-user c.contributor) "current-user"}} {{action "openContributorDetails" c.contributor}}>
<tr role="button"
class="{{if (is-current-user c.contributor) "current-user"}} {{if (eq c.contributor.id selectedContributorId) "selected"}}"
{{action "openContributorDetails" c.contributor}}>
<td class="person">
{{user-avatar contributor=c.contributor}} {{c.contributor.name}}
</td>
+1
View File
@@ -7,6 +7,7 @@ export default Controller.extend({
kredits: service(),
showDetailsPane: false,
selectedContributorId: null,
currentBlock: alias('kredits.currentBlock'),
+11 -3
View File
@@ -11,14 +11,22 @@ export default Route.extend({
return this.contributors.findBy('id', params.id);
},
activate () {
setupController (controller, model) {
this._super(controller, model);
this.controllerFor('dashboard')
.set('showDetailsPane', true);
.setProperties({
showDetailsPane: true,
selectedContributorId: model.id
});
},
deactivate () {
this.controllerFor('dashboard')
.set('showDetailsPane', false);
.setProperties({
showDetailsPane: false,
selectedContributorId: null
});
}
});
+8 -7
View File
@@ -4,16 +4,20 @@ table.contributor-list {
margin-bottom: 1.5rem;
tr {
background-color: rgba(255,255,255,0.1);
border-bottom: 1px solid rgba(255,255,255,0.2);
cursor: pointer;
&:first-of-type {
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);
}
&.current-user {
font-weight: 500;
}
td {
@@ -31,20 +35,17 @@ table.contributor-list {
&.kredits {
text-align: right;
.amount {
font-size: 1.2rem;
font-weight: 500;
}
.symbol {
font-size: 0.8rem;
padding-left: 0.2rem;
}
}
pre {
line-height: 1rem;
padding-bottom: 1rem;
}
}
}
}
+2 -1
View File
@@ -12,7 +12,8 @@
</header>
<div class="content">
{{contributor-list contributorList=kreditsToplist
showUnconfirmedKredits=showUnconfirmedKredits}}
showUnconfirmedKredits=showUnconfirmedKredits
selectedContributorId=selectedContributorId}}
<p class="stats">
<span class="number">{{await kredits.totalKreditsEarned}}</span> kredits confirmed and issued to