Initial work on single thread view.
This commit is contained in:
@@ -176,6 +176,7 @@ def forum_form_discussion(request, course_id):
|
||||
def render_single_thread(request, discussion_id, course_id, thread_id):
|
||||
|
||||
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()
|
||||
|
||||
@@ -188,6 +189,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
|
||||
'course_id': course_id,
|
||||
'request': request,
|
||||
'discussion_data': json.dumps({ discussion_id: [utils.safe_content(thread)] }),
|
||||
'threads': threads,
|
||||
}
|
||||
return render_to_string('discussion/_single_thread.html', context)
|
||||
|
||||
@@ -209,6 +211,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
|
||||
|
||||
else:
|
||||
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(
|
||||
course_id,
|
||||
@@ -229,6 +232,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
|
||||
'recent_active_threads': recent_active_threads,
|
||||
'trending_tags': trending_tags,
|
||||
'course_id': course.id,
|
||||
'threads': threads,
|
||||
}
|
||||
|
||||
return render_to_response('discussion/single_thread.html', context)
|
||||
|
||||
@@ -19,6 +19,28 @@
|
||||
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 {
|
||||
|
||||
display: table-cell;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<%namespace name="renderer" file="_content_renderer.html"/>
|
||||
|
||||
<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">
|
||||
${renderer.render_content_with_comments(thread)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<%include file="_js_data.html" />
|
||||
<script type="text/javascript">$(document).ready(function() { $("span.timeago").timeago() })</script>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<%! import django_comment_client.helpers as helpers %>
|
||||
<%inherit file="../main.html" />
|
||||
<%namespace name='static' file='../static_content.html'/>
|
||||
<%block name="bodyclass">discussion</%block>
|
||||
@@ -30,13 +31,13 @@
|
||||
<div class="post-list-wrapper">
|
||||
<ul class="post-list">
|
||||
% 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
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
<section class="discussion-content">
|
||||
Oh
|
||||
This page intentionally left blank
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<%! import django_comment_client.helpers as helpers %>
|
||||
<%inherit file="../main.html" />
|
||||
<%namespace name='static' file='../static_content.html'/>
|
||||
<%block name="bodyclass">discussion</%block>
|
||||
@@ -15,6 +16,32 @@
|
||||
|
||||
<%include file="../courseware/course_navigation.html" args="active_page='discussion'" />
|
||||
|
||||
<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">
|
||||
<section aria-label="Course Navigation" class="course-index">
|
||||
|
||||
Reference in New Issue
Block a user