Commit 44ede5b1 by Ibrahim Awwal

Make the discussion index page show the left sidebar.

parent 28664f24
...@@ -145,7 +145,7 @@ def forum_form_discussion(request, course_id): ...@@ -145,7 +145,7 @@ def forum_form_discussion(request, course_id):
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) threads, query_params = get_threads(request, course_id)
content = render_forum_discussion(request, course_id, threads, discussion_id=_general_discussion_id(course_id), query_params=query_params) content = render_forum_discussion(request, course_id, threads, discussion_id=_general_discussion_id(course_id), query_params=query_params)
user_info = cc.User.from_django_user(request.user).to_dict()
if request.is_ajax(): if request.is_ajax():
return utils.JsonResponse({ return utils.JsonResponse({
'html': content, 'html': content,
...@@ -168,7 +168,9 @@ def forum_form_discussion(request, course_id): ...@@ -168,7 +168,9 @@ def forum_form_discussion(request, course_id):
'recent_active_threads': recent_active_threads, 'recent_active_threads': recent_active_threads,
'trending_tags': trending_tags, 'trending_tags': trending_tags,
'staff_access' : has_access(request.user, course, 'staff'), 'staff_access' : has_access(request.user, course, 'staff'),
'threads': threads, 'threads': json.dumps(threads),
'course_id': course.id,
'user_info': json.dumps(user_info),
} }
# print "start rendering.." # print "start rendering.."
return render_to_response('discussion/index.html', context) return render_to_response('discussion/index.html', context)
......
<script type="text/template" id="thread-list-template">
<div class="browse-search">
<div class="browse is-open">
<a href="#" class="board-drop-icon"></a>
<a href="#" class="board-drop-btn"><span class="current-board">Homework / Week 1</span> <span class="drop-arrow">▾</span></a>
</div>
<ul class="board-drop-menu">
<li><a href="#"><span class="board-name">All</span> <span class="unread">1,248</span></a></li>
<li><a href="#"><span class="board-name">Following</span></a></li>
<li><a href="#"><span class="board-name">General</span> <span class="unread">124</span></a></li>
<li>
<a href="#"><span class="board-name">Homework</span> <span class="unread">27</span></a>
<ul>
<li><a href="#"><span class="board-name">Week 1</span> <span class="unread">24</span></a></li>
<li>
<a href="#"><span class="board-name">Week 2</span> <span class="unread">27</span></a>
<ul>
<li><a href="#"><span class="board-name">Problem 1</span> <span class="unread">14</span></a></li>
<li><a href="#"><span class="board-name">Problem 2</span> <span class="unread">13</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="search">
<form class="post-search">
<input type="text" placeholder="Search all discussions" class="post-search-field">
</form>
</div>
</div>
<div class="sort-bar">
<span class="sort-label">Sort by:</span>
<ul>
<li><a href="#" class="active" data-sort="date">date</a></li>
<li><a href="#" data-sort="votes">votes</a></li>
<li><a href="#" data-sort="comments">comments</a></li>
</ul>
</div>
<div class="post-list-wrapper">
<ul class="post-list">
</ul>
</div>
</script>
<script type="text/template" id="thread-template">
<article class="discussion-article" data-id="${'<%= id %>'}">
<a href="#" class="dogear"></a>
<div class="discussion-post">
<header>
<a href="#" class="vote-btn discussion-vote discussion-vote-up"><span class="plus-icon">+</span> <span class='votes-count-number'>${'<%= votes["up_count"] %>'}</span></a>
<h1>${'<%= title %>'}</h1>
<p class="posted-details">
<span class="timeago" title="${'<%= created_at %>'}">sometime</span> by
<a href="${'<%= user_id %>'}">${'<%= username %>'}</a>
</p>
</header>
<div class="post-body">
${'<%= body %>'}
</div>
</div>
<ol class="responses">
<li class="loading"><div class="loading-animation"></div></li>
</ol>
<form class="discussion-reply-new">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body"></div>
<div class="reply-post-control">
<a class="discussion-submit-post control-button" href="#">Submit</a>
</div>
</form>
</article>
</script>
<script type="text/template" id="thread-response-template">
<header>
<a href="#" class="vote-btn" data-tooltip="vote"><span class="plus-icon"></span><span class="votes-count-number">${"<%= votes['up_count'] %>"}</span></a>
<a href="#" class="posted-by">${"<%= username %>"}</a>
<p class="posted-details" title="${'<%= created_at %>'}">Sometime</p>
</header>
<div class="response-body">${"<%= body %>"}</div>
<ol class="comments">
<li>
<form class="comment-form">
<input type="text" placeholder="Comment…" class="comment-form-input">
</form>
</li>
</ol>
</script>
<script type="text/template" id="response-comment-template">
<p>${'<%= body %>'}<span class="posted-details">posted <span class="timeago" title="${'<%= created_at %>'}">sometime</span> by <a href="#">${'<%= username %>'}</a></span></p>
</script>
<script type="text/template" id="thread-list-item-template">
<a href="${'<%= id %>'}" data-id="${'<%= id %>'}"><span class="title">${"<%= title %>"}</span> <span class="comments-count">${"<%= comments_count %>"}</span><span class="votes-count">+${"<%= votes['up_count'] %>"}</span></a>
</script>
<%! import django_comment_client.helpers as helpers %> <%! import django_comment_client.helpers as helpers %>
<%! from django.template.defaultfilters import escapejs %>
<%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>
...@@ -12,55 +13,35 @@ ...@@ -12,55 +13,35 @@
<%block name="js_extra"> <%block name="js_extra">
<%include file="_js_body_dependencies.html" /> <%include file="_js_body_dependencies.html" />
<%static:js group='discussion'/> <%static:js group='discussion'/>
<script>
$$contents = {};
$$discussions = {};
$$course_id = "${course_id}";
DiscussionApp = {
start: function() {
window.user = new DiscussionUser(JSON.parse("${user_info | escapejs}"));
var discussion = new Discussion(JSON.parse("${threads | escapejs}"));
new DiscussionRouter({discussion: discussion});
Backbone.history.start({pushState: true, root: "/courses/${course_id}/discussion/forum/"});
}
}
$(document).ready(function() {
DiscussionApp.start();
});
</script>
</%block> </%block>
<%include file="../courseware/course_navigation.html" args="active_page='discussion'" /> <%include file="../courseware/course_navigation.html" args="active_page='discussion'" />
<%include file="_new_discussion_templates.html" />
<section class="container"> <script type="text/javascript" src="${static.url('js/discussions-temp.js')}"></script>
<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">
This page intentionally left blank
</section>
</div>
</section> </section>
<section class="container"> <div class="discussion container">
<div class="course-wrapper"> <div class="discussion-body">
<section aria-label="Course Navigation" class="course-index"> <div class="sidebar"></div>
<nav> <div class="discussion-column"></div>
</div>
<article class="sidebar-module discussion-sidebar"> </div>
<a href="#" class="sidebar-new-post-button">New Post</a>
</article>
<%include file="_recent_active_posts.html" />
<%include file="_trending_tags.html" />
</nav>
</section>
<section class="course-content">
${content.decode('utf-8')}
</section>
</div>
</section>
...@@ -126,101 +126,4 @@ ...@@ -126,101 +126,4 @@
</div> </div>
</div> </div>
<script type="text/template" id="thread-list-template"> <%include file="_new_discussion_templates.html" />
<div class="browse-search"> \ No newline at end of file
<div class="browse is-open">
<a href="#" class="board-drop-icon"></a>
<a href="#" class="board-drop-btn"><span class="current-board">Homework / Week 1</span> <span class="drop-arrow">▾</span></a>
</div>
<ul class="board-drop-menu">
<li><a href="#"><span class="board-name">All</span> <span class="unread">1,248</span></a></li>
<li><a href="#"><span class="board-name">Following</span></a></li>
<li><a href="#"><span class="board-name">General</span> <span class="unread">124</span></a></li>
<li>
<a href="#"><span class="board-name">Homework</span> <span class="unread">27</span></a>
<ul>
<li><a href="#"><span class="board-name">Week 1</span> <span class="unread">24</span></a></li>
<li>
<a href="#"><span class="board-name">Week 2</span> <span class="unread">27</span></a>
<ul>
<li><a href="#"><span class="board-name">Problem 1</span> <span class="unread">14</span></a></li>
<li><a href="#"><span class="board-name">Problem 2</span> <span class="unread">13</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="search">
<form class="post-search">
<input type="text" placeholder="Search all discussions" class="post-search-field">
</form>
</div>
</div>
<div class="sort-bar">
<span class="sort-label">Sort by:</span>
<ul>
<li><a href="#" class="active" data-sort="date">date</a></li>
<li><a href="#" data-sort="votes">votes</a></li>
<li><a href="#" data-sort="comments">comments</a></li>
</ul>
</div>
<div class="post-list-wrapper">
<ul class="post-list">
</ul>
</div>
</script>
<script type="text/template" id="thread-template">
<article class="discussion-article" data-id="${'<%= id %>'}">
<a href="#" class="dogear"></a>
<div class="discussion-post">
<header>
<a href="#" class="vote-btn discussion-vote discussion-vote-up"><span class="plus-icon">+</span> <span class='votes-count-number'>${'<%= votes["up_count"] %>'}</span></a>
<h1>${'<%= title %>'}</h1>
<p class="posted-details">
<span class="timeago" title="${'<%= created_at %>'}">sometime</span> by
<a href="${'<%= user_id %>'}">${'<%= username %>'}</a>
</p>
</header>
<div class="post-body">
${'<%= body %>'}
</div>
</div>
<ol class="responses">
<li class="loading"><div class="loading-animation"></div></li>
</ol>
<form class="discussion-reply-new">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body"></div>
<div class="reply-post-control">
<a class="discussion-submit-post control-button" href="#">Submit</a>
</div>
</form>
</article>
</script>
<script type="text/template" id="thread-response-template">
<header>
<a href="#" class="vote-btn" data-tooltip="vote"><span class="plus-icon"></span><span class="votes-count-number">${"<%= votes['up_count'] %>"}</span></a>
<a href="#" class="posted-by">${"<%= username %>"}</a>
<p class="posted-details" title="${'<%= created_at %>'}">Sometime</p>
</header>
<div class="response-body">${"<%= body %>"}</div>
<ol class="comments">
<li>
<form class="comment-form">
<input type="text" placeholder="Comment…" class="comment-form-input">
</form>
</li>
</ol>
</script>
<script type="text/template" id="response-comment-template">
<p>${'<%= body %>'}<span class="posted-details">posted <span class="timeago" title="${'<%= created_at %>'}">sometime</span> by <a href="#">${'<%= username %>'}</a></span></p>
</script>
<script type="text/template" id="thread-list-item-template">
<a href="${'<%= id %>'}" data-id="${'<%= id %>'}"><span class="title">${"<%= title %>"}</span> <span class="comments-count">${"<%= comments_count %>"}</span><span class="votes-count">+${"<%= votes['up_count'] %>"}</span></a>
</script>
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