Commit 66889b87 by Victor Shnayder

Merge pull request #1402 from MITx/feature/kevin/groups_ui_changes

Feature/kevin/groups ui changes
parents 0dd9c24e 55c205b9
...@@ -64,7 +64,23 @@ def is_commentable_cohorted(course_id, commentable_id): ...@@ -64,7 +64,23 @@ def is_commentable_cohorted(course_id, commentable_id):
ans)) ans))
return ans return ans
def get_cohorted_commentables(course_id):
"""
Given a course_id return a list of strings representing cohorted commentables
"""
course = courses.get_course_by_id(course_id)
if not course.is_cohorted:
# this is the easy case :)
ans = []
else:
ans = course.cohorted_discussions
return ans
def get_cohort(user, course_id): def get_cohort(user, course_id):
""" """
Given a django User and a course_id, return the user's cohort in that Given a django User and a course_id, return the user's cohort in that
......
...@@ -73,7 +73,13 @@ if Backbone? ...@@ -73,7 +73,13 @@ if Backbone?
# $elem.html("Hide Discussion") # $elem.html("Hide Discussion")
@discussion = new Discussion() @discussion = new Discussion()
@discussion.reset(response.discussion_data, {silent: false}) @discussion.reset(response.discussion_data, {silent: false})
#use same discussion template but different thread templated
#determined in the coffeescript based on whether or not there's a
#group id
$discussion = $(Mustache.render $("script#_inline_discussion").html(), {'threads':response.discussion_data, 'discussionId': discussionId, 'allow_anonymous_to_peers': allow_anonymous_to_peers, 'allow_anonymous': allow_anonymous}) $discussion = $(Mustache.render $("script#_inline_discussion").html(), {'threads':response.discussion_data, 'discussionId': discussionId, 'allow_anonymous_to_peers': allow_anonymous_to_peers, 'allow_anonymous': allow_anonymous})
if @$('section.discussion').length if @$('section.discussion').length
@$('section.discussion').replaceWith($discussion) @$('section.discussion').replaceWith($discussion)
else else
......
...@@ -16,7 +16,10 @@ if Backbone? ...@@ -16,7 +16,10 @@ if Backbone?
@$delegateElement = @$local @$delegateElement = @$local
render: -> render: ->
@template = DiscussionUtil.getTemplate("_inline_thread") if @model.has('group_id')
@template = DiscussionUtil.getTemplate("_inline_thread_cohorted")
else
@template = DiscussionUtil.getTemplate("_inline_thread")
if not @model.has('abbreviatedBody') if not @model.has('abbreviatedBody')
@abbreviateBody() @abbreviateBody()
......
...@@ -25,6 +25,7 @@ if Backbone? ...@@ -25,6 +25,7 @@ if Backbone?
event.preventDefault() event.preventDefault()
title = @$(".new-post-title").val() title = @$(".new-post-title").val()
body = @$(".new-post-body").find(".wmd-input").val() body = @$(".new-post-body").find(".wmd-input").val()
group = @$(".new-post-group option:selected").attr("value")
# TODO tags: commenting out til we know what to do with them # TODO tags: commenting out til we know what to do with them
#tags = @$(".new-post-tags").val() #tags = @$(".new-post-tags").val()
...@@ -45,6 +46,7 @@ if Backbone? ...@@ -45,6 +46,7 @@ if Backbone?
data: data:
title: title title: title
body: body body: body
group_id: group
# TODO tags: commenting out til we know what to do with them # TODO tags: commenting out til we know what to do with them
#tags: tags #tags: tags
......
...@@ -14,8 +14,9 @@ if Backbone? ...@@ -14,8 +14,9 @@ if Backbone?
@setSelectedTopic() @setSelectedTopic()
DiscussionUtil.makeWmdEditor @$el, $.proxy(@$, @), "new-post-body" DiscussionUtil.makeWmdEditor @$el, $.proxy(@$, @), "new-post-body"
@$(".new-post-tags").tagsInput DiscussionUtil.tagsInputOptions() @$(".new-post-tags").tagsInput DiscussionUtil.tagsInputOptions()
events: events:
"submit .new-post-form": "createPost" "submit .new-post-form": "createPost"
"click .topic_dropdown_button": "toggleTopicDropdown" "click .topic_dropdown_button": "toggleTopicDropdown"
...@@ -65,6 +66,11 @@ if Backbone? ...@@ -65,6 +66,11 @@ if Backbone?
@topicText = @getFullTopicName($target) @topicText = @getFullTopicName($target)
@topicId = $target.data('discussion_id') @topicId = $target.data('discussion_id')
@setSelectedTopic() @setSelectedTopic()
if $target.attr('cohorted') == "True"
$('.choose-cohort').show();
else
$('.choose-cohort').hide();
setSelectedTopic: -> setSelectedTopic: ->
@dropdownButton.html(@fitName(@topicText) + ' <span class="drop-arrow">▾</span>') @dropdownButton.html(@fitName(@topicText) + ' <span class="drop-arrow">▾</span>')
...@@ -116,6 +122,7 @@ if Backbone? ...@@ -116,6 +122,7 @@ if Backbone?
title = @$(".new-post-title").val() title = @$(".new-post-title").val()
body = @$(".new-post-body").find(".wmd-input").val() body = @$(".new-post-body").find(".wmd-input").val()
tags = @$(".new-post-tags").val() tags = @$(".new-post-tags").val()
group = @$(".new-post-group option:selected").attr("value")
anonymous = false || @$("input.discussion-anonymous").is(":checked") anonymous = false || @$("input.discussion-anonymous").is(":checked")
anonymous_to_peers = false || @$("input.discussion-anonymous-to-peers").is(":checked") anonymous_to_peers = false || @$("input.discussion-anonymous-to-peers").is(":checked")
...@@ -137,6 +144,7 @@ if Backbone? ...@@ -137,6 +144,7 @@ if Backbone?
anonymous: anonymous anonymous: anonymous
anonymous_to_peers: anonymous_to_peers anonymous_to_peers: anonymous_to_peers
auto_subscribe: follow auto_subscribe: follow
group_id: group
error: DiscussionUtil.formErrorHandler(@$(".new-post-form-errors")) error: DiscussionUtil.formErrorHandler(@$(".new-post-form-errors"))
success: (response, textStatus) => success: (response, textStatus) =>
# TODO: Move this out of the callback, this makes it feel sluggish # TODO: Move this out of the callback, this makes it feel sluggish
......
...@@ -91,23 +91,29 @@ def create_thread(request, course_id, commentable_id): ...@@ -91,23 +91,29 @@ def create_thread(request, course_id, commentable_id):
'user_id': request.user.id, 'user_id': request.user.id,
}) })
user = cc.User.from_django_user(request.user)
#kevinchugh because the new requirement is that all groups will be determined
#by the group id in the request this all goes away
# Cohort the thread if the commentable is cohorted. # Cohort the thread if the commentable is cohorted.
if is_commentable_cohorted(course_id, commentable_id): #if is_commentable_cohorted(course_id, commentable_id):
user_group_id = get_cohort_id(request.user, course_id) # user_group_id = get_cohort_id(user, course_id)
# TODO (vshnayder): once we have more than just cohorts, we'll want to # TODO (vshnayder): once we have more than just cohorts, we'll want to
# change this to a single get_group_for_user_and_commentable function # change this to a single get_group_for_user_and_commentable function
# that can do different things depending on the commentable_id # that can do different things depending on the commentable_id
if cached_has_permission(request.user, "see_all_cohorts", course_id): # if cached_has_permission(request.user, "see_all_cohorts", course_id):
# admins can optionally choose what group to post as # admins can optionally choose what group to post as
group_id = post.get('group_id', user_group_id) # group_id = post.get('group_id', user_group_id)
else: # else:
# regular users always post with their own id. # regular users always post with their own id.
group_id = user_group_id # group_id = user_group_id
if 'group_id' in post.keys():
thread.update_attributes(group_id=group_id) thread.update_attributes(group_id=post['group_id'])
thread.save() thread.save()
print thread
if post.get('auto_subscribe', 'false').lower() == 'true': if post.get('auto_subscribe', 'false').lower() == 'true':
user = cc.User.from_django_user(request.user) user = cc.User.from_django_user(request.user)
user.follow(thread) user.follow(thread)
......
...@@ -11,12 +11,12 @@ from django.contrib.auth.models import User ...@@ -11,12 +11,12 @@ from django.contrib.auth.models import User
from mitxmako.shortcuts import render_to_response, render_to_string from mitxmako.shortcuts import render_to_response, render_to_string
from courseware.courses import get_course_with_access from courseware.courses import get_course_with_access
from course_groups.cohorts import get_cohort_id from course_groups.cohorts import *
from courseware.access import has_access from courseware.access import has_access
from urllib import urlencode from urllib import urlencode
from operator import methodcaller from operator import methodcaller
from django_comment_client.permissions import check_permissions_by_view from django_comment_client.permissions import check_permissions_by_view, cached_has_permission
from django_comment_client.utils import (merge_dict, extract, strip_none, from django_comment_client.utils import (merge_dict, extract, strip_none,
strip_blank, get_courseware_context) strip_blank, get_courseware_context)
...@@ -62,7 +62,8 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG ...@@ -62,7 +62,8 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
#if the course-user is cohorted, then add the group id #if the course-user is cohorted, then add the group id
group_id = get_cohort_id(user, course_id) group_id = get_cohort_id(request.user, course_id)
if group_id: if group_id:
default_query_params["group_id"] = group_id default_query_params["group_id"] = group_id
...@@ -73,6 +74,16 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG ...@@ -73,6 +74,16 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
'tags', 'commentable_ids']))) 'tags', 'commentable_ids'])))
threads, page, num_pages = cc.Thread.search(query_params) threads, page, num_pages = cc.Thread.search(query_params)
#now add the group name if the thread has a group id
for thread in threads:
if thread.get('group_id'):
thread['group_name'] = get_cohort_by_id(course_id, thread.get('group_id')).name
thread['group_string'] = "This post visible only to Group %s." % (thread['group_name'])
else:
thread['group_name'] = ""
thread['group_string'] = "This post visible to everyone."
query_params['page'] = page query_params['page'] = page
query_params['num_pages'] = num_pages query_params['num_pages'] = num_pages
...@@ -81,6 +92,7 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG ...@@ -81,6 +92,7 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
def inline_discussion(request, course_id, discussion_id): def inline_discussion(request, course_id, discussion_id):
""" """
Renders JSON for DiscussionModules Renders JSON for DiscussionModules
""" """
...@@ -89,7 +101,8 @@ def inline_discussion(request, course_id, discussion_id): ...@@ -89,7 +101,8 @@ def inline_discussion(request, course_id, discussion_id):
try: try:
threads, query_params = get_threads(request, course_id, discussion_id, per_page=INLINE_THREADS_PER_PAGE) threads, query_params = get_threads(request, course_id, discussion_id, per_page=INLINE_THREADS_PER_PAGE)
user_info = cc.User.from_django_user(request.user).to_dict() user = cc.User.from_django_user(request.user)
user_info = user.to_dict()
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err:
# TODO (vshnayder): since none of this code seems to be aware of the fact that # TODO (vshnayder): since none of this code seems to be aware of the fact that
# sometimes things go wrong, I suspect that the js client is also not # sometimes things go wrong, I suspect that the js client is also not
...@@ -101,7 +114,39 @@ def inline_discussion(request, course_id, discussion_id): ...@@ -101,7 +114,39 @@ def inline_discussion(request, course_id, discussion_id):
allow_anonymous = course.metadata.get("allow_anonymous", True) allow_anonymous = course.metadata.get("allow_anonymous", True)
allow_anonymous_to_peers = course.metadata.get("allow_anonymous_to_peers", False) allow_anonymous_to_peers = course.metadata.get("allow_anonymous_to_peers", False)
#since inline is all one commentable, only show or allow the choice of cohorts
#if the commentable is cohorted, otherwise everything is not cohorted
#and no one has the option of choosing a cohort
is_cohorted = is_course_cohorted(course_id) and is_commentable_cohorted(course_id, discussion_id)
cohorts_list = list()
if is_cohorted:
#if you're a mod, send all cohorts and let you pick
if cached_has_permission(request.user, "see_all_cohorts", course_id):
cohorts = get_course_cohorts(course_id)
for c in cohorts:
cohorts_list.append({'name':c.name, 'id':c.id})
else:
#otherwise, just make a dictionary of two
user_cohort = get_cohort(user, course_id)
if user_cohort:
user_cohort_name = user_cohort.name
user_cohort_id = user_cohort.id
else:
user_cohort_name = user_cohort_id = None
cohorts_list.append({'name':'All Groups','id':None})
if user_cohort:
cohorts_list.append({'name':user_cohort_name, 'id':user_cohort_id})
else:
cohorts_list = None
return utils.JsonResponse({ return utils.JsonResponse({
'discussion_data': map(utils.safe_content, threads), 'discussion_data': map(utils.safe_content, threads),
'user_info': user_info, 'user_info': user_info,
...@@ -111,11 +156,14 @@ def inline_discussion(request, course_id, discussion_id): ...@@ -111,11 +156,14 @@ def inline_discussion(request, course_id, discussion_id):
'roles': utils.get_role_ids(course_id), 'roles': utils.get_role_ids(course_id),
'allow_anonymous_to_peers': allow_anonymous_to_peers, 'allow_anonymous_to_peers': allow_anonymous_to_peers,
'allow_anonymous': allow_anonymous, 'allow_anonymous': allow_anonymous,
'cohorts': cohorts_list,
'is_cohorted': is_cohorted
}) })
@login_required @login_required
def forum_form_discussion(request, course_id): def forum_form_discussion(request, course_id):
""" """
Renders the main Discussion page, potentially filtered by a search query Renders the main Discussion page, potentially filtered by a search query
""" """
...@@ -129,7 +177,8 @@ def forum_form_discussion(request, course_id): ...@@ -129,7 +177,8 @@ def forum_form_discussion(request, course_id):
log.error("Error loading forum discussion threads: %s" % str(err)) log.error("Error loading forum discussion threads: %s" % str(err))
raise Http404 raise Http404
user_info = cc.User.from_django_user(request.user).to_dict() user = cc.User.from_django_user(request.user)
user_info = user.to_dict()
annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info) annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info)
...@@ -154,6 +203,10 @@ def forum_form_discussion(request, course_id): ...@@ -154,6 +203,10 @@ def forum_form_discussion(request, course_id):
#trending_tags = cc.search_trending_tags( #trending_tags = cc.search_trending_tags(
# course_id, # course_id,
#) #)
cohorts = get_course_cohorts(course_id)
cohorted_commentables = get_cohorted_commentables(course_id)
user_cohort_id = get_cohort_id(request.user, course_id)
context = { context = {
'csrf': csrf(request)['csrf_token'], 'csrf': csrf(request)['csrf_token'],
...@@ -168,6 +221,11 @@ def forum_form_discussion(request, course_id): ...@@ -168,6 +221,11 @@ def forum_form_discussion(request, course_id):
'course_id': course.id, 'course_id': course.id,
'category_map': category_map, 'category_map': category_map,
'roles': saxutils.escape(json.dumps(utils.get_role_ids(course_id)), escapedict), 'roles': saxutils.escape(json.dumps(utils.get_role_ids(course_id)), escapedict),
'is_moderator': cached_has_permission(request.user, "see_all_cohorts", course_id),
'cohorts': cohorts,
'user_cohort': user_cohort_id,
'cohorted_commentables': cohorted_commentables,
'is_course_cohorted': is_course_cohorted(course_id)
} }
# print "start rendering.." # print "start rendering.."
return render_to_response('discussion/index.html', context) return render_to_response('discussion/index.html', context)
...@@ -175,7 +233,6 @@ def forum_form_discussion(request, course_id): ...@@ -175,7 +233,6 @@ def forum_form_discussion(request, course_id):
@login_required @login_required
def single_thread(request, course_id, discussion_id, thread_id): def single_thread(request, course_id, discussion_id, thread_id):
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
cc_user = cc.User.from_django_user(request.user) cc_user = cc.User.from_django_user(request.user)
user_info = cc_user.to_dict() user_info = cc_user.to_dict()
...@@ -189,7 +246,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -189,7 +246,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
if request.is_ajax(): if request.is_ajax():
courseware_context = get_courseware_context(thread, course) courseware_context = get_courseware_context(thread, course)
annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, user_info=user_info) annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, user_info=user_info)
context = {'thread': thread.to_dict(), 'course_id': course_id} context = {'thread': thread.to_dict(), 'course_id': course_id}
# TODO: Remove completely or switch back to server side rendering # TODO: Remove completely or switch back to server side rendering
...@@ -219,6 +276,8 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -219,6 +276,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
courseware_context = get_courseware_context(thread, course) courseware_context = get_courseware_context(thread, course)
if courseware_context: if courseware_context:
thread.update(courseware_context) thread.update(courseware_context)
if thread.get('group_id') and not thread.get('group_name'):
thread['group_name'] = get_cohort_by_id(course_id, thread.get('group_id')).name
threads = [utils.safe_content(thread) for thread in threads] threads = [utils.safe_content(thread) for thread in threads]
...@@ -232,8 +291,11 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -232,8 +291,11 @@ def single_thread(request, course_id, discussion_id, thread_id):
# course_id, # course_id,
#) #)
annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info) annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info)
cohorts = get_course_cohorts(course_id)
cohorted_commentables = get_cohorted_commentables(course_id)
user_cohort = get_cohort_id(request.user, course_id)
context = { context = {
'discussion_id': discussion_id, 'discussion_id': discussion_id,
...@@ -250,6 +312,11 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -250,6 +312,11 @@ def single_thread(request, course_id, discussion_id, thread_id):
'category_map': category_map, 'category_map': category_map,
'roles': saxutils.escape(json.dumps(utils.get_role_ids(course_id)), escapedict), 'roles': saxutils.escape(json.dumps(utils.get_role_ids(course_id)), escapedict),
'thread_pages': query_params['num_pages'], 'thread_pages': query_params['num_pages'],
'is_course_cohorted': is_course_cohorted(course_id),
'is_moderator': cached_has_permission(request.user, "see_all_cohorts", course_id),
'cohorts': cohorts,
'user_cohort': get_cohort_id(request.user, course_id),
'cohorted_commentables': cohorted_commentables
} }
return render_to_response('discussion/single_thread.html', context) return render_to_response('discussion/single_thread.html', context)
......
...@@ -406,7 +406,7 @@ def safe_content(content): ...@@ -406,7 +406,7 @@ def safe_content(content):
'updated_at', 'depth', 'type', 'commentable_id', 'comments_count', 'updated_at', 'depth', 'type', 'commentable_id', 'comments_count',
'at_position_list', 'children', 'highlighted_title', 'highlighted_body', 'at_position_list', 'children', 'highlighted_title', 'highlighted_body',
'courseware_title', 'courseware_url', 'tags', 'unread_comments_count', 'courseware_title', 'courseware_url', 'tags', 'unread_comments_count',
'read', 'read', 'group_id', 'group_name', 'group_string'
] ]
if (content.get('anonymous') is False) and (content.get('anonymous_to_peers') is False): if (content.get('anonymous') is False) and (content.get('anonymous_to_peers') is False):
......
...@@ -11,12 +11,12 @@ class Thread(models.Model): ...@@ -11,12 +11,12 @@ class Thread(models.Model):
'closed', 'tags', 'votes', 'commentable_id', 'username', 'user_id', 'closed', 'tags', 'votes', 'commentable_id', 'username', 'user_id',
'created_at', 'updated_at', 'comments_count', 'unread_comments_count', 'created_at', 'updated_at', 'comments_count', 'unread_comments_count',
'at_position_list', 'children', 'type', 'highlighted_title', 'at_position_list', 'children', 'type', 'highlighted_title',
'highlighted_body', 'endorsed', 'read', 'group_id' 'highlighted_body', 'endorsed', 'read', 'group_id', 'group_name'
] ]
updatable_fields = [ updatable_fields = [
'title', 'body', 'anonymous', 'anonymous_to_peers', 'course_id', 'title', 'body', 'anonymous', 'anonymous_to_peers', 'course_id',
'closed', 'tags', 'user_id', 'commentable_id', 'group_id' 'closed', 'tags', 'user_id', 'commentable_id', 'group_id', 'group_name'
] ]
initializable_fields = updatable_fields initializable_fields = updatable_fields
......
...@@ -169,6 +169,12 @@ body.discussion { ...@@ -169,6 +169,12 @@ body.discussion {
} }
} }
.form-group-label {
display: block;
padding-top: 5px;
color:#fff;
}
.topic_dropdown_button { .topic_dropdown_button {
position: relative; position: relative;
z-index: 1000; z-index: 1000;
...@@ -181,7 +187,7 @@ body.discussion { ...@@ -181,7 +187,7 @@ body.discussion {
.drop-arrow { .drop-arrow {
float: right; float: right;
color: #999; color: #999;
line-height: 36px; line-height: 37px;
} }
} }
...@@ -1020,6 +1026,18 @@ body.discussion { ...@@ -1020,6 +1026,18 @@ body.discussion {
} }
} }
.group-filter-label {
width: 40px;
margin-left:10px;
}
.group-filter-select {
margin: 5px 0px 5px 5px;
width: 80px;
font-size:10px;
background: transparent;
border-color: #ccc;
}
} }
.post-list-wrapper { .post-list-wrapper {
...@@ -1327,6 +1345,8 @@ body.discussion { ...@@ -1327,6 +1345,8 @@ body.discussion {
margin-left: 40px; margin-left: 40px;
} }
.post-tools { .post-tools {
@include clearfix; @include clearfix;
margin-top: 15px; margin-top: 15px;
...@@ -1357,6 +1377,8 @@ body.discussion { ...@@ -1357,6 +1377,8 @@ body.discussion {
margin-bottom: 20px; margin-bottom: 20px;
} }
.responses { .responses {
list-style: none; list-style: none;
margin-top: 40px; margin-top: 40px;
...@@ -2412,3 +2434,11 @@ body.discussion { ...@@ -2412,3 +2434,11 @@ body.discussion {
.discussion-user-threads { .discussion-user-threads {
@extend .discussion-module @extend .discussion-module
} }
.group-visibility-label {
font-size: 12px;
color:#000;
font-style: italic;
background-color:#fff;
}
\ No newline at end of file
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<ul class="browse-topic-drop-menu"> <ul class="browse-topic-drop-menu">
<li> <li>
<a href="#"> <a href="#">
<span class="board-name" data-discussion_id='#all'>All</span> <span class="board-name" data-discussion_id='#all'>Show All Discussions</span>
</a> </a>
</li> </li>
<li> <li>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</%def> </%def>
<%def name="render_entry(entries, entry)"> <%def name="render_entry(entries, entry)">
<li><a href="#" class="topic" data-discussion_id="${entries[entry]['id']}">${entry}</a></li> <li><a href="#" class="topic" data-discussion_id="${entries[entry]['id']}" cohorted = "${entries[entry]['id'] in cohorted_commentables}">${entry}</a></li>
</%def> </%def>
<%def name="render_category(categories, category)"> <%def name="render_category(categories, category)">
...@@ -21,13 +21,14 @@ ...@@ -21,13 +21,14 @@
</li> </li>
</%def> </%def>
<article class="new-post-article"> <article class="new-post-article">
<div class="inner-wrapper"> <div class="inner-wrapper">
<form class="new-post-form"> <form class="new-post-form">
<div class="left-column"> <div class="left-column">
<label>Create new post about:</label> <label>Create new post about:</label>
<div class="form-topic-drop"> <div class="form-topic-drop">
<a href="#" class="topic_dropdown_button">All<span class="drop-arrow"></span></a> <a href="#" class="topic_dropdown_button">Show All Discussions<span class="drop-arrow"></span></a>
<div class="topic_menu_wrapper"> <div class="topic_menu_wrapper">
<div class="topic_menu_search"> <div class="topic_menu_search">
<input type="text" class="form-topic-drop-search-input" placeholder="filter topics"> <input type="text" class="form-topic-drop-search-input" placeholder="filter topics">
...@@ -45,6 +46,24 @@ ...@@ -45,6 +46,24 @@
%elif course.metadata.get("allow_anonymous_to_peers", False): %elif course.metadata.get("allow_anonymous_to_peers", False):
<input type="checkbox" name="anonymous_to_peers" class="discussion-anonymous-to-peers" id="new-post-anonymous-to-peers"><label for="new-post-anonymous-to-peers">post anonymously to classmates</label> <input type="checkbox" name="anonymous_to_peers" class="discussion-anonymous-to-peers" id="new-post-anonymous-to-peers"><label for="new-post-anonymous-to-peers">post anonymously to classmates</label>
%endif %endif
%if is_course_cohorted:
<div class="form-group-label choose-cohort" style = "display:none">
Make visible to:
<select class="group-filter-select new-post-group" name = "group_id">
<option value="">All Groups</option>
%if is_moderator:
%for c in cohorts:
<option value="${c.id}">${c.name}</option>
%endfor
%else:
%if user_cohort:
<option value="${user_cohort}">My Cohort</option>
%endif
%endif
</select>
</div>
%endif
</div> </div>
</div> </div>
<div class="right-column"> <div class="right-column">
......
...@@ -4,7 +4,12 @@ ...@@ -4,7 +4,12 @@
<article class="discussion-article" data-id="${discussion_id| h}"> <article class="discussion-article" data-id="${discussion_id| h}">
<a href="#" class="dogear"></a> <a href="#" class="dogear"></a>
<div class="discussion-post"> <div class="discussion-post">
<header> <header>
%if thread['group_id']
<div class="group-visibility-label">This post visible only to group ${cohort_dictionary[thread['group_id']]}. </div>
%endif
<a href="#" class="vote-btn discussion-vote discussion-vote-up"><span class="plus-icon">+</span> <span class='votes-count-number'>${thread['votes']['up_count']}</span></a> <a href="#" class="vote-btn discussion-vote discussion-vote-up"><span class="plus-icon">+</span> <span class='votes-count-number'>${thread['votes']['up_count']}</span></a>
<h1>${thread['title']}</h1> <h1>${thread['title']}</h1>
<p class="posted-details"> <p class="posted-details">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="browse-search"> <div class="browse-search">
<div class="browse is-open"> <div class="browse is-open">
<a href="#" class="browse-topic-drop-icon"></a> <a href="#" class="browse-topic-drop-icon"></a>
<a href="#" class="browse-topic-drop-btn"><span class="current-board">All</span> <span class="drop-arrow">▾</span></a> <a href="#" class="browse-topic-drop-btn"><span class="current-board">Show All Discussions</span> <span class="drop-arrow">▾</span></a>
</div> </div>
<%include file="_filter_dropdown.html" /> <%include file="_filter_dropdown.html" />
<div class="search"> <div class="search">
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
<div class="discussion-post"> <div class="discussion-post">
<div><a href="javascript:void(0)" class="dogear action-follow" data-tooltip="follow"></a></div> <div><a href="javascript:void(0)" class="dogear action-follow" data-tooltip="follow"></a></div>
<header> <header>
${"<% if (obj.group_id) { %>"}
<div class="group-visibility-label">${"<%- obj.group_string%>"}.</div>
${"<% } %>"}
<a href="#" class="vote-btn discussion-vote discussion-vote-up" data-role="discussion-vote" data-tooltip="vote"><span class="plus-icon">+</span> <span class='votes-count-number'>${'<%- votes["up_count"] %>'}</span></a> <a href="#" class="vote-btn discussion-vote discussion-vote-up" data-role="discussion-vote" data-tooltip="vote"><span class="plus-icon">+</span> <span class='votes-count-number'>${'<%- votes["up_count"] %>'}</span></a>
<h1>${'<%- title %>'}</h1> <h1>${'<%- title %>'}</h1>
<p class="posted-details"> <p class="posted-details">
......
<div class="discussion-content local{{#content.roles}} role-{{name}}{{/content.roles}}"> <div class="discussion-content local{{#content.roles}} role-{{name}}{{/content.roles}}">
CONTENT MUSTACHE
<div class="discussion-content-wrapper"> <div class="discussion-content-wrapper">
<div class="discussion-votes"> <div class="discussion-votes">
<a class="discussion-vote discussion-vote-up" href="javascript:void(0)" value="up">&#9650;</a> <a class="discussion-vote discussion-vote-up" href="javascript:void(0)" value="up">&#9650;</a>
......
<section class="discussion" data-discussion-id="{{discussionId}}"> <section class="discussion" data-discussion-id="{{discussionId}}">
<article class="new-post-article"> <article class="new-post-article">
<span class="topic" data-discussion-id="{{discussionId}}" /> <span class="topic" data-discussion-id="{{discussionId}}" />
<div class="inner-wrapper"> <div class="inner-wrapper">
......
<article class="discussion-article" data-id="{{id}}"> <article class="discussion-article" data-id="{{id}}">
<div class="thread-content-wrapper"></div> <div class="thread-content-wrapper"></div>
<ol class="responses post-extended-content"> <ol class="responses post-extended-content">
......
<article class="discussion-article" data-id="{{id}}">
<div class="group-visibility-label">{{group_string}}</div>
<div class="thread-content-wrapper"></div>
<ol class="responses post-extended-content">
<li class="loading"><div class="loading-animation"></div></li>
</ol>
<form class="local discussion-reply-new post-extended-content" data-id="{{id}}">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body" data-id="{{id}}"></div>
<div class="reply-post-control">
<a class="discussion-submit-post control-button" href="#">Submit</a>
</div>
</form>
<div class="local post-tools">
<a href="javascript:void(0)" class="expand-post">View discussion</a>
<a href="javascript:void(0)" class="collapse-post">Hide discussion</a>
</div>
</article>
\ No newline at end of file
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