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
0375710d
Commit
0375710d
authored
Aug 02, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i meant sort before...this time it's search ajax
parent
7b65663e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
19 deletions
+44
-19
lms/djangoapps/django_comment_client/forum/views.py
+1
-3
lms/static/coffee/src/discussion.coffee
+28
-6
lms/templates/discussion/_forum.html
+4
-2
lms/templates/discussion/_inline.html
+2
-2
lms/templates/discussion/_search_bar.html
+9
-6
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
0375710d
...
...
@@ -41,7 +41,7 @@ def render_accordion(request, course, discussion_id):
return
render_to_string
(
'discussion/_accordion.html'
,
context
)
def
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
None
,
with_search_bar
=
True
,
\
def
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
None
,
\
discussion_type
=
'inline'
,
query_params
=
{}):
template
=
{
...
...
@@ -57,8 +57,6 @@ def render_discussion(request, course_id, threads, discussion_id=None, with_sear
context
=
{
'threads'
:
threads
,
'discussion_id'
:
discussion_id
,
'search_bar'
:
''
if
not
with_search_bar
\
else
render_search_bar
(
request
,
course_id
,
discussion_id
,
text
=
query_params
.
get
(
'text'
,
''
)),
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'course_id'
:
course_id
,
'request'
:
request
,
...
...
lms/static/coffee/src/discussion.coffee
View file @
0375710d
...
...
@@ -527,8 +527,25 @@ Discussion =
handleCancelNewPost
(
this
)
$
(
elem
).
hide
()
handleAjaxSearch
=
(
elem
)
->
console
.
log
$
(
elem
).
attr
(
"action"
)
$elem
=
$
(
elem
)
$discussionModule
=
$elem
.
parents
(
".discussion-module"
)
$discussion
=
$discussionModule
.
find
(
".discussion"
)
Discussion
.
safeAjax
$elem
:
$elem
url
:
$elem
.
attr
(
"action"
)
data
:
text
:
$local
(
".search-input"
).
val
()
method
:
"GET"
success
:
(
data
,
textStatus
)
->
$discussion
.
replaceWith
(
data
)
$discussion
=
$discussionModule
.
find
(
".discussion"
)
Discussion
.
initializeDiscussion
(
$discussion
)
Discussion
.
bindDiscussionEvents
(
$discussion
)
dataType
:
'html'
handleSort
=
(
elem
)
->
handle
Ajax
Sort
=
(
elem
)
->
$elem
=
$
(
elem
)
$discussionModule
=
$elem
.
parents
(
".discussion-module"
)
$discussion
=
$discussionModule
.
find
(
".discussion"
)
...
...
@@ -543,7 +560,7 @@ Discussion =
Discussion
.
bindDiscussionEvents
(
$discussion
)
dataType
:
'html'
$local
(
".discussion-search-form"
).
submit
(
event
)
->
$local
(
".
search-wrapper-forum > .
discussion-search-form"
).
submit
(
event
)
->
event
.
preventDefault
()
text
=
$local
(
".search-input"
).
val
()
isSearchWithinBoard
=
$local
(
".discussion-search-within-board"
).
is
(
":checked"
)
...
...
@@ -552,11 +569,16 @@ Discussion =
$local
(
".discussion-new-post"
).
click
->
handleNewPost
(
this
)
$local
(
".discussion-search"
).
click
->
$local
(
".new-post-form"
).
submit
()
$local
(
".discussion-search-link"
).
click
->
handleAjaxSearch
(
this
)
$local
(
".search-wrapper-inline > .discussion-search-form"
).
submit
(
e
)
->
e
.
preventDefault
()
handleAjaxSearch
(
this
)
$local
(
".discussion-inline-sort-link"
).
click
->
handleAjaxSort
(
this
)
$discussion
.
children
(
".discussion-sort"
).
find
(
".discussion-inline-sort-link"
).
click
->
handleSort
(
this
)
$discussion
.
find
(
".thread"
).
each
(
index
,
thread
)
->
Discussion
.
initializeContent
(
thread
)
...
...
lms/templates/discussion/_forum.html
View file @
0375710d
...
...
@@ -5,14 +5,16 @@
<div
class=
"discussion-title-wrapper"
>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
</div>
${search_bar}
<div
class=
"search-wrapper-forum"
>
<
%
include
file=
"_search_bar.html"
/>
</div>
<div
class=
"search-within"
>
<input
type=
"checkbox"
id=
"discussion-search-within-board-${discussion_id}"
class=
"discussion-search-within-board"
checked
/>
<label
for=
"discussion-search-within-board-${discussion_id}"
class=
"discussion-search-within-board"
>
Search within board
</label>
</div>
<div
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</div>
<
%
include
file=
"_sort.html"
/>
</div>
<
%
include
file=
"_sort.html"
/>
% for thread in threads:
${renderer.render_thread(course_id, thread, edit_thread=False, show_comments=False)}
% endfor
...
...
lms/templates/discussion/_inline.html
View file @
0375710d
...
...
@@ -3,11 +3,11 @@
<section
class=
"discussion inline-discussion"
_id=
"${discussion_id}"
>
<div
class=
"discussion-non-content"
>
<div
class=
"search-wrapper-inline"
>
${search_bar}
<
%
include
file=
"_search_bar.html"
/>
</div>
<div
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</div>
<
%
include
file=
"_sort.html"
/>
</div>
<
%
include
file=
"_sort.html"
/>
% for thread in threads:
${renderer.render_thread(course_id, thread, edit_thread=False, show_comments=False)}
% endfor
...
...
lms/templates/discussion/_search_bar.html
View file @
0375710d
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%!
from
urllib
import
urlencode
%
>
<
%
def
url_for_search
()
:
return
reverse
('
django_comment_client
.
forum
.
views
.
search
',
args=
[course_id])
def
merge
(
dic1
,
dic2
)
:
return
dict
(
dic1
.
items
()
+
dic2
.
items
())
def
base_url_for_search
()
:
return
base_url
+
'?'
+
urlencode
(
merge
(
query_params
,
{'
page
'
:
1
}))
%
>
<form
action=
"${url_for_search()}"
method=
"get"
class=
"discussion-search-form"
>
<form
action=
"${
base_
url_for_search()}"
method=
"get"
class=
"discussion-search-form"
>
<input
class=
"search-input"
type=
"text"
value=
"${text}"
id=
"keywords"
autocomplete=
"off"
/>
<div
class=
"discussion-link"
href=
"javascript:void(0)"
>
Search posts
</div>
<div
class=
"discussion-link
discussion-search-link
"
href=
"javascript:void(0)"
>
Search posts
</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