Commit 505fb681 by Matthew Mongeau

Initial work on single thread view.

parent 4215f0e4
...@@ -176,6 +176,7 @@ def forum_form_discussion(request, course_id): ...@@ -176,6 +176,7 @@ def forum_form_discussion(request, course_id):
def render_single_thread(request, discussion_id, course_id, thread_id): def render_single_thread(request, discussion_id, course_id, thread_id):
thread = cc.Thread.find(thread_id).retrieve(recursive=True).to_dict() thread = cc.Thread.find(thread_id).retrieve(recursive=True).to_dict()
threads, query_params = get_threads(request, course_id)
user_info = cc.User.from_django_user(request.user).to_dict() user_info = cc.User.from_django_user(request.user).to_dict()
...@@ -188,6 +189,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id): ...@@ -188,6 +189,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
'course_id': course_id, 'course_id': course_id,
'request': request, 'request': request,
'discussion_data': json.dumps({ discussion_id: [utils.safe_content(thread)] }), 'discussion_data': json.dumps({ discussion_id: [utils.safe_content(thread)] }),
'threads': threads,
} }
return render_to_string('discussion/_single_thread.html', context) return render_to_string('discussion/_single_thread.html', context)
...@@ -209,6 +211,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -209,6 +211,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
else: else:
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
threads, query_params = get_threads(request, course_id)
recent_active_threads = cc.search_recent_active_threads( recent_active_threads = cc.search_recent_active_threads(
course_id, course_id,
...@@ -229,6 +232,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -229,6 +232,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
'recent_active_threads': recent_active_threads, 'recent_active_threads': recent_active_threads,
'trending_tags': trending_tags, 'trending_tags': trending_tags,
'course_id': course.id, 'course_id': course.id,
'threads': threads,
} }
return render_to_response('discussion/single_thread.html', context) return render_to_response('discussion/single_thread.html', context)
......
...@@ -19,6 +19,28 @@ ...@@ -19,6 +19,28 @@
vertical-align: baseline; vertical-align: baseline;
} }
.discussion {
display: table-cell;
vertical-align: top;
width: 72.3%;
padding: 40px;
h1 {
font-size: 28px;
font-weight: 700;
}
.posted-details {
font-size: 12px;
font-style: italic;
color: #737373;
}
p + p {
margin-top: 20px;
}
}
.discussion-sidebar { .discussion-sidebar {
display: table-cell; display: table-cell;
......
<%namespace name="renderer" file="_content_renderer.html"/> <%namespace name="renderer" file="_content_renderer.html"/>
<section class="discussion" _id="${discussion_id | h}"> <section class="discussion" _id="${discussion_id | h}">
<a class="discussion-title" href="javascript:void(0)">Discussion</a> <a class="discussion-title" href="javascript:void(0)">${thread['title'] | h}</a>
<p class="posted-details"><span class="timeago" title="${thread['created_at'] | h}">sometime</span> by <a href="#">Foo</a></p>
<div class="threads"> <div class="threads">
${renderer.render_content_with_comments(thread)} ${renderer.render_content_with_comments(thread)}
</div> </div>
</section> </section>
<%include file="_js_data.html" /> <%include file="_js_data.html" />
<script type="text/javascript">$(document).ready(function() { $("span.timeago").timeago() })</script>
<%! import django_comment_client.helpers as helpers %>
<%inherit file="../main.html" /> <%inherit file="../main.html" />
<%namespace name='static' file='../static_content.html'/> <%namespace name='static' file='../static_content.html'/>
<%block name="bodyclass">discussion</%block> <%block name="bodyclass">discussion</%block>
...@@ -30,13 +31,13 @@ ...@@ -30,13 +31,13 @@
<div class="post-list-wrapper"> <div class="post-list-wrapper">
<ul class="post-list"> <ul class="post-list">
% for thread in threads: % for thread in threads:
<li><a href="#"><span class="title">${thread['title'] | h}</span> <span class="comments">${thread['comments_count'] | h}</span><span class="votes">+${thread['votes']['up_count'] | h}</span></a></li> <li><a href="${helpers.permalink(thread) | h}"><span class="title">${thread['title'] | h}</span> <span class="comments">${thread['comments_count'] | h}</span><span class="votes">+${thread['votes']['up_count'] | h}</span></a></li>
% endfor % endfor
</ul> </ul>
</div> </div>
</article> </article>
<section class="discussion-content"> <section class="discussion-content">
Oh This page intentionally left blank
</section> </section>
</div> </div>
......
<%! import django_comment_client.helpers as helpers %>
<%inherit file="../main.html" /> <%inherit file="../main.html" />
<%namespace name='static' file='../static_content.html'/> <%namespace name='static' file='../static_content.html'/>
<%block name="bodyclass">discussion</%block> <%block name="bodyclass">discussion</%block>
...@@ -16,6 +17,32 @@ ...@@ -16,6 +17,32 @@
<%include file="../courseware/course_navigation.html" args="active_page='discussion'" /> <%include file="../courseware/course_navigation.html" args="active_page='discussion'" />
<section class="container"> <section class="container">
<div class="discussion-wrapper">
<article class="discussion-sidebar">
<div class="board-selector">
<a href="#" class="board-drop-btn">Homework / Week 1 <span class="drop-arrow"></span></a>
<div class="board-drop-menu">
</div>
</div>
<div class="sort-bar">
<a href="#"><span class="sort-label">Sort by:</span> most recent <span class="drop-arrow"></span></a>
</div>
<div class="post-list-wrapper">
<ul class="post-list">
% for thread in threads:
<li><a href="${helpers.permalink(thread) | h}"><span class="title">${thread['title'] | h}</span> <span class="comments">${thread['comments_count'] | h}</span><span class="votes">+${thread['votes']['up_count'] | h}</span></a></li>
% endfor
</ul>
</div>
</article>
<section class="discussion-content">
${content.decode('utf-8')}
</section>
</div>
</section>
<section class="container">
<div class="course-wrapper"> <div class="course-wrapper">
<section aria-label="Course Navigation" class="course-index"> <section aria-label="Course Navigation" class="course-index">
<nav> <nav>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment