Toggle metadata visibility by clicking name

This commit is contained in:
2017-02-19 11:13:14 +08:00
parent 0a2f44cec8
commit 01c1a9c804
2 changed files with 17 additions and 3 deletions
+15 -1
View File
@@ -3,6 +3,20 @@ import Ember from 'ember';
export default Ember.Component.extend({ export default Ember.Component.extend({
tagName: 'table', tagName: 'table',
classNames: 'contributor-list' classNames: 'contributor-list',
selectedContributor: null,
actions: {
toggleContributorInfo(contributor) {
if (contributor.get('showMetadata')) {
contributor.set('showMetadata', false);
} else {
this.get('contributors').setEach('showMetadata', false);
contributor.set('showMetadata', true);
}
}
}
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
<tbody> <tbody>
{{#each contributors as |contributor|}} {{#each contributors as |contributor|}}
<tr class="{{if contributor.isCurrentUser 'current-user'}}"> <tr class="{{if contributor.isCurrentUser 'current-user'}}" {{action "toggleContributorInfo" contributor}}>
<td class="person"> <td class="person">
<img class="avatar" src={{contributor.avatarURL}}> <img class="avatar" src={{contributor.avatarURL}}>
{{contributor.github_username}} {{contributor.github_username}}
@@ -10,7 +10,7 @@
<span class="symbol">₭S</span> <span class="symbol">₭S</span>
</td> </td>
</tr> </tr>
<tr class="metadata visible {{if contributor.isCurrentUser 'current-user'}}"> <tr class="metadata {{if contributor.isCurrentUser 'current-user'}} {{if contributor.showMetadata 'visible'}}">
<td colspan="2"> <td colspan="2">
<dl> <dl>
<dt>Ethereum address</dt> <dt>Ethereum address</dt>