Commit 9c19f64c by Rocky Duan

for students, only display endorse icon if endorsed

parent b2c88575
......@@ -4,8 +4,12 @@ if Backbone?
attrRenderer:
endorsed: (endorsed) ->
if endorsed
@$(".action-endorse").addClass("is-endorsed")
@$(".action-endorse").show().addClass("is-endorsed")
else
if not @model.get('ability').can_endorse
@$(".action-endorse").hide()
else
@$(".action-endorse").show()
@$(".action-endorse").removeClass("is-endorsed")
closed: (closed) ->
......@@ -47,8 +51,14 @@ if Backbone?
enable: -> @$(".action-delete").closest("li").show()
disable: -> @$(".action-delete").closest("li").hide()
can_endorse:
enable: -> @$(".action-endorse").css("cursor", "auto")
disable: -> @$(".action-endorse").css("cursor", "default")
enable: ->
@$(".action-endorse").show().css("cursor", "auto")
disable: ->
@$(".action-endorse").css("cursor", "default")
if not @model.get('endorsed')
@$(".action-endorse").hide()
else
@$(".action-endorse").show()
can_openclose:
enable: -> @$(".action-openclose").closest("li").show()
disable: -> @$(".action-openclose").closest("li").hide()
......
......@@ -92,7 +92,7 @@
<script type="text/template" id="thread-response-show-template">
<header class="response-local">
<a href="javascript:void(0)" class="vote-btn" data-tooltip="vote"><span class="plus-icon"></span><span class="votes-count-number">${"<%- votes['up_count'] %>"}</span></a>
<a href="javascript:void(0)" class="endorse-btn${'<% if (endorsed) { %> is-endorsed<% } %>'} action-endorse" style="cursor: default" data-tooltip="endorse"><span class="check-icon" style="pointer-events: none; "></span></a>
<a href="javascript:void(0)" class="endorse-btn${'<% if (endorsed) { %> is-endorsed<% } %>'} action-endorse" style="cursor: default; display: none;" data-tooltip="endorse"><span class="check-icon" style="pointer-events: none; "></span></a>
<a href="${'<%- user_url %>'}" class="posted-by">${"<%- username %>"}</a>
<p class="posted-details" title="${'<%- created_at %>'}">${'<%- created_at %>'}</p>
</header>
......
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