diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 1b9037105d..fe9c916db2 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -23,11 +23,9 @@ from django.views.decorators.cache import cache_control from module_render import toc_for_course, get_module, get_section from models import StudentModuleCache from student.models import UserProfile -<<<<<<< HEAD from multicourse import multicourse_settings -======= ->>>>>>> 38dd8f18984df3ab14f5715891af7f984c7f14a7 + from django_comment_client.utils import get_discussion_title from xmodule.modulestore import Location diff --git a/lms/lib/dogfood/views.py b/lms/lib/dogfood/views.py index 7a0e03436d..6df881df98 100644 --- a/lms/lib/dogfood/views.py +++ b/lms/lib/dogfood/views.py @@ -24,7 +24,6 @@ from mitxmako.shortcuts import render_to_response, render_to_string import track.views from lxml import etree - from courseware.module_render import make_track_function, ModuleSystem, get_module from courseware.models import StudentModule from multicourse import multicourse_settings diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index 0bdb8f306c..491cc32cc6 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -24,8 +24,13 @@ $discussion_input_width: 90%; } .discussion { + .search-wrapper-inline { + width: 80%; + display: inline-block; + margin-top: 2%; + } .discussion-search-form { - margin-bottom: flex-gutter(4); + margin-bottom: 1%; display: inline-block; width: flex-grid(12); .discussion-link { @@ -47,24 +52,51 @@ $discussion_input_width: 90%; float: left; width: 72%; } - .search-within { - display: block; - margin-top: flex-gutter(); - } - .discussion-search-within-board { - font-style: normal; - font: inherit; - } + } + .search-within { + display: block; + margin-bottom: 3%; + } + .discussion-search-within-board { + font-style: normal; + font: inherit; } .control-button { @include button; @include discussion-font; + display: inline-block; + margin-bottom: 3%; color: white; font-weight: bold; padding-top: 9px; font-size: inherit; width: inherit; text-decoration: none; + border: 1px solid #6F6F6F; + -webkit-box-shadow: inset 0 1px 0 #A2A2A2,0 0 3px #CCC; + -moz-box-shadow: inset 0 1px 0 #a2a2a2,0 0 3px #ccc; + box-shadow: inset 0 1px 0 #A2A2A2,0 0 3px #CCC; + background-color: #959595; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #959595),color-stop(100%, #7B7B7B)); + background-image: -webkit-linear-gradient(top, #959595,#7B7B7B); + background-image: -moz-linear-gradient(top, #959595,#7B7B7B); + background-image: -ms-linear-gradient(top, #959595,#7B7B7B); + background-image: -o-linear-gradient(top, #959595,#7B7B7B); + background-image: linear-gradient(top, #959595,#7B7B7B); + text-shadow: none; + &:hover { + -webkit-box-shadow: inset 0 1px 0 #BBB,0 0 3px #CCC; + -moz-box-shadow: inset 0 1px 0 #bbb,0 0 3px #ccc; + box-shadow: inset 0 1px 0 #BBB,0 0 3px #CCC; + background-color: #A2A2A2; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #A2A2A2),color-stop(100%, #7B7B7B)); + background-image: -webkit-linear-gradient(top, #A2A2A2,#7B7B7B); + background-image: -moz-linear-gradient(top, #A2A2A2,#7B7B7B); + background-image: -ms-linear-gradient(top, #A2A2A2,#7B7B7B); + background-image: -o-linear-gradient(top, #A2A2A2,#7B7B7B); + background-image: linear-gradient(top, #A2A2A2,#7B7B7B); + border: 1px solid #555; + } } .discussion-title { @include discussion-font; @@ -91,12 +123,10 @@ $discussion_input_width: 90%; } } .discussion-votes { - margin-right: 2%; - margin-top: 2%; text-align: center; height: flex-grid(3); float: left; - margin-left: 2%; + margin: 1% 2%; .discussion-vote-count { font-size: $comment_body_size; @include discussion-font; @@ -122,7 +152,7 @@ $discussion_input_width: 90%; float: left; width: 85%; } - .new-post-form, .discussion-thread-edit{ + .new-post-form, .discussion-thread-edit { .title-input, .body-input { font-style: normal; font: inherit; @@ -177,8 +207,6 @@ $discussion_input_width: 90%; } .thread { //display: none; - margin-top: 30px; - margin-bottom: 30px; .thread-title { @include discussion-font; @include discussion-clickable; @@ -240,10 +268,9 @@ $discussion_input_width: 90%; } } .discussion-content { - margin-top: 10px; overflow: hidden; border-top: lightgray 1px solid; - padding-top: 20px; + padding: 3% 0; .discussion-reply-new { margin-left: $comment_margin_left; .reply-body { diff --git a/lms/templates/discussion/_forum.html b/lms/templates/discussion/_forum.html index f8a2d54f00..ae3d22e9cd 100644 --- a/lms/templates/discussion/_forum.html +++ b/lms/templates/discussion/_forum.html @@ -6,6 +6,11 @@ Discussion ${search_bar} +
+ + +
+
New Post
<%include file="_paginator.html" /> diff --git a/lms/templates/discussion/_inline.html b/lms/templates/discussion/_inline.html index f8a2d54f00..4d66045cc6 100644 --- a/lms/templates/discussion/_inline.html +++ b/lms/templates/discussion/_inline.html @@ -2,10 +2,9 @@
-
- Discussion +
+ ${search_bar}
- ${search_bar}
New Post
<%include file="_paginator.html" /> diff --git a/lms/templates/discussion/_search_bar.html b/lms/templates/discussion/_search_bar.html index 869f83556f..c295e14b54 100644 --- a/lms/templates/discussion/_search_bar.html +++ b/lms/templates/discussion/_search_bar.html @@ -8,8 +8,4 @@ def url_for_search():
-
- - -
diff --git a/lms/templates/discussion/thread.html b/lms/templates/discussion/thread.html new file mode 100644 index 0000000000..e49d555d59 --- /dev/null +++ b/lms/templates/discussion/thread.html @@ -0,0 +1,105 @@ +<%! from django.core.urlresolvers import reverse %> +<%! from datehelper import time_ago_in_words %> +<%! from dateutil.parser import parse %> +<%! import urllib %> + +<%def name="render_thread(course_id, thread, edit_thread=False, show_comments=False)"> +
+ ${render_content(thread, "thread", edit_thread=edit_thread, show_comments=show_comments)} + % if show_comments: + ${render_comments(thread['children'])} + % endif +
+ + +<%def name="render_comments(comments)"> +
+ % for comment in comments: +
+ ${render_content(comment, "comment")} +
+ ${render_comments(comment['children'])} +
+
+ % endfor +
+ + +<%def name="render_content(content, type, **kwargs)"> +
+
+ ${render_vote(content)} +
+ ${render_title(content, type, **kwargs)} +
+
${content['body'] | h}
+ + ${render_tags(content, type, **kwargs)} + ${render_bottom_bar(content, type, **kwargs)} +
+
+
+
+ + +<%def name="render_title(content, type, **kwargs)"> + <% + if type == "thread": + if kwargs.get('show_comments', False): + url_for_thread = "" + else: + url_for_thread = reverse('django_comment_client.forum.views.single_thread', args=[course_id, content['commentable_id'], content['id']]) + %> + % if type == "thread": + ${content['title'] | h} + % endif + + +<%def name="render_tags(content, type, **kwargs)"> + <% + def url_for_tags(tags): + return reverse('django_comment_client.forum.views.search', args=[course_id]) + '?' + urllib.urlencode({'tags': ",".join(tags)}) + %> + % if type == "thread": +
+ % for tag in content['tags']: + ${tag | h} + % endfor +
+ + % endif + + +<%def name="render_bottom_bar(content, type, **kwargs)"> +
+ ${render_info(content)} + % if type == "thread" and kwargs['edit_thread'] or type == "comment": + ${render_link("discussion-link discussion-reply", "Reply")} + ${render_link("discussion-link discussion-edit", "Edit")} + % endif +
+ + +<%def name="render_info(content)"> + ${time_ago_in_words(parse(content['updated_at']))} ago by + % if content['anonymous']: + anonymous + % else: + user No.${content['user_id']} + % endif + % if content.get('comments_count', -1) >= 0: + , ${content['comments_count']} comment(s) + % endif + + +<%def name="render_link(cls, html)"> + ${html} + + +<%def name="render_vote(content)"> +
+ ${render_link("discussion-vote discussion-vote-up", "˄")} + ${content['votes']['point']} + ${render_link("discussion-vote discussion-vote-down", "˅")} +
+