Commit 0e06f5f5 by Victor Shnayder

Merge remote-tracking branch 'origin/feature/kevin/groups_ui_changes' into…

Merge remote-tracking branch 'origin/feature/kevin/groups_ui_changes' into feature/victor/revert-revert-of-forums-ui
parents 6d9a9ec4 df0b6aca
bc3d29f01b69d55ac4854d80061cfe1e8c5d8ae1
\ No newline at end of file
6b0009534a986740acb3962801d7c2374bdfddc3
\ No newline at end of file
c9f553d4f7af7f08ff349f64af015dd592ecc633
\ No newline at end of file
52650: Locked by 52650 at Tue Feb 05 20:20:57 -0500 2013
---
cursor_positions:
- :path: README
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: doc/README
:cursor_offset: 190
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: doc/overview.md
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: install.txt
:cursor_offset: 665
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: common/djangoapps/track/migrations/0002_auto__add_field_trackinglog_host__chg_field_trackinglog_event_type__ch.py
:cursor_offset: 0
:timestamp: 2013-01-14 18:59:17 -05:00
- :path: lms/djangoapps/django_comment_client/forum/views.pyc
:cursor_offset: 0
:timestamp: 2013-01-23 08:24:35 -05:00
- :path: lms/static/coffee/src/discussion/views/new_post_view.coffee
:cursor_offset: 837
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/djangoapps/courseware/models.py
:cursor_offset: 0
:timestamp: 2013-01-17 22:49:52 -05:00
- :path: lms/djangoapps/django_comment_client/urls.py
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py
:cursor_offset: 1307
:timestamp: 2013-01-24 09:55:25 -05:00
- :path: lms/djangoapps/lms_migration/management/commands/create_groups.py
:cursor_offset: 294
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/djangoapps/courseware/views.py
:cursor_offset: 1520
:timestamp: 2013-01-24 10:18:02 -05:00
- :path: lms/djangoapps/django_comment_client/helpers.py
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/lib/comment_client/commentable.py
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: common/test/data/toy/course.xml
:cursor_offset: 0
:timestamp: 2013-01-23 16:26:06 -05:00
- :path: lms/djangoapps/courseware/tests/tests.py
:cursor_offset: 0
:timestamp: 2013-01-23 16:26:06 -05:00
- :path: lms/lib/comment_client/__init__.py
:cursor_offset: 93
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: doc/development.md
:cursor_offset: 0
:timestamp: 2013-01-23 16:26:06 -05:00
- :path: lms/lib/comment_client/utils.py
:cursor_offset: 487
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/lib/comment_client/comment_client.py
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/djangoapps/django_comment_client/forum/urls.py
:cursor_offset: 428
:timestamp: 2013-01-24 15:17:13 -05:00
- :path: lms/djangoapps/django_comment_client/base/urls.py
:cursor_offset: 2509
:timestamp: 2013-01-24 15:17:13 -05:00
- :path: lms/djangoapps/django_comment_client/permissions.py
:cursor_offset: 301
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/djangoapps/courseware/courses.py
:cursor_offset: 3488
:timestamp: 2013-01-24 15:17:13 -05:00
- :path: lms/envs/dev.py
:cursor_offset: 6251
:timestamp: 2013-01-23 16:26:06 -05:00
:selection_offset: 6256
:block_selection_mode: false
- :path: lms/envs/test.py
:cursor_offset: 4816
:timestamp: 2013-01-24 21:20:55 -05:00
- :path: nosetests.xml
:cursor_offset: 0
:timestamp: 2013-01-24 21:37:16 -05:00
- :path: lms/djangoapps/django_comment_client/tests.py
:cursor_offset: 1271
:timestamp: 2013-01-24 21:43:12 -05:00
- :path: doc/discussion.md
:cursor_offset: 91
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/static/coffee/src/discussion/views/new_post_view.js
:cursor_offset: 5241
:timestamp: 2013-01-25 15:11:10 -05:00
:selection_offset: 5247
:block_selection_mode: false
- :path: lms/static/coffee/src/discussion/views/new_post_inline_vew.js
:cursor_offset: 0
:timestamp: 2013-01-25 15:11:09 -05:00
- :path: doc/xml-format.md
:cursor_offset: 17517
:timestamp: 2013-01-29 18:07:31 -05:00
- :path: common/lib/xmodule/xmodule/course_module.py
:cursor_offset: 14459
:timestamp: 2013-01-29 18:07:31 -05:00
:selection_offset: 14465
:block_selection_mode: false
- :path: common/static/coffee/src/discussion/models/discussion_user.coffee
:cursor_offset: 350
:timestamp: 2013-01-29 18:07:31 -05:00
- :path: common/static/coffee/src/discussion/discussion.coffee
:cursor_offset: 0
:timestamp: 2013-01-29 18:07:31 -05:00
- :path: common/static/coffee/src/discussion/content.coffee
:cursor_offset: 384
:timestamp: 2013-01-29 18:07:31 -05:00
- :path: lms/lib/comment_client/comment.py
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/lib/comment_client/models.py
:cursor_offset: 3281
:timestamp: 2012-12-10 23:45:37 -05:00
- :path: lms/djangoapps/django_comment_client/models.py
:cursor_offset: 0
:timestamp: 2013-01-29 18:07:31 -05:00
- :path: lms/lib/comment_client/thread.py
:cursor_offset: 878
:timestamp: 2013-02-04 14:22:11 -05:00
- :path: lms/templates/discussion/_content_renderer.html
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:38 -05:00
- :path: lms/templates/discussion/_inline_new_post.html
:cursor_offset: 1055
:timestamp: 2013-02-04 16:30:58 -05:00
- :path: common/static/coffee/src/discussion/utils.coffee
:cursor_offset: 316
:timestamp: 2013-02-05 21:29:02 -05:00
- :path: lms/templates/discussion/mustache/_inline_discussion_cohorted.mustache
:cursor_offset: 2158
:timestamp: 2013-02-05 21:17:52 -05:00
- :path: lms/templates/discussion/_single_thread.html
:cursor_offset: 308
:timestamp: 2013-02-06 17:12:07 -05:00
- :path: lms/templates/discussion/mustache/_inline_thread_cohorted.mustache
:cursor_offset: 54
:timestamp: 2013-02-06 17:12:07 -05:00
- :path: lms/templates/discussion/mustache/_inline_thread.mustache
:cursor_offset: 54
:timestamp: 2013-02-05 22:15:01 -05:00
- :path: common/static/coffee/src/discussion/discussion_module_view.coffee
:cursor_offset: 2796
:timestamp: 2013-02-06 17:12:07 -05:00
- :path: lms/templates/discussion/_underscore_templates.html
:cursor_offset: 1315
:timestamp: 2013-02-06 17:31:19 -05:00
- :path: common/djangoapps/course_groups/cohorts.py
:cursor_offset: 2242
:timestamp: 2013-02-06 17:12:09 -05:00
- :path: common/djangoapps/course_groups/views.py
:cursor_offset: 754
:timestamp: 2013-02-06 17:12:09 -05:00
- :path: lms/templates/discussion/_discussion_module.html
:cursor_offset: 0
:timestamp: 2012-12-10 23:45:38 -05:00
- :path: lms/templates/index.html
:cursor_offset: 0
:timestamp: 2013-01-25 15:31:55 -05:00
- :path: lms/djangoapps/django_comment_client/forum/views.py
:cursor_offset: 9415
:timestamp: 2013-02-06 21:34:16 -05:00
:selection_offset: 9420
:block_selection_mode: false
- :path: lms/djangoapps/django_comment_client/base/views.py
:cursor_offset: 1716
:timestamp: 2013-02-06 18:25:59 -05:00
- :path: lms/djangoapps/django_comment_client/utils.py
:cursor_offset: 8664
:timestamp: 2013-02-06 17:12:09 -05:00
:selection_offset: 8672
:block_selection_mode: false
- :path: common/static/coffee/src/discussion/views/new_post_view.coffee
:cursor_offset: 727
:timestamp: 2013-02-06 21:58:14 -05:00
- :path: lms/templates/discussion/index.html
:cursor_offset: 408
:timestamp: 2012-12-10 23:45:38 -05:00
- :path: lms/templates/discussion/_new_post.html
:cursor_offset: 2472
:timestamp: 2013-02-06 21:29:38 -05:00
- :path: common/static/coffee/src/discussion/views/new_post_inline_vew.js
:cursor_offset: 0
:timestamp: 2013-02-06 18:31:50 -05:00
- :path: lms/templates/discussion/_inline.html
:cursor_offset: 318
:timestamp: 2012-12-10 23:45:38 -05:00
- :path: lms/templates/discussion/mustache/_inline_discussion.mustache
:cursor_offset: 1994
:timestamp: 2013-02-07 19:39:13 -05:00
- :path: common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
:cursor_offset: 9947
:timestamp: 2013-02-07 19:14:08 -05:00
- :path: common/static/coffee/src/discussion/views/new_post_inline_vew.coffee
:cursor_offset: 917
:timestamp: 2013-02-06 17:12:07 -05:00
:selection_offset: 922
:block_selection_mode: false
- :path: common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee
:cursor_offset: 1244
:timestamp: 2013-02-06 17:12:07 -05:00
files_to_retain: 0
---
open_files:
- lms/djangoapps/django_comment_client/forum/views.py
---
bounds:
x: 0
y: 22
width: 1366
height: 742
tree_width: 394
This diff is collapsed. Click to expand it.
......@@ -39,6 +39,8 @@ if Backbone?
url = DiscussionUtil.urlFor 'threads'
when 'followed'
url = DiscussionUtil.urlFor 'followed_threads', options.user_id
if options['group_id']
data['group_id'] = options['group_id']
data['sort_key'] = sort_options.sort_key || 'date'
data['sort_order'] = sort_options.sort_order || 'desc'
DiscussionUtil.safeAjax
......
......@@ -70,6 +70,7 @@ if Backbone?
DiscussionUtil.loadRoles(response.roles)
allow_anonymous = response.allow_anonymous
allow_anonymous_to_peers = response.allow_anonymous_to_peers
cohorts = response.cohorts
# $elem.html("Hide Discussion")
@discussion = new Discussion()
@discussion.reset(response.discussion_data, {silent: false})
......@@ -78,8 +79,12 @@ if Backbone?
#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})
if response.is_cohorted
source = "script#_inline_discussion_cohorted"
else
source = "script#_inline_discussion"
$discussion = $(Mustache.render $(source).html(), {'threads':response.discussion_data, 'discussionId': discussionId, 'allow_anonymous_to_peers': allow_anonymous_to_peers, 'allow_anonymous': allow_anonymous, 'cohorts':cohorts})
if @$('section.discussion').length
@$('section.discussion').replaceWith($discussion)
else
......
......@@ -9,6 +9,7 @@ if Backbone?
"click .browse-topic-drop-search-input": "ignoreClick"
"click .post-list .list-item a": "threadSelected"
"click .post-list .more-pages a": "loadMorePages"
"change .cohort-options": "chooseCohort"
'keyup .browse-topic-drop-search-input': DiscussionFilter.filterDrop
initialize: ->
......@@ -128,10 +129,20 @@ if Backbone?
switch @mode
when 'search'
options.search_text = @current_search
if @group_id
options.group_id = @group_id
when 'followed'
options.user_id = window.user.id
options.group_id = "all"
when 'commentables'
options.commentable_ids = @discussionIds
if @group_id
options.group_id = @group_id
when 'all'
if @group_id
options.group_id = @group_id
@collection.retrieveAnotherPage(@mode, options, {sort_key: @sortBy})
renderThread: (thread) =>
......@@ -263,13 +274,21 @@ if Backbone?
if discussionId == "#all"
@discussionIds = ""
@$(".post-search-field").val("")
@$('.cohort').show()
@retrieveAllThreads()
else if discussionId == "#following"
@retrieveFollowed(event)
@$('.cohort').hide()
else
discussionIds = _.map item.find(".board-name[data-discussion_id]"), (board) -> $(board).data("discussion_id").id
@retrieveDiscussions(discussionIds)
chooseCohort: (event) ->
@group_id = @$('.cohort-options :selected').val()
@collection.current_page = 0
@collection.reset()
@loadMorePages(event)
retrieveDiscussion: (discussion_id, callback=null) ->
url = DiscussionUtil.urlFor("retrieve_discussion", discussion_id)
DiscussionUtil.safeAjax
......
......@@ -17,6 +17,11 @@ if Backbone?
@$(".new-post-tags").tagsInput DiscussionUtil.tagsInputOptions()
if @$($(".topic_menu li a")[0]).attr('cohorted') != "True"
$('.choose-cohort').hide();
events:
"submit .new-post-form": "createPost"
"click .topic_dropdown_button": "toggleTopicDropdown"
......
......@@ -61,13 +61,27 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
cc_user.save()
#if the course-user is cohorted, then add the group id
group_id = get_cohort_id(request.user, course_id)
#there are 2 dimensions to consider when executing a search with respect to group id
#is user a moderator
#did the user request a group
#if you're an instructor, show everything
if group_id and not cached_has_permission(request.user, "see_all_cohorts", course_id):
#if the user requested a group explicitly, give them that group, othewrise, if mod, show all, else if student, use cohort
group_id = request.GET.get('group_id')
if group_id == "all":
group_id = None
if not group_id:
if not cached_has_permission(request.user, "see_all_cohorts", course_id):
group_id = get_cohort_id(request.user, course_id)
if group_id:
default_query_params["group_id"] = group_id
#so by default, a moderator sees all items, and a student sees his cohort
query_params = merge_dict(default_query_params,
strip_none(extract(request.GET,
['page', 'sort_key',
......@@ -76,7 +90,6 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
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'):
......@@ -119,11 +132,12 @@ def inline_discussion(request, course_id, discussion_id):
#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)
is_cohorted = is_course_cohorted(course_id) and is_commentable_cohorted(course_id, discussion_id)
cohorts_list = list()
if is_cohorted:
cohorts_list.append({'name':'All Groups','id':None})
#if you're a mod, send all cohorts and let you pick
if cached_has_permission(request.user, "see_all_cohorts", course_id):
......@@ -139,9 +153,7 @@ def inline_discussion(request, course_id, discussion_id):
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:
......@@ -158,7 +170,7 @@ def inline_discussion(request, course_id, discussion_id):
'allow_anonymous_to_peers': allow_anonymous_to_peers,
'allow_anonymous': allow_anonymous,
'cohorts': cohorts_list,
'is_cohorted': is_cohorted
'is_cohorted': is_cohorted
})
......@@ -229,9 +241,9 @@ def forum_form_discussion(request, course_id):
'is_course_cohorted': is_course_cohorted(course_id)
}
# print "start rendering.."
return render_to_response('discussion/index.html', context)
@login_required
def single_thread(request, course_id, discussion_id, thread_id):
course = get_course_with_access(request.user, course_id, 'load')
......
<article class="new-post-article">
<div class="inner-wrapper">
<div class="new-post-form-errors">
<div class="new-post-form-errors">
</div>
<form class="new-post-form">
<div class="left-column">
......@@ -12,6 +12,24 @@
%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>
%endif
%if is_course_cohorted:
<div class="form-group-label choose-cohort">
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 class="right-column">
......
......@@ -47,7 +47,7 @@
<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
%if is_course_cohorted:
<div class="form-group-label choose-cohort" style = "display:none">
<div class="form-group-label choose-cohort">
Make visible to:
<select class="group-filter-select new-post-group" name = "group_id">
<option value="">All Groups</option>
......
......@@ -18,6 +18,17 @@
<li><a href="#" data-sort="votes">votes</a></li>
<li><a href="#" data-sort="comments">comments</a></li>
</ul>
%if is_course_cohorted and is_moderator:
<span class="group-filter-label cohort">Show:</span>
<select class="group-filter-select cohort-options cohort">
<option value="all">All Groups</option>
%for c in cohorts:
<option value="${c.id}">${c.name} and public</option>
%endfor
</select>
%endif
</div>
<div class="post-list-wrapper">
<ul class="post-list">
......
<section class="discussion" data-discussion-id="{{discussionId}}">
<article class="new-post-article">
<span class="topic" data-discussion-id="{{discussionId}}" />
<div class="inner-wrapper">
<div class="new-post-form-errors">
</div>
<form class="new-post-form">
<div class="form-row">
<input type="text" class="new-post-title" name="title" placeholder="Title">
</div>
<div class="form-row">
<div class="new-post-body" name="body" placeholder="Enter your question or comment&hellip;"></div>
<!---<div class="new-post-preview"><span class="new-post-preview-label">Preview</span></div>-->
</div>
{{! TODO tags: Getting rid of tags for now. }}
{{!<div class="form-row">}}
{{! <input type="text" class="new-post-tags" name="tags" placeholder="Tags">}}
{{!</div>}}
<input type="submit" class="submit" value="Add post">
<a href="#" class="new-post-cancel">Cancel</a>
<div class="options">
<input type="checkbox" name="follow" class="discussion-follow" class="discussion-follow" id="new-post-follow" checked><label for="new-post-follow">follow this post</label>
<br>
{{#allow_anonymous}}
<input type="checkbox" name="anonymous" class="discussion-anonymous" id="new-post-anonymous"><label for="new-post-anonymous">post anonymously</label>
{{/allow_anonymous}}
{{#allow_anonymous_to_peers}}
<input type="checkbox" name="anonymous" class="discussion-anonymous-to-peers" id="new-post-anonymous-to-peers"><label for="new-post-anonymous-to-peers">post anonymously to classmates</label>
{{/allow_anonymous_to_peers}}
<div class="form-group-label choose-cohort">
Make visible to:
<select class="group-filter-select new-post-group" name = "group_id">
{{#cohorts}}
<option value="{{id}}">{{name}}</option>
{{/cohorts}}
</select>
</div>
</div>
</form>
</div>
</article>
<section class="threads">
{{#threads}}
<article class="discussion-thread" id="thread_{{id}}">
</article>
{{/threads}}
</section>
<section class="pagination">
</section>
</section>
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