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
c7a13347
Commit
c7a13347
authored
Feb 05, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inline discussions working
parent
d5b70d7b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
12 deletions
+47
-12
common/static/coffee/src/discussion/discussion_module_view.coffee
+3
-4
common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee
+3
-0
lms/djangoapps/django_comment_client/forum/views.py
+18
-6
lms/templates/discussion/mustache/_inline_discussion.mustache
+0
-1
lms/templates/discussion/mustache/_inline_thread.mustache
+0
-1
lms/templates/discussion/mustache/_inline_thread_cohorted.mustache
+23
-0
No files found.
common/static/coffee/src/discussion/discussion_module_view.coffee
View file @
c7a13347
...
@@ -74,10 +74,9 @@ if Backbone?
...
@@ -74,10 +74,9 @@ if Backbone?
@
discussion
=
new
Discussion
()
@
discussion
=
new
Discussion
()
@
discussion
.
reset
(
response
.
discussion_data
,
{
silent
:
false
})
@
discussion
.
reset
(
response
.
discussion_data
,
{
silent
:
false
})
#rather than have two different templates to get around (or take advantage of?)
#use same discussion template but different thread templated
#mustache's logic free templates, we added a 'group string' to each thread for inline
#determined in the coffeescript based on whether or not there's a
#discussions for the use case where a commentable is cohorted, but a global
#group id
#thread is posted by a TA
$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
})
...
...
common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee
View file @
c7a13347
...
@@ -16,6 +16,9 @@ if Backbone?
...
@@ -16,6 +16,9 @@ if Backbone?
@
$delegateElement
=
@
$local
@
$delegateElement
=
@
$local
render
:
->
render
:
->
if
@
model
.
has
(
'group_id'
)
@
template
=
DiscussionUtil
.
getTemplate
(
"_inline_thread_cohorted"
)
else
@
template
=
DiscussionUtil
.
getTemplate
(
"_inline_thread"
)
@
template
=
DiscussionUtil
.
getTemplate
(
"_inline_thread"
)
if
not
@
model
.
has
(
'abbreviatedBody'
)
if
not
@
model
.
has
(
'abbreviatedBody'
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
c7a13347
...
@@ -61,7 +61,8 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
...
@@ -61,7 +61,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,11 +74,12 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
...
@@ -73,11 +74,12 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
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
#now add the group name if the thread has a group id
for
thread
in
threads
:
for
thread
in
threads
:
if
thread
.
get
(
'group_id'
):
if
thread
.
get
(
'group_id'
):
thread
[
'group_name'
]
=
get_cohort_by_id
(
course_id
,
thread
.
get
(
'group_id'
))
.
name
thread
[
'group_name'
]
=
get_cohort_by_id
(
course_id
,
thread
.
get
(
'group_id'
))
.
name
thread
[
'group_string'
]
=
"This post visible only to Group
${group_name}."
thread
[
'group_string'
]
=
"This post visible only to Group
%
s."
%
(
thread
[
'group_name'
])
else
:
else
:
thread
[
'group_name'
]
=
""
thread
[
'group_name'
]
=
""
thread
[
'group_string'
]
=
"This post visible to everyone."
thread
[
'group_string'
]
=
"This post visible to everyone."
...
@@ -111,6 +113,9 @@ def inline_discussion(request, course_id, discussion_id):
...
@@ -111,6 +113,9 @@ 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
)
is_cohorted
=
is_course_cohorted
(
course_id
)
and
is_commentable_cohorted
(
course_id
,
discussion_id
)
cohorts_list
=
list
()
cohorts_list
=
list
()
...
@@ -118,17 +123,24 @@ def inline_discussion(request, course_id, discussion_id):
...
@@ -118,17 +123,24 @@ def inline_discussion(request, course_id, discussion_id):
if
is_cohorted
:
if
is_cohorted
:
#if you're a mod, send all cohorts and let you pick
#if you're a mod, send all cohorts and let you pick
if
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
)
or
True
:
if
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
):
cohorts
=
get_course_cohorts
(
course_id
)
cohorts
=
get_course_cohorts
(
course_id
)
for
c
in
cohorts
:
for
c
in
cohorts
:
cohorts_list
.
append
({
'name'
:
c
.
name
,
'id'
:
c
.
id
})
cohorts_list
.
append
({
'name'
:
c
.
name
,
'id'
:
c
.
id
})
else
:
else
:
#otherwise, just make a dictionary of two
#otherwise, just make a dictionary of two
user_cohort
=
get_cohort_id
(
user
,
course_id
)
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
})
cohorts_list
.
append
({
'name'
:
'All Groups'
,
'id'
:
None
})
if
user_cohort
:
if
user_cohort
:
cohorts_list
.
append
({
'name'
:
user_cohort
.
name
,
'id'
:
user_cohort
.
id
})
cohorts_list
.
append
({
'name'
:
user_cohort
_name
,
'id'
:
user_cohort_
id
})
else
:
else
:
cohorts_list
=
None
cohorts_list
=
None
...
@@ -297,7 +309,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -297,7 +309,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
'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_course_cohorted'
:
is_course_cohorted
(
course_id
),
'is_moderator'
:
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
)
or
True
,
'is_moderator'
:
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
),
'cohorts'
:
cohorts
,
'cohorts'
:
cohorts
,
'user_cohort'
:
get_cohort_id
(
request
.
user
,
course_id
),
'user_cohort'
:
get_cohort_id
(
request
.
user
,
course_id
),
'cohorted_commentables'
:
cohorted_commentables
'cohorted_commentables'
:
cohorted_commentables
...
...
lms/templates/discussion/mustache/_inline_discussion.mustache
View file @
c7a13347
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
<section
class=
"threads"
>
<section
class=
"threads"
>
{{#
threads
}}
{{#
threads
}}
<div
class=
"group-visibility-label"
>
{{
group_string
}}
</div>
<article
class=
"discussion-thread"
id=
"thread_
{{
id
}}
"
>
<article
class=
"discussion-thread"
id=
"thread_
{{
id
}}
"
>
</article>
</article>
{{/
threads
}}
{{/
threads
}}
...
...
lms/templates/discussion/mustache/_inline_thread.mustache
View file @
c7a13347
<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"
>
...
...
lms/templates/discussion/mustache/_inline_thread_cohorted.mustache
0 → 100644
View file @
c7a13347
<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
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