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
c44e5276
Commit
c44e5276
authored
Dec 20, 2013
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused forums-related cruft
parent
249a6182
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
5 additions
and
283 deletions
+5
-283
lms/djangoapps/django_comment_client/base/views.py
+5
-7
lms/djangoapps/django_comment_client/forum/views.py
+0
-3
lms/djangoapps/django_comment_client/helpers.py
+0
-19
lms/templates/discussion/_ajax_single_thread.html
+0
-2
lms/templates/discussion/_content_renderer.html
+0
-20
lms/templates/discussion/_forum.html
+0
-26
lms/templates/discussion/_inline.html
+0
-16
lms/templates/discussion/_single_thread.html
+0
-39
lms/templates/discussion/_user_active_threads.html
+0
-16
lms/templates/discussion/ajax_create_comment.html
+0
-3
lms/templates/discussion/ajax_create_thread.html
+0
-3
lms/templates/discussion/ajax_update_comment.html
+0
-3
lms/templates/discussion/ajax_update_thread.html
+0
-3
lms/templates/discussion/mustache/_content.mustache
+0
-72
lms/templates/discussion/mustache/_edit_comment.mustache
+0
-8
lms/templates/discussion/mustache/_edit_thread.mustache
+0
-10
lms/templates/discussion/mustache/_new_post.mustache
+0
-18
lms/templates/discussion/mustache/_reply.mustache
+0
-15
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
c44e5276
...
...
@@ -50,16 +50,14 @@ def permitted(fn):
return
wrapper
def
ajax_content_response
(
request
,
course_id
,
content
,
template_name
):
def
ajax_content_response
(
request
,
course_id
,
content
):
context
=
{
'course_id'
:
course_id
,
'content'
:
content
,
}
html
=
render_to_string
(
template_name
,
context
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
annotated_content_info
=
utils
.
get_annotated_content_info
(
course_id
,
content
,
request
.
user
,
user_info
)
return
JsonResponse
({
'html'
:
html
,
'content'
:
utils
.
safe_content
(
content
),
'annotated_content_info'
:
annotated_content_info
,
})
...
...
@@ -131,7 +129,7 @@ def create_thread(request, course_id, commentable_id):
data
=
thread
.
to_dict
()
add_courseware_context
([
data
],
course
)
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
data
,
'discussion/ajax_create_thread.html'
)
return
ajax_content_response
(
request
,
course_id
,
data
)
else
:
return
JsonResponse
(
utils
.
safe_content
(
data
))
...
...
@@ -147,7 +145,7 @@ def update_thread(request, course_id, thread_id):
thread
.
update_attributes
(
**
extract
(
request
.
POST
,
[
'body'
,
'title'
,
'tags'
]))
thread
.
save
()
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
thread
.
to_dict
()
,
'discussion/ajax_update_thread.html'
)
return
ajax_content_response
(
request
,
course_id
,
thread
.
to_dict
())
else
:
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
...
...
@@ -184,7 +182,7 @@ def _create_comment(request, course_id, thread_id=None, parent_id=None):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
follow
(
comment
.
thread
)
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
()
,
'discussion/ajax_create_comment.html'
)
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
())
else
:
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()))
...
...
@@ -228,7 +226,7 @@ def update_comment(request, course_id, comment_id):
comment
.
update_attributes
(
**
extract
(
request
.
POST
,
[
'body'
]))
comment
.
save
()
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
()
,
'discussion/ajax_update_comment.html'
)
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
())
else
:
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()))
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
c44e5276
...
...
@@ -248,13 +248,10 @@ def single_thread(request, course_id, discussion_id, thread_id):
with
newrelic
.
agent
.
FunctionTrace
(
nr_transaction
,
"get_annotated_content_infos"
):
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
}
# TODO: Remove completely or switch back to server side rendering
# html = render_to_string('discussion/_ajax_single_thread.html', context)
content
=
utils
.
safe_content
(
thread
.
to_dict
())
with
newrelic
.
agent
.
FunctionTrace
(
nr_transaction
,
"add_courseware_context"
):
add_courseware_context
([
content
],
course
)
return
utils
.
JsonResponse
({
#'html': html,
'content'
:
content
,
'annotated_content_info'
:
annotated_content_info
,
})
...
...
lms/djangoapps/django_comment_client/helpers.py
View file @
c44e5276
...
...
@@ -31,22 +31,3 @@ def include_mustache_templates():
file_contents
=
map
(
read_file
,
filter
(
valid_file_name
,
os
.
listdir
(
mustache_dir
)))
return
'
\n
'
.
join
(
map
(
wrap_in_tag
,
map
(
strip_file_name
,
file_contents
)))
def
render_content
(
content
,
additional_context
=
{}):
context
=
{
'content'
:
extend_content
(
content
),
content
[
'type'
]:
True
,
}
if
cc_settings
.
MAX_COMMENT_DEPTH
is
not
None
:
if
content
[
'type'
]
==
'thread'
:
if
cc_settings
.
MAX_COMMENT_DEPTH
<
0
:
context
[
'max_depth'
]
=
True
elif
content
[
'type'
]
==
'comment'
:
if
cc_settings
.
MAX_COMMENT_DEPTH
<=
content
[
'depth'
]:
context
[
'max_depth'
]
=
True
context
=
merge_dict
(
context
,
additional_context
)
partial_mustache_helpers
=
{
k
:
partial
(
v
,
content
)
for
k
,
v
in
mustache_helpers
.
items
()}
context
=
merge_dict
(
context
,
partial_mustache_helpers
)
return
render_mustache
(
'discussion/mustache/_content.mustache'
,
context
)
lms/templates/discussion/_ajax_single_thread.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
${renderer.render_comments(thread.get('children'))}
lms/templates/discussion/_content_renderer.html
deleted
100644 → 0
View file @
249a6182
<
%!
import
django_comment_client
.
helpers
as
helpers
%
>
<
%
def
name=
"render_content(content, *args, **kwargs)"
>
${helpers.render_content(content, *args, **kwargs)}
</
%
def>
<
%
def
name=
"render_content_with_comments(content, *args, **kwargs)"
>
<div
class=
"${content['type'] | h}${' endorsed' if content.get('endorsed') else ''| h}"
_id=
"${content['id'] | h}"
_discussion_id=
"${content.get('commentable_id', '') | h}"
_author_id=
"${content['user_id'] if (not content.get('anonymous')) else '' | h}"
>
${render_content(content, *args, **kwargs)}
${render_comments(content.get('children', []), *args, **kwargs)}
</div>
</
%
def>
<
%
def
name=
"render_comments(comments, *args, **kwargs)"
>
<div
class=
"comments"
>
% for comment in comments:
${render_content_with_comments(comment, *args, **kwargs)}
% endfor
</div>
</
%
def>
lms/templates/discussion/_forum.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion forum-discussion"
_id=
"${discussion_id | h}"
>
<div
class=
"discussion-non-content local"
>
<div
class=
"search-wrapper"
>
<
%
include
file=
"_search_bar.html"
/>
</div>
</div>
% if len(threads) == 0:
<div
class=
"blank"
>
<
%
include
file=
"_blank_slate.html"
/>
</div>
<div
class=
"threads"
></div>
% else:
<
%
include
file=
"_sort.html"
/>
<div
class=
"threads"
>
% for thread in threads:
${renderer.render_content_with_comments(thread)}
% endfor
</div>
<
%
include
file=
"_paginator.html"
/>
% endif
</section>
<
%
include
file=
"_js_data.html"
/>
lms/templates/discussion/_inline.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion inline-discussion"
_id=
"${discussion_id | h}"
>
<div
class=
"discussion-non-content local"
></div>
<div
class=
"threads"
>
% for thread in threads:
${renderer.render_content_with_comments(thread)}
% endfor
</div>
<
%
include
file=
"_paginator.html"
/>
</section>
<
%
include
file=
"_js_data.html"
/>
lms/templates/discussion/_single_thread.html
deleted
100644 → 0
View file @
249a6182
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<
%!
from
django_comment_client
.
mustache_helpers
import
url_for_user
%
>
<article
class=
"discussion-article"
data-id=
"${discussion_id| h}"
>
<a
href=
"#"
class=
"dogear"
></a>
<div
class=
"discussion-post"
>
<header>
%if thread['group_id']:
<div
class=
"group-visibility-label"
>
${_("This post visible only to group {group}.").format(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
class=
"sr"
>
votes (click to vote)
</span></span></a>
<h1>
${thread['title']}
</h1>
<p
class=
"posted-details"
>
<span
class=
"timeago"
title=
"${thread['created_at'] | h}"
>
sometime
</span>
by
<a
href=
"${url_for_user(thread, thread['user_id'])}"
>
${thread['username']}
</a>
</p>
</header>
<div
class=
"post-body"
>
${thread['body']}
</div>
</div>
<ol
class=
"responses"
>
% for reply in thread.get("children", []):
<li>
<div
class=
"response-body"
>
${reply['body']}
</div>
<ol
class=
"comments"
>
% for comment in reply.get("children", []):
<li><div
class=
"comment-body"
>
${comment['body']}
</div></li>
% endfor
</ol>
</li>
% endfor
</ol>
</article>
<
%
include
file=
"_js_data.html"
/>
lms/templates/discussion/_user_active_threads.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion user-active-discussion"
_id=
"${user_id | h}"
>
<div
class=
"discussion-non-content local"
></div>
<div
class=
"threads"
>
% for thread in threads:
${renderer.render_content_with_comments(thread, {'partial_comments': True})}
% endfor
</div>
<
%
include
file=
"_paginator.html"
/>
</section>
<
%
include
file=
"_js_data.html"
/>
lms/templates/discussion/ajax_create_comment.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
${renderer.render_content_with_comments(content)}
lms/templates/discussion/ajax_create_thread.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
${renderer.render_content_with_comments(content)}
lms/templates/discussion/ajax_update_comment.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
${renderer.render_content(content)}
lms/templates/discussion/ajax_update_thread.html
deleted
100644 → 0
View file @
249a6182
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
${renderer.render_content(content)}
lms/templates/discussion/mustache/_content.mustache
deleted
100644 → 0
View file @
249a6182
<div
class=
"discussion-content local
{{#
content
.
roles
}}
role-
{{
name
}}{{/
content
.
roles
}}
"
>
CONTENT MUSTACHE
<div
class=
"discussion-content-wrapper"
>
<div
class=
"discussion-votes"
>
<a
class=
"discussion-vote discussion-vote-up"
href=
"javascript:void(0)"
value=
"up"
>
▲
</a>
<div
class=
"discussion-votes-point"
>
{{
content
.
votes
.
point
}}
<span
class=
"sr"
>
votes (click to vote)
</span></div>
<a
class=
"discussion-vote discussion-vote-down"
href=
"javascript:void(0)"
value=
"down"
>
▼
</a>
</div>
<div
class=
"discussion-right-wrapper"
>
<ul
class=
"admin-actions"
>
<li
style=
"display: none;"
><a
href=
"javascript:void(0)"
class=
"admin-endorse"
>
Endorse
</a></li>
<li
style=
"display: none;"
><a
href=
"javascript:void(0)"
class=
"admin-edit"
>
Edit
</a></li>
<li
style=
"display: none;"
><a
href=
"javascript:void(0)"
class=
"admin-delete"
>
Delete
</a></li>
{{#
thread
}}
<li
style=
"display: none;"
><a
href=
"javascript:void(0)"
class=
"admin-openclose"
>
{{
close_thread_text
}}
</a></li>
{{/
thread
}}
</ul>
{{#
thread
}}
<a
class=
"thread-title"
name=
"
{{
content
.
id
}}
"
href=
"javascript:void(0)"
>
{{
content
.
displayed_title
}}
</a>
{{/
thread
}}
<div
class=
"discussion-content-view"
>
<a
name=
"
{{
content
.
id
}}
"
style=
"width: 0; height: 0; padding: 0; border: none;"
></a>
<div
class=
"content-body
{{
content
.
type
}}
-body"
id=
"content-body-
{{
content
.
id
}}
"
>
{{
content
.
displayed_body
}}
</div>
{{#
thread
}}
<div
class=
"thread-tags"
>
{{#
content
.
tags
}}
<a
class=
"thread-tag"
href=
"
{{#
#
url_for_tags
}}{{
.
}}{{/
url_for_tags
}}
"
>
{{
.
}}
</a>
{{/
content
.
tags
}}
</div>
{{/
thread
}}
<div
class=
"context"
>
{{#
content
.
courseware_location
}}
(this post is about
<a
href=
"../../jump_to/
{{
content
.
courseware_location
}}
"
>
{{
content
.
courseware_title
}}
</a>
)
{{/
content
.
courseware_location
}}
</div>
<div
class=
"info"
>
<div
class=
"comment-time"
>
{{#
content
.
updated
}}
updated
{{/
content
.
updated
}}
<span
class=
"timeago"
title=
"
{{
content
.
updated_at
}}
"
>
{{
content
.
created_at
}}
</span>
by
{{#
content
.
anonymous
}}
anonymous
{{/
content
.
anonymous
}}
{{^
content
.
anonymous
}}
<a
href=
"
{{#
#
url_for_user
}}{{
content
.
user_id
}}{{/
url_for_user
}}
"
class=
"
{{#
content
.
roles
}}
author-
{{
name
}}
{{/
content
.
roles
}}
"
>
{{
content
.
username
}}
</a>
{{/
content
.
anonymous
}}
</div>
<div
class=
"show-comments-wrapper"
>
{{#
thread
}}
{{#
partial_comments
}}
<a
href=
"javascript:void(0)"
class=
"discussion-show-comments first-time"
>
Show all comments (
<span
class=
"comments-count"
>
{{
content
.
comments_count
}}
</span>
total)
</a>
{{/
partial_comments
}}
{{^
partial_comments
}}
<a
href=
"javascript:void(0)"
class=
"discussion-show-comments"
>
Show
<span
class=
"comments-count"
>
{{
content
.
comments_count
}}
</span>
{{#
#
pluralize
}}{{
content
.
comments_count
}}
comment
{{/
pluralize
}}
</a>
{{/
partial_comments
}}
{{/
thread
}}
</div>
<ul
class=
"discussion-actions"
>
{{^
max_depth
}}
<li><a
class=
"discussion-link discussion-reply discussion-reply-
{{
content
.
type
}}
"
href=
"javascript:void(0)"
>
Reply
</a></li>
{{/
max_depth
}}
{{#
thread
}}
<li><div
class=
"follow-wrapper"
><a
class=
"discussion-link discussion-follow-thread"
href=
"javascript:void(0)"
>
Follow
</a></div></li>
{{/
thread
}}
<li><a
class=
"discussion-link discussion-permanent-link"
href=
"
{{
content
.
permalink
}}
"
>
Permanent Link
</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
lms/templates/discussion/mustache/_edit_comment.mustache
deleted
100644 → 0
View file @
249a6182
<form
class=
"discussion-content-edit discussion-comment-edit"
_id=
"
{{
id
}}
"
>
<ul
class=
"discussion-errors discussion-update-errors"
></ul>
<div
class=
"comment-body-edit body-input"
>
{{
body
}}
</div>
<div
class =
"edit-post-control"
>
<a
class=
"discussion-cancel-update"
href=
"javascript:void(0)"
>
Cancel
</a>
<a
class=
"discussion-submit-update control-button"
href=
"javascript:void(0)"
>
Update
</a>
</div>
</form>
lms/templates/discussion/mustache/_edit_thread.mustache
deleted
100644 → 0
View file @
249a6182
<form
class=
"discussion-content-edit discussion-thread-edit"
_id=
"
{{
id
}}
"
>
<ul
class=
"discussion-errors discussion-update-errors"
></ul>
<input
type=
"text"
class=
"thread-title-edit title-input"
placeholder=
"Title"
value=
"
{{
title
}}
"
/>
<div
class=
"thread-body-edit body-input"
>
{{
body
}}
</div>
<input
class=
"thread-tags-edit"
placeholder=
"Tags"
value=
"
{{
tags
}}
"
/>
<div
class =
"edit-post-control"
>
<a
class=
"discussion-cancel-update"
href=
"javascript:void(0)"
>
Cancel
</a>
<a
class=
"discussion-submit-update control-button"
href=
"javascript:void(0)"
>
Update
</a>
</div>
</form>
lms/templates/discussion/mustache/_new_post.mustache
deleted
100644 → 0
View file @
249a6182
<form
class=
"new-post-form collapsed"
id=
"new-post-form"
style=
"display: block; "
>
<ul
class=
"new-post-form-errors discussion-errors"
></ul>
<input
type=
"text"
class=
"new-post-title title-input"
placeholder=
"Title"
/>
<div
class=
"new-post-similar-posts-wrapper"
style=
"display: none"
></div>
<div
class=
"new-post-body reply-body"
></div>
{{! TODO tags: Getting rid of tags for now. }}
{{! <input class="new-post-tags" placeholder="Tags" /> }}
<div
class=
"post-options"
>
<input
type=
"checkbox"
class=
"discussion-post-anonymously"
id=
"discussion-post-anonymously-${discussion_id}"
>
<label
for=
"discussion-post-anonymously-${discussion_id}"
>
post anonymously
</label>
<input
type=
"checkbox"
class=
"discussion-auto-watch"
id=
"discussion-autowatch-${discussion_id}"
checked=
""
>
<label
for=
"discussion-auto-watch-${discussion_id}"
>
follow this thread
</label>
</div>
<div
class=
"new-post-control post-control"
>
<a
class=
"discussion-cancel-post"
href=
"javascript:void(0)"
>
Cancel
</a>
<a
class=
"discussion-submit-post control-button"
href=
"javascript:void(0)"
>
Submit
</a>
</div>
</form>
lms/templates/discussion/mustache/_reply.mustache
deleted
100644 → 0
View file @
249a6182
<form
class=
"discussion-reply-new"
>
<ul
class=
"discussion-errors"
></ul>
<div
class=
"reply-body"
></div>
<input
type=
"checkbox"
class=
"discussion-post-anonymously"
id=
"discussion-post-anonymously-
{{
id
}}
"
/>
<label
for=
"discussion-post-anonymously-
{{
id
}}
"
>
post anonymously
</label>
{{#
showWatchCheckbox
}}
<input
type=
"checkbox"
class=
"discussion-auto-watch"
id=
"discussion-autowatch-
{{
id
}}
"
checked
/>
<label
for=
"discussion-auto-watch-
{{
id
}}
"
>
follow this thread
</label>
{{/
showWatchCheckbox
}}
<br
/>
<div
class=
"reply-post-control"
>
<a
class=
"discussion-cancel-post"
href=
"javascript:void(0)"
>
Cancel
</a>
<a
class=
"discussion-submit-post control-button"
href=
"javascript:void(0)"
>
Submit
</a>
</div>
</form>
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