Convert user card buttons to `{{d-button}}` components

This commit is contained in:
Robin Ward 2017-08-24 12:22:46 -04:00
parent 9c446fcb4d
commit a6251f717b
3 changed files with 32 additions and 5 deletions

View File

@ -46,6 +46,11 @@ export default Ember.Component.extend(CleansUp, {
return !this.siteSettings.prioritize_username_in_ux && name && name.trim().length > 0;
},
@computed('username', 'topicPostCount')
togglePostsLabel(username, count) {
return I18n.t("topic.filter_to", { username, count });
},
@computed('user.user_fields.@each.value')
publicUserFields() {
const siteUserFields = this.site.get('user_fields');

View File

@ -36,19 +36,41 @@
<ul class="usercard-controls">
{{#if user.can_send_private_message_to_user}}
<li><a class='btn btn-primary' {{action "composePrivateMessage" user post}}>{{d-icon "envelope"}}{{i18n 'user.private_message'}}</a></li>
<li>
{{d-button
class="btn-primary"
action=(action "composePrivateMessage" user post)
icon="envelope"
label="user.private_message"}}
</li>
{{/if}}
{{#if showFilter}}
<li><a class='btn' href {{action "togglePosts" user}}>{{d-icon "filter"}}{{i18n 'topic.filter_to' username=username count=topicPostCount}}</a></li>
<li>
{{d-button
action=(action "togglePosts" user)
icon="filter"
translatedLabel=togglePostsLabel}}
</li>
{{/if}}
{{#if hasUserFilters}}
<li><a class='btn' href {{action "cancelFilter"}}>{{d-icon "times"}}{{i18n 'topic.filters.cancel'}}</a></li>
<li>
{{d-button
action="cancelFilter"
icon="times"
label="topic.filters.cancel"}}
</li>
{{/if}}
{{#if showDelete}}
<li><a class='btn btn-danger' href {{action "deleteUser" user}}>{{d-icon "exclamation-triangle"}}{{i18n 'admin.user.delete'}}</a></li>
<li>
{{d-button
class="btn-danger"
action=(action "deleteUser" user)
icon="exclamation-triangle"
label="admin.user.delete"}}
</li>
{{/if}}
</ul>

View File

@ -193,7 +193,7 @@ $user_card_background: $secondary;
float: right;
margin: 0;
a {width: 100%; min-width: 150px;}
button { width: 100%; min-width: 150px; }
}
.new-user a {