forum view for discussions
This commit is contained in:
@@ -16,13 +16,14 @@ class DiscussionModule(XModule):
|
||||
'parse': dateutil.parser.parse,
|
||||
'commentable_id': self.discussion_id,
|
||||
}
|
||||
return self.system.render_template('discussion.html', context)
|
||||
return self.system.render_template('discussion/inline.html', context)
|
||||
|
||||
def __init__(self, system, location, definition, instance_state=None, shared_state=None, **kwargs):
|
||||
XModule.__init__(self, system, location, definition, instance_state, shared_state, **kwargs)
|
||||
xml_data = etree.fromstring(definition['data'])
|
||||
self.discussion_id = xml_data.attrib['id']
|
||||
self.title = xml_data.attrib['for']
|
||||
self.category = xml_data.attrib['category']
|
||||
|
||||
class DiscussionDescriptor(RawDescriptor):
|
||||
module_class = DiscussionModule
|
||||
|
||||
1
lms/djangoapps/django_comment_client
Symbolic link
1
lms/djangoapps/django_comment_client
Symbolic link
@@ -0,0 +1 @@
|
||||
/Users/dementrock/coding/cs_comments_client_python/djangoapp
|
||||
1
lms/lib/datehelper
Symbolic link
1
lms/lib/datehelper
Symbolic link
@@ -0,0 +1 @@
|
||||
/Users/dementrock/coding/datehelper
|
||||
@@ -3,6 +3,16 @@ $ ->
|
||||
#DEBUG = true
|
||||
DEBUG = false
|
||||
|
||||
if $('#accordion').length
|
||||
active = $('#accordion ul:has(li.active)').index('#accordion ul')
|
||||
$('#accordion').bind('accordionchange', @log).accordion
|
||||
active: if active >= 0 then active else 1
|
||||
header: 'h3'
|
||||
autoHeight: false
|
||||
$('#open_close_accordion a').click @toggle
|
||||
|
||||
$('#accordion').show()
|
||||
|
||||
$(".discussion-title").click ->
|
||||
$thread = $(this).parent().children(".thread")
|
||||
if $thread.css("display") == "none"
|
||||
@@ -103,7 +113,7 @@ $ ->
|
||||
return
|
||||
$edit = $div.children(".discussion-content").find(".comment-edit")
|
||||
body = $edit.val()
|
||||
$.post url, {body: body}, handleAnchorAndReload(response, textStatus) ->
|
||||
$.post url, {body: body}, (response, textStatus) ->
|
||||
if textStatus == "success"
|
||||
handleAnchorAndReload(response)
|
||||
console.log response
|
||||
|
||||
@@ -16,6 +16,13 @@ $discussion_input_width: 60%;
|
||||
}
|
||||
}
|
||||
|
||||
.course-content {
|
||||
.discussion {
|
||||
margin-left: 40px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.discussion {
|
||||
.discussion-title {
|
||||
@include discussion-font;
|
||||
|
||||
@@ -15,7 +15,7 @@ def url_class(url):
|
||||
<li class="info"><a href="${reverse('info', args=[course.id])}" class="${url_class('info')}">Course Info</a></li>
|
||||
% if user.is_authenticated():
|
||||
<li class="book"><a href="${reverse('book', args=[course.id])}" class="${url_class('book')}">Textbook</a></li>
|
||||
<li class="discussion"><a href="${reverse('questions')}">Discussion</a></li>
|
||||
<li class="discussion"><a href="${reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id.replace('/', '-'), 'general'])}" class="${url_class('discussion')}">Discussion</a></li>
|
||||
% endif
|
||||
<li class="wiki"><a href="${reverse('wiki_root', args=[course.id])}" class="${url_class('wiki')}">Wiki</a></li>
|
||||
% if user.is_authenticated():
|
||||
|
||||
26
lms/templates/discussion/accordion.html
Normal file
26
lms/templates/discussion/accordion.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
|
||||
<%
|
||||
def url_for(board):
|
||||
if board['category'] == 'General':
|
||||
return reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id.replace('/', '-'), 'general'])
|
||||
else:
|
||||
return reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id.replace('/', '-'), board['discussion_id']])
|
||||
%>
|
||||
|
||||
<%def name="make_category(category, boards)">
|
||||
<h3><a href="#">${category}</a></h3>
|
||||
|
||||
<ul>
|
||||
% for board in boards:
|
||||
<li${' class="active"' if active == board['discussion_id'] else ''}>
|
||||
<a href="${url_for(board)}">
|
||||
<p>${board['title']}</p>
|
||||
</a>
|
||||
% endfor
|
||||
</ul>
|
||||
</%def>
|
||||
|
||||
% for category, boards in discussion_info.items():
|
||||
${make_category(category, boards)}
|
||||
% endfor
|
||||
39
lms/templates/discussion/index.html
Normal file
39
lms/templates/discussion/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<%inherit file="../main.html" />
|
||||
<%namespace name='static' file='../static_content.html'/>
|
||||
<%block name="bodyclass">courseware discussion</%block>
|
||||
<%block name="title"><title>Discussion – MITx 6.002x</title></%block>
|
||||
|
||||
<%block name="headextra">
|
||||
<script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script>
|
||||
</%block>
|
||||
|
||||
<%block name="js_extra">
|
||||
<!-- TODO: http://docs.jquery.com/Plugins/Validation -->
|
||||
<script type="text/javascript">
|
||||
document.write('\x3Cscript type="text/javascript" src="' +
|
||||
document.location.protocol + '//www.youtube.com/player_api">\x3C/script>');
|
||||
</script>
|
||||
</%block>
|
||||
|
||||
<%include file="../course_navigation.html" args="active_page='discussion'" />
|
||||
|
||||
<section class="container">
|
||||
<div class="course-wrapper">
|
||||
<section aria-label="Course Navigation" class="course-index">
|
||||
<header id="open_close_accordion">
|
||||
<h2>Discussion Boards</h2>
|
||||
<a href="#">close</a>
|
||||
</header>
|
||||
<div id="accordion" style="display:none">
|
||||
<nav>
|
||||
${accordion}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="course-content">
|
||||
${content}
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user