From 94e58d733e2114e09567df8e28942756f369b43b Mon Sep 17 00:00:00 2001
From: Robin Ward <robin.ward@gmail.com>
Date: Wed, 6 Feb 2013 17:36:07 -0500
Subject: [PATCH] Add moderator style while in topic

---
 .../javascripts/discourse/templates/post.js.handlebars      | 4 ++--
 app/assets/stylesheets/application/topic-post.css.scss      | 6 ++++++
 app/serializers/post_serializer.rb                          | 5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/app/assets/javascripts/discourse/templates/post.js.handlebars b/app/assets/javascripts/discourse/templates/post.js.handlebars
index a485931a8..69cebae74 100644
--- a/app/assets/javascripts/discourse/templates/post.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/post.js.handlebars
@@ -28,8 +28,8 @@
 
     <div class='topic-meta-data span2'>
       <div class='contents'>
-        <a href='/users/{{unbound username}}' class='excerptable' data-excerpt-position="right" data-excerpt-size="small">{{avatar this imageSize="large"}}</a>
-        <h3><a href='/users/{{unbound username}}'>{{breakUp username}}</a></h3>
+        <a href='/users/{{unbound username}}' class='excerptable' data-excerpt-position="right" data-excerpt-size="small" >{{avatar this imageSize="large"}}</a>
+        <h3 {{bindAttr class="moderator"}}><a href='/users/{{unbound username}}'>{{breakUp username}}</a></h3>
         
         <div class='post-info'>
           <a href='#' class='post-date' {{bindAttr data-share-url="url"}}>{{date created_at}}</a>
diff --git a/app/assets/stylesheets/application/topic-post.css.scss b/app/assets/stylesheets/application/topic-post.css.scss
index 6c774072b..fd4349560 100644
--- a/app/assets/stylesheets/application/topic-post.css.scss
+++ b/app/assets/stylesheets/application/topic-post.css.scss
@@ -320,6 +320,12 @@
         font-size: 14px;
         line-height: 18px;
       }
+
+      h3.moderator a {
+        background-color: #ffe;
+        border: 1px solid #ffd;
+      }
+
       div {
         display: block;
       }
diff --git a/app/serializers/post_serializer.rb b/app/serializers/post_serializer.rb
index 45d01eedb..7b7b175cf 100644
--- a/app/serializers/post_serializer.rb
+++ b/app/serializers/post_serializer.rb
@@ -37,6 +37,7 @@ class PostSerializer < ApplicationSerializer
              :bookmarked,
              :raw,
              :actions_summary,
+             :moderator?,
              :avatar_template,
              :user_id, 
              :draft_sequence,
@@ -45,6 +46,10 @@ class PostSerializer < ApplicationSerializer
              :deleted_at
 
 
+  def moderator?
+    object.user.has_trust_level?(:moderator)
+  end
+
   def avatar_template
     object.user.avatar_template
   end