Commit 5170e7d9 by Ibrahim Awwal

Add indicators to thread list view for staff posts and staff responses.

parent 8de039d8
......@@ -127,7 +127,21 @@ if Backbone?
toJSON: ->
json_attributes = _.clone(@attributes)
_.extend(json_attributes, { title: @display_title(), body: @display_body() })
extended_attributes =
title: @display_title()
body: @display_body()
isStaffPost: @isStaffPost()
hasStaffResponse: @hasStaffResponse()
_.extend(json_attributes, extended_attributes)
isStaffPost: ->
DiscussionUtil.isStaff(@get("user_id"))
hasStaffResponse: ->
_.map(@get('responded_user_ids'), (id)->
DiscussionUtil.isStaff(id)).reduce((a,b)->
a or b
, false)
class @Comment extends @Content
urlMappers:
......
......@@ -129,6 +129,12 @@
<script type="text/template" id="thread-list-item-template">
<a href="${'<%- id %>'}" data-id="${'<%- id %>'}">
${"<% if (isStaffPost) { %>"}
<span class="staff-post-icon" data-tooltip="Staff Post"></span>
${"<% }%>"}
${"<% if (hasStaffResponse) { %>"}
<span class="staff-response-icon" data-tooltip="Staff Response"></span>
${"<% }%>"}
<span class="title">${"<%- title %>"}</span>
${"<% if (unread_comments_count > 0) { %>"}
<span class="comments-count unread" data-tooltip="${"<%- unread_comments_count %>"} new comment${"<%- unread_comments_count > 1 ? 's' : '' %>"}">${"<%- comments_count %>"}</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment