diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3bc0544bfb..6739ceedcb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,8 @@ it pauses on the end time. Blades: Disallow users to enter video url's in http. +LMS: Improve the acessibility of the forum follow post buttons. + Blades: Fix bug when the speed can only be changed when the video is playing. LMS: Change bulk email implementation to use less memory, and to better handle 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 001dc887cd..c695955897 100644 --- a/common/static/coffee/src/discussion/views/discussion_content_view.coffee +++ b/common/static/coffee/src/discussion/views/discussion_content_view.coffee @@ -37,9 +37,9 @@ if Backbone? subscribed: (subscribed) -> if subscribed - @$(".dogear").addClass("is-followed") + @$(".dogear").addClass("is-followed").attr("aria-checked", "true") else - @$(".dogear").removeClass("is-followed") + @$(".dogear").removeClass("is-followed").attr("aria-checked", "false") ability: (ability) -> for action, selector of @abilityRenderer @@ -106,6 +106,26 @@ if Backbone? @model.bind('change', @renderPartialAttrs, @) + toggleFollowingKeypress: (event) -> + # Activate on spacebar or enter + if event.which == 32 or event.which == 13 + @toggleFollowing(event) + + toggleFollowing: (event) -> + event.preventDefault() + $elem = $(event.target) + url = null + if not @model.get('subscribed') + @model.follow() + url = @model.urlFor("follow") + else + @model.unfollow() + url = @model.urlFor("unfollow") + DiscussionUtil.safeAjax + $elem: $elem + url: url + type: "POST" + toggleFlagAbuseKeypress: (event) -> # Activate on spacebar or enter if event.which == 32 or event.which == 13 diff --git a/common/static/coffee/src/discussion/views/discussion_thread_profile_view.coffee b/common/static/coffee/src/discussion/views/discussion_thread_profile_view.coffee index 8b47696c01..b8cecbf39b 100644 --- a/common/static/coffee/src/discussion/views/discussion_thread_profile_view.coffee +++ b/common/static/coffee/src/discussion/views/discussion_thread_profile_view.coffee @@ -4,6 +4,7 @@ if Backbone? events: "click .discussion-vote": "toggleVote" "click .action-follow": "toggleFollowing" + "keypress .action-follow": "toggleFollowingKeypress" "click .expand-post": "expandPost" "click .collapse-post": "collapsePost" @@ -25,7 +26,6 @@ if Backbone? @$el.html(Mustache.render(@template, params)) @initLocal() @delegateEvents() - @renderDogear() @renderVoted() @renderAttrs() @$("span.timeago").timeago() @@ -34,10 +34,6 @@ if Backbone? @renderResponses() @ - renderDogear: -> - if window.user.following(@model) - @$(".dogear").addClass("is-followed") - renderVoted: => if window.user.voted(@model) @$("[data-role=discussion-vote]").addClass("is-cast") @@ -81,20 +77,6 @@ if Backbone? else @vote() - toggleFollowing: (event) -> - $elem = $(event.target) - url = null - if not @model.get('subscribed') - @model.follow() - url = @model.urlFor("follow") - else - @model.unfollow() - url = @model.urlFor("unfollow") - DiscussionUtil.safeAjax - $elem: $elem - url: url - type: "POST" - vote: -> window.user.vote(@model) url = @model.urlFor("upvote") 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 54436ec481..b5f478a8af 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 @@ -7,6 +7,7 @@ if Backbone? "keypress .discussion-flag-abuse": "toggleFlagAbuseKeypress" "click .admin-pin": "togglePin" "click .action-follow": "toggleFollowing" + "keypress .action-follow": "toggleFollowingKeypress" "click .action-edit": "edit" "click .action-delete": "_delete" "click .action-openclose": "toggleClosed" @@ -25,7 +26,6 @@ if Backbone? render: -> @$el.html(@renderTemplate()) @delegateEvents() - @renderDogear() @renderVoted() @renderFlagged() @renderPinned() @@ -36,10 +36,6 @@ if Backbone? @highlight @$("h1,h3") @ - renderDogear: -> - if window.user.following(@model) - @$(".dogear").addClass("is-followed") - renderVoted: => if window.user.voted(@model) @$("[data-role=discussion-vote]").addClass("is-cast") @@ -94,20 +90,6 @@ if Backbone? else @vote() - toggleFollowing: (event) -> - $elem = $(event.target) - url = null - if not @model.get('subscribed') - @model.follow() - url = @model.urlFor("follow") - else - @model.unfollow() - url = @model.urlFor("unfollow") - DiscussionUtil.safeAjax - $elem: $elem - url: url - type: "POST" - vote: -> window.user.vote(@model) url = @model.urlFor("upvote") diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index 30285658ea..9d7d150cf2 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -26,7 +26,6 @@