From 9c19f64c015720bfd24fefe0e60e7b57454e6d2a Mon Sep 17 00:00:00 2001 From: Rocky Duan Date: Fri, 14 Sep 2012 17:22:11 -0700 Subject: [PATCH] for students, only display endorse icon if endorsed --- .../views/discussion_content_view.coffee | 16 +++++++++++++--- .../discussion/_underscore_templates.html | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lms/static/coffee/src/discussion/views/discussion_content_view.coffee b/lms/static/coffee/src/discussion/views/discussion_content_view.coffee index 98f0eb6137..7a7ae55249 100644 --- a/lms/static/coffee/src/discussion/views/discussion_content_view.coffee +++ b/lms/static/coffee/src/discussion/views/discussion_content_view.coffee @@ -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() diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index ea70ac2910..f62e65a4bf 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -92,7 +92,7 @@