diff --git a/lms/static/coffee/src/discussion/discussion_router.coffee b/lms/static/coffee/src/discussion/discussion_router.coffee index b2e41cd5af..a5219a68b9 100644 --- a/lms/static/coffee/src/discussion/discussion_router.coffee +++ b/lms/static/coffee/src/discussion/discussion_router.coffee @@ -14,6 +14,9 @@ if Backbone? @newPostView = new NewPostView(el: $(".new-post-article"), collection: @discussion) @nav.on "thread:created", @navigateToThread + @newPost = $('.new-post-article') + $('.new-post-btn').bind "click", @showNewPost + $('.new-post-cancel').bind "click", @hideNewPost allThreads: -> @nav.updateSidebar() @@ -43,3 +46,10 @@ if Backbone? navigateToAllThreads: => @navigate("", trigger: true) + + showNewPost: (event) => + @newPost.slideDown(300) + $('.new-post-title').focus() + + hideNewPost: (event) => + @newPost.slideUp(300) diff --git a/lms/static/js/discussions-temp.js b/lms/static/js/discussions-temp.js index dd6af6ef14..ec7c189938 100644 --- a/lms/static/js/discussions-temp.js +++ b/lms/static/js/discussions-temp.js @@ -55,8 +55,6 @@ $(document).ready(function() { // $topicDrop.bind('click', setTopic); $formTopicDropBtn.bind('click', showFormTopicDrop); $formTopicDropMenu.bind('click', setFormTopic); - $('.new-post-btn').bind('click', newPost); - $('.new-post-cancel').bind('click', closeNewPost); $body.delegate('[data-tooltip]', { 'mouseover': showTooltip, @@ -266,15 +264,6 @@ function setTopic(e) { showBrowse(); } -function newPost(e) { - $newPost.slideDown(300); - $('.new-post-title').focus(); -} - -function closeNewPost(e) { - $newPost.slideUp(300); -} - function showFormTopicDrop(e) { $formTopicDropBtn.addClass('is-dropped'); $formTopicDropMenu.show();