diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6
index 27856754bdd..5d734809ef8 100644
--- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6
+++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6
@@ -7,6 +7,15 @@
@module Discourse
**/
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'),
minGrantedAt: Em.computed.min('grantDates'),
diff --git a/app/assets/javascripts/discourse/templates/badges/show.js.handlebars b/app/assets/javascripts/discourse/templates/badges/show.js.handlebars
index 5cbac9db05d..13ce2b81d5e 100644
--- a/app/assets/javascripts/discourse/templates/badges/show.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/badges/show.js.handlebars
@@ -16,18 +16,21 @@
{{#if userBadges}}
-
+
{{#each userBadges}}
- {{#link-to 'user' user}}
-
- {{avatar user imageSize="large"}}
-
- {{user.username}}
- {{date granted_at}}
-
-
- {{/link-to}}
-
+
+ {{#link-to 'user' user classNames="badge-info"}}
+ {{avatar user imageSize="large"}}
+
+ {{user.username}}
+ {{date granted_at}}
+
+ {{/link-to}}
+
+ {{#if post_number}}
+
#{{post_number}} {{topic.title}}
+ {{/if}}
+
{{/each}}
{{#if canLoadMore}}
diff --git a/app/assets/stylesheets/common/base/user-badges.scss b/app/assets/stylesheets/common/base/user-badges.scss
index 573db4b15d0..f38288743fd 100644
--- a/app/assets/stylesheets/common/base/user-badges.scss
+++ b/app/assets/stylesheets/common/base/user-badges.scss
@@ -96,11 +96,11 @@ table.badges-listing {
/* /badges/:id/:slug page styling. */
.show-badge {
.badge-user {
- display: inline-block;
text-align: center;
width: 100px;
padding: 5px 10px;
margin-bottom: 10px;
+ display: inline-block;
.details {
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;
+ }
+}
diff --git a/app/jobs/scheduled/badge_grant.rb b/app/jobs/scheduled/badge_grant.rb
new file mode 100644
index 00000000000..9c1b48f8721
--- /dev/null
+++ b/app/jobs/scheduled/badge_grant.rb
@@ -0,0 +1,12 @@
+module Jobs
+
+ class BadgeGrant < Jobs::Scheduled
+ every 1.day
+
+ def execute(args)
+ BadgeGranter.backfill_like_badges
+ end
+
+ end
+
+end