diff --git a/common/static/coffee/src/discussion/views/discussion_content_view.coffee b/common/static/coffee/src/discussion/views/discussion_content_view.coffee index 9b2de1b198..001dc887cd 100644 --- a/common/static/coffee/src/discussion/views/discussion_content_view.coffee +++ b/common/static/coffee/src/discussion/views/discussion_content_view.coffee @@ -4,7 +4,7 @@ if Backbone? events: "click .discussion-flag-abuse": "toggleFlagAbuse" - + "keypress .discussion-flag-abuse": "toggleFlagAbuseKeypress" attrRenderer: endorsed: (endorsed) -> @@ -106,6 +106,10 @@ if Backbone? @model.bind('change', @renderPartialAttrs, @) + toggleFlagAbuseKeypress: (event) -> + # Activate on spacebar or enter + if event.which == 32 or event.which == 13 + @toggleFlagAbuse(event) toggleFlagAbuse: (event) -> event.preventDefault() diff --git a/common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee b/common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee index ef873d961c..54436ec481 100644 --- a/common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee +++ b/common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee @@ -4,6 +4,7 @@ if Backbone? events: "click .discussion-vote": "toggleVote" "click .discussion-flag-abuse": "toggleFlagAbuse" + "keypress .discussion-flag-abuse": "toggleFlagAbuseKeypress" "click .admin-pin": "togglePin" "click .action-follow": "toggleFollowing" "click .action-edit": "edit" @@ -51,10 +52,12 @@ if Backbone? if window.user.id in @model.get("abuse_flaggers") or (DiscussionUtil.isFlagModerator and @model.get("abuse_flaggers").length > 0) @$("[data-role=thread-flag]").addClass("flagged") @$("[data-role=thread-flag]").removeClass("notflagged") + @$(".discussion-flag-abuse").attr("aria-pressed", "true") @$(".discussion-flag-abuse .flag-label").html("Misuse Reported") else @$("[data-role=thread-flag]").removeClass("flagged") @$("[data-role=thread-flag]").addClass("notflagged") + @$(".discussion-flag-abuse").attr("aria-pressed", "false") @$(".discussion-flag-abuse .flag-label").html("Report Misuse") renderPinned: => diff --git a/common/static/coffee/src/discussion/views/response_comment_show_view.coffee b/common/static/coffee/src/discussion/views/response_comment_show_view.coffee index 6023964c75..0e51d6a11a 100644 --- a/common/static/coffee/src/discussion/views/response_comment_show_view.coffee +++ b/common/static/coffee/src/discussion/views/response_comment_show_view.coffee @@ -1,9 +1,6 @@ if Backbone? class @ResponseCommentShowView extends DiscussionContentView - events: - "click .discussion-flag-abuse": "toggleFlagAbuse" - tagName: "li" initialize: -> @@ -48,9 +45,15 @@ if Backbone? if window.user.id in @model.get("abuse_flaggers") or (DiscussionUtil.isFlagModerator and @model.get("abuse_flaggers").length > 0) @$("[data-role=thread-flag]").addClass("flagged") @$("[data-role=thread-flag]").removeClass("notflagged") + @$(".discussion-flag-abuse").attr("aria-pressed", "true") + @$(".discussion-flag-abuse").attr("data-tooltip", "Misuse Reported") + @$(".discussion-flag-abuse .flag-label").html("Misuse Reported") else @$("[data-role=thread-flag]").removeClass("flagged") @$("[data-role=thread-flag]").addClass("notflagged") + @$(".discussion-flag-abuse").attr("aria-pressed", "false") + @$(".discussion-flag-abuse").attr("data-tooltip", "Report Misuse") + @$(".discussion-flag-abuse .flag-label").html("Report Misuse") updateModelDetails: => @renderFlagged() diff --git a/common/static/coffee/src/discussion/views/thread_response_show_view.coffee b/common/static/coffee/src/discussion/views/thread_response_show_view.coffee index 43b2d3055e..aaff4a4a39 100644 --- a/common/static/coffee/src/discussion/views/thread_response_show_view.coffee +++ b/common/static/coffee/src/discussion/views/thread_response_show_view.coffee @@ -6,6 +6,7 @@ if Backbone? "click .action-delete": "_delete" "click .action-edit": "edit" "click .discussion-flag-abuse": "toggleFlagAbuse" + "keypress .discussion-flag-abuse": "toggleFlagAbuseKeypress" $: (selector) -> @$el.find(selector) @@ -104,10 +105,12 @@ if Backbone? if window.user.id in @model.get("abuse_flaggers") or (DiscussionUtil.isFlagModerator and @model.get("abuse_flaggers").length > 0) @$("[data-role=thread-flag]").addClass("flagged") @$("[data-role=thread-flag]").removeClass("notflagged") + @$(".discussion-flag-abuse").attr("aria-pressed", "true") @$(".discussion-flag-abuse .flag-label").html("Misuse Reported") else @$("[data-role=thread-flag]").removeClass("flagged") @$("[data-role=thread-flag]").addClass("notflagged") + @$(".discussion-flag-abuse").attr("aria-pressed", "false") @$(".discussion-flag-abuse .flag-label").html("Report Misuse") updateModelDetails: => diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index 8dfd46c1a9..fd936187a5 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -48,7 +48,7 @@
${'<%- body %>'}
-
+
${_("Report Misuse")}
@@ -129,8 +129,8 @@

${'<%- created_at %>'}

${"<%- body %>"}
-
- Report Misuse
+
+ ${_("Report Misuse")}