fix search
This commit is contained in:
@@ -162,22 +162,22 @@ def forum_form_discussion(request, course_id):
|
||||
'discussion_data': map(utils.safe_content, threads),
|
||||
})
|
||||
else:
|
||||
recent_active_threads = cc.search_recent_active_threads(
|
||||
course_id,
|
||||
recursive=False,
|
||||
query_params={'follower_id': request.user.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,
|
||||
)
|
||||
#trending_tags = cc.search_trending_tags(
|
||||
# course_id,
|
||||
#)
|
||||
escapedict = {'"': '"'}
|
||||
context = {
|
||||
'csrf': csrf(request)['csrf_token'],
|
||||
'course': course,
|
||||
'content': content,
|
||||
'recent_active_threads': recent_active_threads,
|
||||
'trending_tags': trending_tags,
|
||||
#'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),
|
||||
|
||||
@@ -3,7 +3,7 @@ class @DiscussionThreadListView extends Backbone.View
|
||||
events:
|
||||
"click .search": "showSearch"
|
||||
"click .browse": "toggleTopicDrop"
|
||||
"keyup .post-search-field": "performSearch"
|
||||
"keydown .post-search-field": "performSearch"
|
||||
"click .sort-bar a": "sortThreads"
|
||||
"click .browse-topic-drop-menu": "filterTopic"
|
||||
"click .browse-topic-drop-search-input": "ignoreClick"
|
||||
@@ -100,8 +100,9 @@ class @DiscussionThreadListView extends Backbone.View
|
||||
clearTimeout(@timer)
|
||||
@timer = setTimeout(callback, ms)
|
||||
|
||||
performSearch: ->
|
||||
callback = =>
|
||||
performSearch: (event) ->
|
||||
if event.which == 13
|
||||
event.preventDefault()
|
||||
url = DiscussionUtil.urlFor("search")
|
||||
text = @$(".post-search-field").val()
|
||||
DiscussionUtil.safeAjax
|
||||
@@ -112,6 +113,4 @@ class @DiscussionThreadListView extends Backbone.View
|
||||
success: (response, textStatus) =>
|
||||
if textStatus == 'success'
|
||||
@collection.reset(response.discussion_data)
|
||||
@displayedCollection.reset(@collection)
|
||||
|
||||
@delay(callback, 300)
|
||||
@displayedCollection.reset(@collection.models)
|
||||
|
||||
@@ -8,8 +8,6 @@ class @ThreadResponseView extends DiscussionContentView
|
||||
"click .action-endorse": "toggleEndorse"
|
||||
|
||||
render: ->
|
||||
console.log @model
|
||||
console.log @model.toJSON()
|
||||
@$el.html(@template(@model.toJSON()))
|
||||
if window.user.voted(@model)
|
||||
@$(".vote-btn").addClass("is-cast")
|
||||
|
||||
Reference in New Issue
Block a user