Add link to badge reason on badge details page.
This commit is contained in:
parent
60d93a62f6
commit
a4b7b561dc
|
@ -7,6 +7,15 @@
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
export default Discourse.ObjectController.extend({
|
export default Discourse.ObjectController.extend({
|
||||||
|
layoutClass: function(){
|
||||||
|
var ub = this.get("userBadges");
|
||||||
|
if(ub && ub[0] && ub[0].post_id){
|
||||||
|
return "user-badge-with-posts";
|
||||||
|
} else {
|
||||||
|
return "user-badge-no-posts";
|
||||||
|
}
|
||||||
|
}.property("userBadges"),
|
||||||
|
|
||||||
grantDates: Em.computed.mapBy('userBadges', 'grantedAt'),
|
grantDates: Em.computed.mapBy('userBadges', 'grantedAt'),
|
||||||
minGrantedAt: Em.computed.min('grantDates'),
|
minGrantedAt: Em.computed.min('grantDates'),
|
||||||
|
|
||||||
|
|
|
@ -16,18 +16,21 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{{#if userBadges}}
|
{{#if userBadges}}
|
||||||
<div>
|
<div class={{unbound layoutClass}}>
|
||||||
{{#each userBadges}}
|
{{#each userBadges}}
|
||||||
{{#link-to 'user' user}}
|
<div class="badge-user">
|
||||||
<div class="badge-user">
|
{{#link-to 'user' user classNames="badge-info"}}
|
||||||
{{avatar user imageSize="large"}}
|
{{avatar user imageSize="large"}}
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<span class="username">{{user.username}}</span>
|
<span class="username">{{user.username}}</span>
|
||||||
{{date granted_at}}
|
{{date granted_at}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{/link-to}}
|
||||||
{{/link-to}}
|
|
||||||
<!-- <a href="{{unbound topic.url}}/{{unbound post_number}}"><span class="post-number">#{{post_number}}</span> {{topic.title}}</a> -->
|
{{#if post_number}}
|
||||||
|
<a class="post-link" href="{{unbound topic.url}}/{{unbound post_number}}"><span class="post-number">#{{post_number}}</span> {{topic.title}}</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{#if canLoadMore}}
|
{{#if canLoadMore}}
|
||||||
|
|
|
@ -96,11 +96,11 @@ table.badges-listing {
|
||||||
/* /badges/:id/:slug page styling. */
|
/* /badges/:id/:slug page styling. */
|
||||||
.show-badge {
|
.show-badge {
|
||||||
.badge-user {
|
.badge-user {
|
||||||
display: inline-block;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
|
@ -115,3 +115,22 @@ table.badges-listing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.show-badge .user-badge-with-posts .badge-user {
|
||||||
|
width: 400px;
|
||||||
|
|
||||||
|
.badge-info {
|
||||||
|
width: 100px;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-link {
|
||||||
|
width: 250px;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
margin-top: 67px;
|
||||||
|
margin-left: 18px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
module Jobs
|
||||||
|
|
||||||
|
class BadgeGrant < Jobs::Scheduled
|
||||||
|
every 1.day
|
||||||
|
|
||||||
|
def execute(args)
|
||||||
|
BadgeGranter.backfill_like_badges
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue