mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 03:23:39 +08:00
Add user-badge component.
This commit is contained in:
parent
cba7d3fc82
commit
057c56ef9b
|
@ -0,0 +1,7 @@
|
|||
Discourse.UserBadgeComponent = Ember.Component.extend({
|
||||
tagName: 'span',
|
||||
|
||||
badgeTypeClassName: function() {
|
||||
return "badge-type-" + this.get('badge.badge_type.name').toLowerCase();
|
||||
}.property('badge.badge_type.name')
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
<span {{bind-attr class=":user-badge badgeTypeClassName" data-badge-name="badge.name" title="badge.description"}}>
|
||||
<i class='fa fa-certificate'></i>
|
||||
{{badge.name}}
|
||||
</span>
|
|
@ -10,7 +10,7 @@
|
|||
{{#if showBadges}}
|
||||
<div class="badge-section">
|
||||
{{#each user.featured_user_badges}}
|
||||
<span class="user-badge badge-type-{{unbound badge.badge_type_id}}"><i class='fa fa-certificate'></i> {{badge.name}}</span>
|
||||
{{user-badge badge=badge}}
|
||||
{{/each}}
|
||||
{{#if showMoreBadges}}
|
||||
<span class="btn more-user-badges">{{i18n badges.more_badges count=moreBadgesCount}}</span>
|
||||
|
|
|
@ -102,39 +102,12 @@
|
|||
font-size: 14px;
|
||||
margin-bottom: -8px;
|
||||
}
|
||||
}
|
||||
|
||||
.more-user-badges {
|
||||
@extend .user-badge;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user-badge, .more-user-badges {
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
line-height: 16px;
|
||||
display: inline-block;
|
||||
.fa {
|
||||
padding-right: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.user-badge {
|
||||
padding: 3px 8px;
|
||||
border: 1px solid $secondary-border-color;
|
||||
}
|
||||
|
||||
.more-user-badges {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.badge-type-1 .fa-certificate {
|
||||
color: #A67D3D;
|
||||
}
|
||||
|
||||
.badge-type-2 .fa-certificate {
|
||||
color: silver;
|
||||
}
|
||||
|
||||
.badge-type-1 .fa-certificate {
|
||||
color: gold;
|
||||
}
|
||||
|
|
25
app/assets/stylesheets/desktop/user-badges.scss
Normal file
25
app/assets/stylesheets/desktop/user-badges.scss
Normal file
|
@ -0,0 +1,25 @@
|
|||
.user-badge {
|
||||
padding: 3px 8px;
|
||||
border: 1px solid $secondary-border-color;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
|
||||
.fa {
|
||||
padding-right: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&.badge-type-gold .fa {
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
&.badge-type-silver .fa {
|
||||
color: #c0c0c0;
|
||||
}
|
||||
|
||||
&.badge-type-bronze .fa {
|
||||
color: #cd7f32;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user