Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
fcbd4bd1
Commit
fcbd4bd1
authored
Feb 02, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
produce and consume group_id from dropdowns
parent
8fd32ed5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
14 deletions
+17
-14
lms/djangoapps/django_comment_client/base/views.py
+14
-9
lms/djangoapps/django_comment_client/forum/views.py
+0
-2
lms/djangoapps/django_comment_client/utils.py
+1
-1
lms/templates/discussion/_new_post.html
+1
-1
lms/templates/discussion/_underscore_templates.html
+1
-1
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
fcbd4bd1
...
@@ -86,27 +86,32 @@ def create_thread(request, course_id, commentable_id):
...
@@ -86,27 +86,32 @@ def create_thread(request, course_id, commentable_id):
'anonymous_to_peers'
:
anonymous_to_peers
,
'anonymous_to_peers'
:
anonymous_to_peers
,
'commentable_id'
:
commentable_id
,
'commentable_id'
:
commentable_id
,
'course_id'
:
course_id
,
'course_id'
:
course_id
,
'user_id'
:
request
.
user
.
id
,
'user_id'
:
request
.
user
.
id
})
})
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
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
(
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
thread
.
update_attributes
(
group_id
=
group_id
)
if
post
[
'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
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
fcbd4bd1
...
@@ -178,8 +178,6 @@ def forum_form_discussion(request, course_id):
...
@@ -178,8 +178,6 @@ def forum_form_discussion(request, course_id):
'is_course_cohorted'
:
is_course_cohorted
(
course_id
)
'is_course_cohorted'
:
is_course_cohorted
(
course_id
)
}
}
# print "start rendering.."
# print "start rendering.."
print
"
\n\n\n\n
*******************************"
print
context
return
render_to_response
(
'discussion/index.html'
,
context
)
return
render_to_response
(
'discussion/index.html'
,
context
)
@login_required
@login_required
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
fcbd4bd1
...
@@ -374,7 +374,7 @@ def safe_content(content):
...
@@ -374,7 +374,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'
]
]
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
):
...
...
lms/templates/discussion/_new_post.html
View file @
fcbd4bd1
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
<div
class=
"form-group-label choose-cohort"
>
<div
class=
"form-group-label choose-cohort"
>
Make visible to:
Make visible to:
<select
class=
"group-filter-select new-post-group"
name =
"group_id"
>
<select
class=
"group-filter-select new-post-group"
name =
"group_id"
>
<option
>
All Groups
</option>
<option
value=
""
>
All Groups
</option>
%if is_moderator:
%if is_moderator:
%for c in cohorts:
%for c in cohorts:
<option
value=
"${c.id}"
>
${c.name}
</option>
<option
value=
"${c.id}"
>
${c.name}
</option>
...
...
lms/templates/discussion/_underscore_templates.html
View file @
fcbd4bd1
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<
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
thread
[
'group_id'
]
%
if
group_id
:
<
div
class
=
"group-visibility-label"
>
This
post
visible
only
to
Group
$
{
cohort_dictionary
[
thread
[
'group_id'
]]}.
<
/div
>
<
div
class
=
"group-visibility-label"
>
This
post
visible
only
to
Group
$
{
cohort_dictionary
[
thread
[
'group_id'
]]}.
<
/div
>
%
endif
%
endif
<
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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment