From c4eec80e5ea4b6091c5fa9c9f8674618baa5cb8a Mon Sep 17 00:00:00 2001 From: Ibrahim Awwal Date: Tue, 4 Sep 2012 02:32:38 -0700 Subject: [PATCH 1/6] Somewhat compacted the embedded thread view, but it probably needs a more thorough redesign. --- lms/static/sass/_discussion.scss | 94 ++++++++++++++----- .../mustache/_inline_discussion.mustache | 2 +- 2 files changed, 71 insertions(+), 25 deletions(-) diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index 0df6eceb85..f94e1958b5 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -60,7 +60,7 @@ border: 1px solid #aaa; border-top: none; border-radius: 0 0 3px 3px; - background: #eee; + background: #eee; color: #333; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset; } @@ -82,7 +82,7 @@ .wmd-button-bar { width: 100%; - background-color: Silver; + background-color: Silver; } .wmd-input { @@ -129,25 +129,25 @@ } .wmd-button-row { - position: relative; + position: relative; margin-left: 5px; margin-right: 5px; margin-bottom: 5px; margin-top: 10px; - padding: 0px; + padding: 0px; height: 20px; overflow: hidden; @include transition(all, .2s, easeOut); } .wmd-spacer { - width: 1px; - height: 20px; + width: 1px; + height: 20px; margin-left: 14px; - + position: absolute; background-color: Silver; - display: inline-block; + display: inline-block; list-style: none; } @@ -301,7 +301,7 @@ body.discussion { border-top: 1px solid #5f5f5f; font-size: 14px; font-weight: 700; - color: #eee; + color: #eee; &:hover { background-color: #666; @@ -332,7 +332,7 @@ body.discussion { width: 100%; height: 30px; padding: 0 15px; - box-sizing: border-box; + box-sizing: border-box; border-radius: 30px; border: 1px solid #333; box-shadow: 0 1px 3px rgba(0, 0, 0, .25) inset; @@ -392,7 +392,7 @@ body.discussion { box-sizing: border-box; border: 1px solid #333; border-radius: 0 0 3px 3px; - background: #e6e6e6; + background: #e6e6e6; color: #333; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) inset; } @@ -400,10 +400,10 @@ body.discussion { .new-post-preview-label { position: absolute; top: 4px; - left: 4px; + left: 4px; font-size: 11px; color: #aaa; - text-transform: uppercase; + text-transform: uppercase; } .new-post-title, @@ -468,7 +468,7 @@ body.discussion { color: #333; background: #c5eeff; border: 1px solid #90c4d7; - font-size: 13px; + font-size: 13px; } .thread-title { @@ -478,7 +478,7 @@ body.discussion { color: #333; font-weight: 700; } - + @@ -567,7 +567,7 @@ body.discussion { height: 60px; border-bottom: 1px solid #a3a3a3; border-radius: 3px 0 0 0; - + .browse, .search { @@ -762,7 +762,7 @@ body.discussion { width: 100%; height: 30px; padding: 0 15px; - box-sizing: border-box; + box-sizing: border-box; border-radius: 30px; border: 1px solid #333; box-shadow: 0 1px 3px rgba(0, 0, 0, .25) inset; @@ -929,7 +929,7 @@ body.discussion { box-shadow: 0 1px 0 #4697c1, 0 -1px 0 #4697c1; .title { - color: #333; + color: #333; } .votes-count, @@ -1077,7 +1077,7 @@ body.discussion { .responses { list-style: none; margin-top: 40px; - padding: 0; + padding: 0; > li { position: relative; @@ -1230,8 +1230,8 @@ body.discussion { background: #009FE2; font-size: 9px; font-weight: 700; - font-style: normal; - color: white; + font-style: normal; + color: white; text-transform: uppercase; } @@ -1386,7 +1386,7 @@ body.discussion { } #wmd-input { - @include discussion-wmd-input; + @include discussion-wmd-input; } #wmd-preview { @@ -1418,7 +1418,53 @@ body.discussion { /* For some reason I have to do this to get the SCSS to compile, can't stick it under the above .discussion-module */ .discussion-module { - .discussion-reply-new { - display:none + section.discussion { + /* Course content p has a default margin-bottom of 1.416, this is just to reset that */ + + .discussion-thread { + padding: 0.5em; + + p { + margin-bottom: 0em; + } + .discussion-article { + border: 1px solid; + border-radius: 3px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); + + .discussion-post { + header { + padding-bottom: 0.1em; + margin-bottom: 10px; + + } + .post-body { + font-size: 14px; + } + } + + .responses { + margin-top: 10px; + + header { + padding-bottom: 0em; + margin-bottom: 5px; + .posted-by { + font-size: 0.8em; + } + } + .response-body { + margin-bottom: 0.2em; + font-size: 14px; + } + + } + } + } } + + .discussion-reply-new { + display:none; + } + } diff --git a/lms/templates/discussion/mustache/_inline_discussion.mustache b/lms/templates/discussion/mustache/_inline_discussion.mustache index eb8f12af43..f82b3810e5 100644 --- a/lms/templates/discussion/mustache/_inline_discussion.mustache +++ b/lms/templates/discussion/mustache/_inline_discussion.mustache @@ -1,6 +1,6 @@
{{#threads}} -
+
{{/threads}}
From e63f591d9b5dac6e9182437baf817986f8a899ed Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Tue, 4 Sep 2012 10:29:19 -0400 Subject: [PATCH 2/6] Comment should pass endorsed to template. --- lms/static/coffee/src/discussion/content.coffee | 3 --- .../coffee/src/discussion/views/discussion_thread_view.coffee | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index 93d1414035..7540b508ef 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -16,7 +16,6 @@ if Backbone? urlMappers: {} urlFor: (name) -> - console.log @ @urlMappers[name].apply(@) can: (action) -> @@ -24,7 +23,6 @@ if Backbone? updateInfo: (info) -> if info - console.log info.ability @set('ability', info.ability) @set('voted', info.voted) @set('subscribed', info.subscribed) @@ -248,7 +246,6 @@ if Backbone? @model.set('votes_point', response.votes.point) toggleVote: (event) -> - console.log("HERE") $elem = $(event.target) value = $elem.attr("value") $elem.toggleClass("is-cast") diff --git a/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee b/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee index b97fbc30cf..8834a38b77 100644 --- a/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee +++ b/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee @@ -111,7 +111,7 @@ class @DiscussionThreadView extends DiscussionContentView event.preventDefault() url = @model.urlFor('reply') body = @$("#wmd-input").val() - response = new Comment(body: body, created_at: (new Date()).toISOString(), username: window.user.get("username"), votes: { up_count: 0 }) + response = new Comment(body: body, created_at: (new Date()).toISOString(), username: window.user.get("username"), votes: { up_count: 0 }, endorsed: false) @renderResponse(response) @addComment() From 658d99fafd89131f26dfedb38a381ea32e1d32b5 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Tue, 4 Sep 2012 10:46:50 -0400 Subject: [PATCH 3/6] fixed preview text overlapping content --- lms/static/sass/_discussion.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index f94e1958b5..ca437b3f99 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -55,7 +55,7 @@ @mixin discussion-wmd-preview { width: 100%; min-height: 40px; - padding: 10px; + padding: 25px 20px 10px 20px; box-sizing: border-box; border: 1px solid #aaa; border-top: none; @@ -388,7 +388,7 @@ body.discussion { width: 100%; //height: 50px; margin-top: -1px; - padding: 10px; + padding: 25px 20px 10px 20px; box-sizing: border-box; border: 1px solid #333; border-radius: 0 0 3px 3px; From a574c48c13fe1fa95a9a929a24187c81e3c23394 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Tue, 4 Sep 2012 11:01:21 -0400 Subject: [PATCH 4/6] fixed long lines in the category drop --- lms/static/sass/_discussion.scss | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index ca437b3f99..56b82b7ec5 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -301,6 +301,7 @@ body.discussion { border-top: 1px solid #5f5f5f; font-size: 14px; font-weight: 700; + line-height: 18px; color: #eee; &:hover { @@ -716,18 +717,24 @@ body.discussion { a { display: block; - height: 50px; padding: 0 20px; border-top: 1px solid #5f5f5f; font-size: 14px; font-weight: 700; - line-height: 48px; + line-height: 22px; color: #fff; + @include clearfix; &:hover { background-color: #636363; } + .board-name { + float: left; + width: 80%; + margin: 13px 0; + } + .unread { float: right; padding: 0 5px; From 00abf08dc398f101b534f72511c52c957a0c97b1 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Tue, 4 Sep 2012 11:22:46 -0400 Subject: [PATCH 5/6] new icons for new post; fixed icons on reply --- lms/static/images/new-post-icons-full.png | Bin 0 -> 9861 bytes lms/static/sass/_discussion.scss | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 lms/static/images/new-post-icons-full.png diff --git a/lms/static/images/new-post-icons-full.png b/lms/static/images/new-post-icons-full.png new file mode 100644 index 0000000000000000000000000000000000000000..495273a7d3d08928b4b81111891fb7f6b17a5282 GIT binary patch literal 9861 zcmbW7bzD?kyZ0$!=o|s1OB#k4I){b$}-{`&oF}U?^C-S=unEyI9!S=-F6U2YB?^NMm4N+dCi(y$#`7 zl2&dm{1$)G@cX;C1G$01jHSSPVqrf^c`3jlF|f zpr?&~pfqR)P=+6BNo15fOz#A-qgNf)F7ALEs1FgNR6qLM4U7nEu{a zfZ9B*Z6)=TRQ|3DxRPP9_x5&|6cF(9^W*mu=6Cb76M#raNc<^7NQe(e!RHm=>TTiA z=jz4!PYFskURItC?%ob=u1tSQw6JvZ@s?o$TKcapxVXdN|1Q|o>u*B=CKK?ta2J5^ z3ktZn{OQ+UslB}QZ2r@X|1q@}BEa27K+nd@&BxOU7!O<4e=-BM``;`2lMrZ)q>iTp zFenzzN^Vv@E;g>->Pj*!z!QFJ2Wv@jh^UGpOh{2sQ3wJRhd{&y#f6m>B_Lu@6)|OH zLD7H8_@DAZV1f{3QJ9#rg17_(q6`sN5`!v2_|9|!TUwN(nf2<||G)CZ$d;Ax7`R5kk zgMUu{?fk&Szo(ClD==p~fyn_rCIRLgOO3jc0>Xc0?DtsT!*?ltOIotcy;%kPi@tF+?o~_vQ{skbMTT*Ihv*Ema+K@BAz~L?q-m zejF;{e*E~6U8Tq)NxS6hu;WMEsXD8k7tzG`p)~9G5uk7ya2v115dJA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o5R$p4ZDKp{w Q^I@2}vbNHDMf1r21K4^s*#H0l literal 0 HcmV?d00001 diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index 56b82b7ec5..9a0fddbcc8 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -351,6 +351,14 @@ body.discussion { padding: 40px; box-sizing: border-box; } + + .wmd-button { + background: none; + } + + .wmd-button span { + background: url(../images/new-post-icons-full.png) no-repeat; + } } .new-post-form { @@ -1408,6 +1416,10 @@ body.discussion { @include blue-button; float: left; } + + .wmd-button { + width: 15px; + } } From 10887ab117e504526cfbbc72e429a65cb6fd11d2 Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Tue, 4 Sep 2012 11:52:40 -0400 Subject: [PATCH 6/6] Fix voting. --- .../coffee/src/discussion/content.coffee | 8 +++++ .../discussion/models/discussion_user.coffee | 8 +++++ .../views/discussion_thread_view.coffee | 36 +++++++++++-------- .../discussion/_underscore_templates.html | 2 +- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index 7540b508ef..ee6c50ecf7 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -447,6 +447,14 @@ if Backbone? @set('subscribed', false) @trigger "thread:unfollow" + vote: -> + @get("votes")["up_count"] = parseInt(@get("votes")["up_count"]) + 1 + @trigger "change" + + unvote: -> + @get("votes")["up_count"] = parseInt(@get("votes")["up_count"]) - 1 + @trigger "change" + display_body: -> if @has("highlighted_body") String(@get("highlighted_body")).replace(//g, '').replace(/<\/highlight>/g, '') diff --git a/lms/static/coffee/src/discussion/models/discussion_user.coffee b/lms/static/coffee/src/discussion/models/discussion_user.coffee index 6cf0dbedbb..6449e80b85 100644 --- a/lms/static/coffee/src/discussion/models/discussion_user.coffee +++ b/lms/static/coffee/src/discussion/models/discussion_user.coffee @@ -4,3 +4,11 @@ class @DiscussionUser extends Backbone.Model voted: (thread) -> _.include(@get('upvoted_ids'), thread.id) + + vote: (thread) -> + @get('upvoted_ids').push(thread.id) + thread.vote() + + unvote: (thread) -> + @set('upvoted_ids', _.without(@get('upvoted_ids'), thread.id)) + thread.unvote() diff --git a/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee b/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee index 8834a38b77..514f60aef3 100644 --- a/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee +++ b/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee @@ -22,22 +22,32 @@ class @DiscussionThreadView extends DiscussionContentView template: _.template($("#thread-template").html()) + initialize: -> + @model.on "change", @updateModelDetails + render: -> @$el.html(@template(@model.toJSON())) - @model.bind "change", @updateModelDetails - if window.user.following(@model) - @$(".dogear").addClass("is-followed") - - if window.user.voted(@model) - @$(".vote-btn").addClass("is-cast") + @renderDogear() + @renderVoted() @$("span.timeago").timeago() Markdown.makeWmdEditor @$(".reply-body"), "", DiscussionUtil.urlFor("upload"), (text) -> DiscussionUtil.postMathJaxProcessor(text) @convertMath() @renderResponses() @ + renderDogear: -> + if window.user.following(@model) + @$(".dogear").addClass("is-followed") + + renderVoted: => + if window.user.voted(@model) + @$("[data-role=discussion-vote]").addClass("is-cast") + else + @$("[data-role=discussion-vote]").removeClass("is-cast") + updateModelDetails: => - @$(".discussion-vote .votes-count-number").html(@model.get("votes")["up_count"]) + @renderVoted() + @$("[data-role=discussion-vote] .votes-count-number").html(@model.get("votes")["up_count"]) convertMath: -> element = @$(".post-body") @@ -64,10 +74,10 @@ class @DiscussionThreadView extends DiscussionContentView toggleVote: (event) -> event.preventDefault() - if not @model.get('voted')#@$(".discussion-vote").hasClass("is-cast") - @vote() - else + if window.user.voted(@model) @unvote() + else + @vote() toggleFollowing: (event) -> $elem = $(event.target) @@ -84,9 +94,8 @@ class @DiscussionThreadView extends DiscussionContentView type: "POST" vote: -> + window.user.vote(@model) url = @model.urlFor("upvote") - @model.set('votes_point', parseInt(@model.get('votes_point')) + 1) - #@$(".discussion-vote .votes-count-number").html(parseInt(@$(".discussion-vote .votes-count-number").html()) + 1) DiscussionUtil.safeAjax $elem: @$(".discussion-vote") url: url @@ -96,9 +105,8 @@ class @DiscussionThreadView extends DiscussionContentView @model.set(response) unvote: -> + window.user.unvote(@model) url = @model.urlFor("unvote") - @model.set('votes_point', parseInt(@model.get('votes_point')) - 1) - #@$(".discussion-vote .votes-count-number").html(parseInt(@$(".discussion-vote .votes-count-number").html()) - 1) DiscussionUtil.safeAjax $elem: @$(".discussion-vote") url: url diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index 64fca600e4..1a5fe6158d 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -3,7 +3,7 @@
- + ${'<%- votes["up_count"] %>'} + + ${'<%- votes["up_count"] %>'}

${'<%- title %>'}

${'<%- created_at %>'} by