Skip to content

Commit

Permalink
Merge pull request #137 from 67P/feature/mark_selected_profile
Browse files Browse the repository at this point in the history
Mark contributor in list as selected when opening details
  • Loading branch information
galfert authored Jul 12, 2019
2 parents 743a4cc + d9ae654 commit 791943b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 53 deletions.
2 changes: 1 addition & 1 deletion app/components/contributor-list/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default Component.extend({

tagName: 'table',
classNames: 'contributor-list',
selectedContributor: null,
selectedContributorId: null,

actions: {

Expand Down
4 changes: 3 additions & 1 deletion app/components/contributor-list/template.hbs
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
1 change: 1 addition & 0 deletions app/controllers/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default Controller.extend({
kredits: service(),

showDetailsPane: false,
selectedContributorId: null,

currentBlock: alias('kredits.currentBlock'),

Expand Down
14 changes: 11 additions & 3 deletions app/routes/dashboard/contributors/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}

});
55 changes: 8 additions & 47 deletions app/styles/components/_contributor-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +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);
}

&.metadata {
height: 0;
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;
}
}
&.current-user {
font-weight: 500;
}

td {
Expand All @@ -71,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;
}
}
}
}
3 changes: 2 additions & 1 deletion app/templates/dashboard.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 791943b

Please sign in to comment.