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
72f84c97
Commit
72f84c97
authored
Sep 04, 2012
by
Arjun Singh
Committed by
Matthew Mongeau
Sep 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix search
parent
65cbbc50
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
103 deletions
+34
-103
lms/djangoapps/django_comment_client/forum/views.py
+29
-95
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+5
-6
lms/static/coffee/src/discussion/views/thread_response_view.coffee
+0
-2
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
72f84c97
...
@@ -148,7 +148,6 @@ def get_threads(request, course_id, discussion_id=None):
...
@@ -148,7 +148,6 @@ def get_threads(request, course_id, discussion_id=None):
# discussion per page is fixed for now
# discussion per page is fixed for now
def
inline_discussion
(
request
,
course_id
,
discussion_id
):
def
inline_discussion
(
request
,
course_id
,
discussion_id
):
<<<<<<<
HEAD
try
:
try
:
threads
,
query_params
=
get_threads
(
request
,
course_id
,
discussion_id
)
threads
,
query_params
=
get_threads
(
request
,
course_id
,
discussion_id
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
...
@@ -185,41 +184,26 @@ def forum_form_discussion(request, course_id):
...
@@ -185,41 +184,26 @@ def forum_form_discussion(request, course_id):
def
infogetter
(
thread
):
def
infogetter
(
thread
):
return
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
)
return
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
)
annotated_content_info
=
reduce
(
merge_dict
,
map
(
infogetter
,
threads
),
{})
if
request
.
is_ajax
():
return
utils
.
JsonResponse
({
if
request
.
is_ajax
():
'html'
:
content
,
return
utils
.
JsonResponse
({
'discussion_data'
:
map
(
utils
.
safe_content
,
threads
),
'html'
:
content
,
})
'discussion_data'
:
map
(
utils
.
safe_content
,
threads
),
else
:
})
escapedict
=
{
'"'
:
'"'
}
else
:
context
=
{
recent_active_threads
=
cc
.
search_recent_active_threads
(
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
course_id
,
'course'
:
course
,
recursive
=
False
,
'content'
:
content
,
query_params
=
{
'follower_id'
:
request
.
user
.
id
},
'staff_access'
:
has_access
(
request
.
user
,
course
,
'staff'
),
)
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
trending_tags
=
cc
.
search_trending_tags
(
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
course_id
,
'course_id'
:
course
.
id
,
)
'category_map'
:
category_map
,
escapedict
=
{
'"'
:
'"'
}
}
context
=
{
# print "start rendering.."
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
return
render_to_response
(
'discussion/index.html'
,
context
)
'course'
:
course
,
'content'
:
content
,
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
'staff_access'
:
has_access
(
request
.
user
,
course
,
'staff'
),
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'course_id'
:
course
.
id
,
'category_map'
:
category_map
,
}
# print "start rendering.."
return
render_to_response
(
'discussion/index.html'
,
context
)
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
raise
Http404
def
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
):
def
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
):
...
@@ -244,7 +228,6 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
...
@@ -244,7 +228,6 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
def
single_thread
(
request
,
course_id
,
discussion_id
,
thread_id
):
def
single_thread
(
request
,
course_id
,
discussion_id
,
thread_id
):
<<<<<<<
HEAD
try
:
try
:
if
request
.
is_ajax
():
if
request
.
is_ajax
():
...
@@ -276,80 +259,31 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -276,80 +259,31 @@ def single_thread(request, course_id, discussion_id, thread_id):
)
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
escapedict
=
{
'"'
:
'"'
}
def
infogetter
(
thread
):
return
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
)
annotated_content_info
=
reduce
(
merge_dict
,
map
(
infogetter
,
threads
),
{})
context
=
{
context
=
{
'discussion_id'
:
discussion_id
,
'discussion_id'
:
discussion_id
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'init'
:
''
,
'user_info'
:
json
.
dumps
(
user_info
),
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
'
content'
:
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
),
'
annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'course'
:
course
,
'course'
:
course
,
'recent_active_threads'
:
recent_active_threads
,
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
'trending_tags'
:
trending_tags
,
'course_id'
:
course
.
id
,
'course_id'
:
course
.
id
,
'thread_id'
:
thread_id
,
'thread_id'
:
thread_id
,
'threads'
:
json
.
dumps
(
threads
),
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
'category_map'
:
category_map
,
'category_map'
:
category_map
,
}
}
return
render_to_response
(
'discussion/single_thread.html'
,
context
)
return
render_to_response
(
'discussion/single_thread.html'
,
context
)
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
raise
Http404
raise
Http404
=======
if
request
.
is_ajax
():
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
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
}
html
=
render_to_string
(
'discussion/_ajax_single_thread.html'
,
context
)
return
utils
.
JsonResponse
({
'html'
:
html
,
'content'
:
utils
.
safe_content
(
thread
.
to_dict
()),
'annotated_content_info'
:
annotated_content_info
,
})
else
:
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
category_map
=
utils
.
get_discussion_category_map
(
course
)
threads
,
query_params
=
get_threads
(
request
,
course_id
)
recent_active_threads
=
cc
.
search_recent_active_threads
(
course_id
,
recursive
=
False
,
query_params
=
{
'follower_id'
:
request
.
user
.
id
},
)
trending_tags
=
cc
.
search_trending_tags
(
course_id
,
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
escapedict
=
{
'"'
:
'"'
}
def
infogetter
(
thread
):
return
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
)
annotated_content_info
=
reduce
(
merge_dict
,
map
(
infogetter
,
threads
),
{})
context
=
{
'discussion_id'
:
discussion_id
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'course'
:
course
,
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
'course_id'
:
course
.
id
,
'thread_id'
:
thread_id
,
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
'category_map'
:
category_map
,
}
return
render_to_response
(
'discussion/single_thread.html'
,
context
)
>>>>>>>
fit
permission
into
new
discussion
view
structure
;
admin
actions
not
working
yet
def
user_profile
(
request
,
course_id
,
user_id
):
def
user_profile
(
request
,
course_id
,
user_id
):
...
...
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
72f84c97
...
@@ -3,7 +3,7 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -3,7 +3,7 @@ class @DiscussionThreadListView extends Backbone.View
events
:
events
:
"click .search"
:
"showSearch"
"click .search"
:
"showSearch"
"click .browse"
:
"toggleTopicDrop"
"click .browse"
:
"toggleTopicDrop"
"key
up
.post-search-field"
:
"performSearch"
"key
down
.post-search-field"
:
"performSearch"
"click .sort-bar a"
:
"sortThreads"
"click .sort-bar a"
:
"sortThreads"
"click .browse-topic-drop-menu"
:
"filterTopic"
"click .browse-topic-drop-menu"
:
"filterTopic"
"click .browse-topic-drop-search-input"
:
"ignoreClick"
"click .browse-topic-drop-search-input"
:
"ignoreClick"
...
@@ -100,8 +100,9 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -100,8 +100,9 @@ class @DiscussionThreadListView extends Backbone.View
clearTimeout
(
@
timer
)
clearTimeout
(
@
timer
)
@
timer
=
setTimeout
(
callback
,
ms
)
@
timer
=
setTimeout
(
callback
,
ms
)
performSearch
:
->
performSearch
:
(
event
)
->
callback
=
=>
if
event
.
which
==
13
event
.
preventDefault
()
url
=
DiscussionUtil
.
urlFor
(
"search"
)
url
=
DiscussionUtil
.
urlFor
(
"search"
)
text
=
@
$
(
".post-search-field"
).
val
()
text
=
@
$
(
".post-search-field"
).
val
()
DiscussionUtil
.
safeAjax
DiscussionUtil
.
safeAjax
...
@@ -112,6 +113,4 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -112,6 +113,4 @@ class @DiscussionThreadListView extends Backbone.View
success
:
(
response
,
textStatus
)
=>
success
:
(
response
,
textStatus
)
=>
if
textStatus
==
'success'
if
textStatus
==
'success'
@
collection
.
reset
(
response
.
discussion_data
)
@
collection
.
reset
(
response
.
discussion_data
)
@
displayedCollection
.
reset
(
@
collection
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
@
delay
(
callback
,
300
)
lms/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
72f84c97
...
@@ -8,8 +8,6 @@ class @ThreadResponseView extends DiscussionContentView
...
@@ -8,8 +8,6 @@ class @ThreadResponseView extends DiscussionContentView
"click .action-endorse"
:
"toggleEndorse"
"click .action-endorse"
:
"toggleEndorse"
render
:
->
render
:
->
console
.
log
@
model
console
.
log
@
model
.
toJSON
()
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
if
window
.
user
.
voted
(
@
model
)
if
window
.
user
.
voted
(
@
model
)
@
$
(
".vote-btn"
).
addClass
(
"is-cast"
)
@
$
(
".vote-btn"
).
addClass
(
"is-cast"
)
...
...
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