diff --git a/lms/static/coffee/src/discussion/discussion_router.coffee b/lms/static/coffee/src/discussion/discussion_router.coffee index 7928120bd1..262a3028c4 100644 --- a/lms/static/coffee/src/discussion/discussion_router.coffee +++ b/lms/static/coffee/src/discussion/discussion_router.coffee @@ -10,6 +10,8 @@ class @DiscussionRouter extends Backbone.Router @nav.on "threads:rendered", @setActiveThread @nav.render() + @newPostView = new NewPostView(el: $(".new-post-article")) + allThreads: -> true diff --git a/lms/static/coffee/src/discussion/views/new_post_view.coffee b/lms/static/coffee/src/discussion/views/new_post_view.coffee new file mode 100644 index 0000000000..9bd3322657 --- /dev/null +++ b/lms/static/coffee/src/discussion/views/new_post_view.coffee @@ -0,0 +1,69 @@ +class @NewPostView extends Backbone.View + + initialize: () -> + @dropdownButton = @$(".topic_dropdown_button") + + #events: + # "submit .new-post-form": "createPost" + # "click .topic_dropdown_button": "toggleTopicDropdown" + # "click .topic_menu": "setTopic" + + #toggleTopicDropdown: (event) -> + # if $target.hasClass('dropped') + # @showTopicDropdown() + # else + # @hideTopicDropdown() + # + #showTopicDropdown: () -> + # #$button = + # $button.addClass('dropped') + + # $topicMenu = @$(".topic_menu") + # $topicMenu.show() + + #createPost: (event) -> + # event.preventDefault() + + # title = @$(".new-post-title").val() + # body = @$(".new-post-body").val() + # tags = @$(".new-post-tags").val() + + # anonymous = false || @$("input.discussion-anonymous").is(":checked") + # follow = false || @$("input.discussion-follow").is(":checked") + + # $formTopicDropBtn.bind('click', showFormTopicDrop); + # $formTopicDropMenu.bind('click', setFormTopic); + + # url = DiscussionUtil.urlFor('create_thread', @model.id) + + # DiscussionUtil.safeAjax + # $elem: $(event.target) + # $loading: $(event.target) if event + # url: url + # type: "POST" + # dataType: 'json' + # data: + # title: title + # body: body + # tags: tags + # anonymous: anonymous + # auto_subscribe: follow + # error: DiscussionUtil.formErrorHandler(@$(".new-post-form-errors")) + # success: (response, textStatus) => + # DiscussionUtil.clearFormErrors(@$(".new-post-form-errors")) + # $thread = $(response.html) + # @$el.children(".threads").prepend($thread) + + # @$el.children(".blank").remove() + + # @$(".new-post-similar-posts").empty() + # @$(".new-post-similar-posts-wrapper").hide() + # @$(".new-post-title").val("").attr("prev-text", "") + # DiscussionUtil.setWmdContent @$el, $.proxy(@$, @), "new-post-body", "" + # @$(".new-post-tags").val("") + # @$(".new-post-tags").importTags("") + + # thread = @model.addThread response.content + # threadView = new ThreadView el: $thread[0], model: thread + # thread.updateInfo response.annotated_content_info + # @cancelNewPost() diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index 88c9ffdb7f..269aa539d6 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -429,7 +429,7 @@ body.discussion { opacity: 0; } - &.is-dropped { + &.dropped { .browse-topic-drop-btn { span { @@ -442,13 +442,13 @@ body.discussion { } } - &.is-dropped { + &.dropped { .browse-topic-drop-btn { background-color: #616161; } } - &.is-dropped { + &.dropped { .browse-topic-drop-icon { background-position: 0 -16px; } diff --git a/lms/templates/discussion/_new_post.html b/lms/templates/discussion/_new_post.html index 5b6be085e3..d84f252219 100644 --- a/lms/templates/discussion/_new_post.html +++ b/lms/templates/discussion/_new_post.html @@ -38,9 +38,9 @@
- +
- +