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
6ee27d02
Commit
6ee27d02
authored
Aug 30, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Searching and fixes.
parent
3cc3876b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
68 deletions
+118
-68
lms/djangoapps/django_comment_client/forum/views.py
+1
-1
lms/static/coffee/src/discussion/content.coffee
+16
-0
lms/static/coffee/src/discussion/discussion_router.coffee
+4
-3
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+40
-2
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
+5
-7
lms/static/js/discussions-temp.js
+11
-12
lms/templates/discussion/single_thread.html
+41
-43
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
6ee27d02
...
@@ -20,7 +20,7 @@ import django_comment_client.utils as utils
...
@@ -20,7 +20,7 @@ import django_comment_client.utils as utils
import
comment_client
as
cc
import
comment_client
as
cc
THREADS_PER_PAGE
=
5
THREADS_PER_PAGE
=
5
0000
PAGES_NEARBY_DELTA
=
2
PAGES_NEARBY_DELTA
=
2
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
6ee27d02
...
@@ -427,6 +427,22 @@ if Backbone?
...
@@ -427,6 +427,22 @@ if Backbone?
unfollow
:
->
unfollow
:
->
@
trigger
"thread:unfollow"
@
trigger
"thread:unfollow"
display_body
:
->
if
@
has
(
"highlighted_body"
)
@
get
(
"highlighted_body"
)
else
@
get
(
"body"
)
display_title
:
->
if
@
has
(
"highlighted_title"
)
@
get
(
"highlighted_title"
)
else
@
get
(
"title"
)
toJSON
:
->
json_attributes
=
_
.
clone
(
@
attributes
)
_
.
extend
(
json_attributes
,
{
title
:
@
display_title
(),
body
:
@
display_body
()
})
class
@
ThreadView
extends
@
ContentView
class
@
ThreadView
extends
@
ContentView
class
@
Comment
extends
@
Content
class
@
Comment
extends
@
Content
...
...
lms/static/coffee/src/discussion/discussion_router.coffee
View file @
6ee27d02
...
@@ -5,9 +5,10 @@ class @DiscussionRouter extends Backbone.Router
...
@@ -5,9 +5,10 @@ class @DiscussionRouter extends Backbone.Router
initialize
:
(
options
)
->
initialize
:
(
options
)
->
@
discussion
=
options
[
'discussion'
]
@
discussion
=
options
[
'discussion'
]
@
nav
=
new
DiscussionThreadListView
(
collection
:
@
discussion
,
el
:
$
(
".
post-list
"
))
@
nav
=
new
DiscussionThreadListView
(
collection
:
@
discussion
,
el
:
$
(
".
sidebar
"
))
@
nav
.
on
"thread:selected"
,
@
navigateToThread
@
nav
.
on
"thread:selected"
,
@
navigateToThread
@
nav
.
render
()
@
nav
.
render
()
@
main
=
new
DiscussionThreadView
(
el
:
$
(
".discussion-column"
))
allThreads
:
->
allThreads
:
->
true
true
...
@@ -15,8 +16,8 @@ class @DiscussionRouter extends Backbone.Router
...
@@ -15,8 +16,8 @@ class @DiscussionRouter extends Backbone.Router
showThread
:
(
forum_name
,
thread_id
)
->
showThread
:
(
forum_name
,
thread_id
)
->
@
nav
.
setActiveThread
(
thread_id
)
@
nav
.
setActiveThread
(
thread_id
)
thread
=
@
discussion
.
get
(
thread_id
)
thread
=
@
discussion
.
get
(
thread_id
)
view
=
new
DiscussionThreadView
(
el
:
$
(
".discussion-column"
),
model
:
thread
)
@
main
.
model
=
thread
view
.
render
()
@
main
.
render
()
navigateToThread
:
(
thread_id
)
=>
navigateToThread
:
(
thread_id
)
=>
thread
=
@
discussion
.
get
(
thread_id
)
thread
=
@
discussion
.
get
(
thread_id
)
...
...
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
6ee27d02
class
@
DiscussionThreadListView
extends
Backbone
.
View
class
@
DiscussionThreadListView
extends
Backbone
.
View
template
:
_
.
template
(
$
(
"#thread-list-template"
).
html
())
events
:
"click .search"
:
"showSearch"
"keyup .post-search-field"
:
"performSearch"
render
:
->
render
:
->
@
collection
.
each
@
renderThreadListItem
@
timer
=
0
;
@
$el
.
html
(
@
template
())
@
collection
.
on
"reset"
,
@
renderThreads
@
renderThreads
()
@
@
renderThreads
:
=>
@
$
(
".post-list"
).
html
(
""
)
@
collection
.
each
@
renderThreadListItem
renderThreadListItem
:
(
thread
)
=>
renderThreadListItem
:
(
thread
)
=>
view
=
new
ThreadListItemView
(
model
:
thread
)
view
=
new
ThreadListItemView
(
model
:
thread
)
view
.
on
"thread:selected"
,
@
threadSelected
view
.
on
"thread:selected"
,
@
threadSelected
view
.
render
()
view
.
render
()
@
$
el
.
append
(
view
.
el
)
@
$
(
".post-list"
)
.
append
(
view
.
el
)
threadSelected
:
(
thread_id
)
=>
threadSelected
:
(
thread_id
)
=>
@
setActiveThread
(
thread_id
)
@
setActiveThread
(
thread_id
)
...
@@ -16,3 +29,28 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -16,3 +29,28 @@ class @DiscussionThreadListView extends Backbone.View
@
$
(
"a"
).
removeClass
(
"active"
)
@
$
(
"a"
).
removeClass
(
"active"
)
@
$
(
"a[data-id='
#{
thread_id
}
']"
).
addClass
(
"active"
)
@
$
(
"a[data-id='
#{
thread_id
}
']"
).
addClass
(
"active"
)
showSearch
:
->
@
$
(
".search"
).
addClass
(
'is-open'
);
@
$
(
".browse"
).
removeClass
(
'is-open'
);
setTimeout
(
->
@
$
(
".post-search-field"
).
focus
()),
200
delay
:
(
callback
,
ms
)
=>
clearTimeout
(
@
timer
)
@
timer
=
setTimeout
(
callback
,
ms
)
performSearch
:
->
callback
=
=>
url
=
DiscussionUtil
.
urlFor
(
"search"
)
text
=
@
$
(
".post-search-field"
).
val
()
DiscussionUtil
.
safeAjax
$elem
:
@
$
(
".post-search-field"
)
data
:
{
text
:
text
}
url
:
url
type
:
"GET"
success
:
(
response
,
textStatus
)
=>
console
.
log
textStatus
if
textStatus
==
'success'
@
collection
.
reset
(
response
.
discussion_data
)
console
.
log
(
@
collection
)
@
delay
(
callback
,
300
)
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
6ee27d02
...
@@ -5,14 +5,9 @@ class @DiscussionThreadView extends Backbone.View
...
@@ -5,14 +5,9 @@ class @DiscussionThreadView extends Backbone.View
"click .discussion-submit-post"
:
"submitComment"
"click .discussion-submit-post"
:
"submitComment"
template
:
_
.
template
(
$
(
"#thread-template"
).
html
())
template
:
_
.
template
(
$
(
"#thread-template"
).
html
())
initialize
:
(
options
)
->
@
model
.
bind
"change"
,
@
updateModelDetails
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
updateModelDetails
:
=>
@
$
(
".discussion-vote .votes-count-number"
).
html
(
@
model
.
get
(
"votes"
)[
"up_count"
])
render
:
->
render
:
->
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
model
.
bind
"change"
,
@
updateModelDetails
if
window
.
user
.
following
(
@
model
)
if
window
.
user
.
following
(
@
model
)
@
$
(
".dogear"
).
addClass
(
"is-followed"
)
@
$
(
".dogear"
).
addClass
(
"is-followed"
)
...
@@ -24,6 +19,9 @@ class @DiscussionThreadView extends Backbone.View
...
@@ -24,6 +19,9 @@ class @DiscussionThreadView extends Backbone.View
@
renderResponses
()
@
renderResponses
()
@
@
updateModelDetails
:
=>
@
$
(
".discussion-vote .votes-count-number"
).
html
(
@
model
.
get
(
"votes"
)[
"up_count"
])
convertMath
:
->
convertMath
:
->
element
=
@
$
(
".post-body"
)
element
=
@
$
(
".post-body"
)
element
.
html
DiscussionUtil
.
postMathJaxProcessor
DiscussionUtil
.
markdownWithHighlight
element
.
html
()
element
.
html
DiscussionUtil
.
postMathJaxProcessor
DiscussionUtil
.
markdownWithHighlight
element
.
html
()
...
...
lms/static/js/discussions-temp.js
View file @
6ee27d02
...
@@ -19,8 +19,8 @@ var tooltipCoords;
...
@@ -19,8 +19,8 @@ var tooltipCoords;
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$body
=
$
(
'body'
);
$body
=
$
(
'body'
);
$browse
=
$
(
'.browse-search .browse'
);
$browse
=
$
(
'.browse-search .browse'
);
$search
=
$
(
'.browse-search .search'
);
//
$search = $('.browse-search .search');
$searchField
=
$
(
'.post-search-field'
);
//
$searchField = $('.post-search-field');
$topicDrop
=
$
(
'.board-drop-menu'
);
$topicDrop
=
$
(
'.board-drop-menu'
);
$currentBoard
=
$
(
'.current-board'
);
$currentBoard
=
$
(
'.current-board'
);
$tooltip
=
$
(
'<div class="tooltip"></div>'
);
$tooltip
=
$
(
'<div class="tooltip"></div>'
);
...
@@ -34,7 +34,7 @@ $(document).ready(function() {
...
@@ -34,7 +34,7 @@ $(document).ready(function() {
sidebarWidth
=
$
(
'.sidebar'
).
width
();
sidebarWidth
=
$
(
'.sidebar'
).
width
();
$browse
.
bind
(
'click'
,
showTopicDrop
);
$browse
.
bind
(
'click'
,
showTopicDrop
);
$search
.
bind
(
'click'
,
showSearch
);
//
$search.bind('click', showSearch);
$topicDrop
.
bind
(
'click'
,
setTopic
);
$topicDrop
.
bind
(
'click'
,
setTopic
);
$formTopicDropBtn
.
bind
(
'click'
,
showFormTopicDrop
);
$formTopicDropBtn
.
bind
(
'click'
,
showFormTopicDrop
);
$formTopicDropMenu
.
bind
(
'click'
,
setFormTopic
);
$formTopicDropMenu
.
bind
(
'click'
,
setFormTopic
);
...
@@ -99,13 +99,13 @@ function showBrowse(e) {
...
@@ -99,13 +99,13 @@ function showBrowse(e) {
$searchField
.
val
(
''
);
$searchField
.
val
(
''
);
}
}
function
showSearch
(
e
)
{
//
function showSearch(e) {
$search
.
addClass
(
'is-open'
);
//
$search.addClass('is-open');
$browse
.
removeClass
(
'is-open'
);
//
$browse.removeClass('is-open');
setTimeout
(
function
()
{
//
setTimeout(function() {
$searchField
.
focus
();
//
$searchField.focus();
},
200
);
//
}, 200);
}
//
}
function
showTopicDrop
(
e
)
{
function
showTopicDrop
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -189,4 +189,4 @@ function setFormTopic(e) {
...
@@ -189,4 +189,4 @@ function setFormTopic(e) {
boardName
=
$
(
this
).
siblings
(
'a'
).
html
()
+
' / '
+
boardName
;
boardName
=
$
(
this
).
siblings
(
'a'
).
html
()
+
' / '
+
boardName
;
});
});
$formTopicDropBtn
.
html
(
boardName
+
' <span class="drop-arrow">▾</span>'
);
$formTopicDropBtn
.
html
(
boardName
+
' <span class="drop-arrow">▾</span>'
);
}
}
\ No newline at end of file
lms/templates/discussion/single_thread.html
View file @
6ee27d02
...
@@ -116,56 +116,54 @@
...
@@ -116,56 +116,54 @@
<div
class=
"discussion container"
>
<div
class=
"discussion container"
>
<div
class=
"discussion-body"
>
<div
class=
"discussion-body"
>
<div
class=
"sidebar"
>
<div
class=
"sidebar"
></div>
<div
class=
"browse-search"
>
<div
class=
"discussion-column"
></div>
<div
class=
"browse is-open"
>
</div>
<a
href=
"#"
class=
"board-drop-icon"
></a>
</div>
<a
href=
"#"
class=
"board-drop-btn"
><span
class=
"current-board"
>
Homework / Week 1
</span>
<span
class=
"drop-arrow"
>
▾
</span></a>
</div>
<script
type=
"text/template"
id=
"thread-list-template"
>
<ul
class=
"board-drop-menu"
>
<
div
class
=
"browse-search"
>
<li><a
href=
"#"
><span
class=
"board-name"
>
All
</span>
<span
class=
"unread"
>
1,248
</span></a></li>
<
div
class
=
"browse is-open"
>
<li><a
href=
"#"
><span
class=
"board-name"
>
Following
</span></a></li>
<
a
href
=
"#"
class
=
"board-drop-icon"
><
/a
>
<li><a
href=
"#"
><span
class=
"board-name"
>
General
</span>
<span
class=
"unread"
>
124
</span></a></li>
<
a
href
=
"#"
class
=
"board-drop-btn"
><
span
class
=
"current-board"
>
Homework
/
Week
1
<
/span> <span class="drop-arrow">▾</
span
><
/a
>
<
/div
>
<
ul
class
=
"board-drop-menu"
>
<
li
><
a
href
=
"#"
><
span
class
=
"board-name"
>
All
<
/span> <span class="unread">1,248</
span
><
/a></
li
>
<
li
><
a
href
=
"#"
><
span
class
=
"board-name"
>
Following
<
/span></
a
><
/li
>
<
li
><
a
href
=
"#"
><
span
class
=
"board-name"
>
General
<
/span> <span class="unread">124</
span
><
/a></
li
>
<
li
>
<
a
href
=
"#"
><
span
class
=
"board-name"
>
Homework
<
/span> <span class="unread">27</
span
><
/a
>
<
ul
>
<
li
><
a
href
=
"#"
><
span
class
=
"board-name"
>
Week
1
<
/span> <span class="unread">24</
span
><
/a></
li
>
<
li
>
<
li
>
<a
href=
"#"
><span
class=
"board-name"
>
Homework
</span>
<span
class=
"unread"
>
27
</span></a>
<
a
href
=
"#"
><
span
class
=
"board-name"
>
Week
2
<
/span> <span class="unread">27</
span
><
/a
>
<
ul
>
<
ul
>
<li><a
href=
"#"
><span
class=
"board-name"
>
Week 1
</span>
<span
class=
"unread"
>
24
</span></a></li>
<
li
><
a
href
=
"#"
><
span
class
=
"board-name"
>
Problem
1
<
/span> <span class="unread">14</
span
><
/a></
li
>
<li>
<
li
><
a
href
=
"#"
><
span
class
=
"board-name"
>
Problem
2
<
/span> <span class="unread">13</
span
><
/a></
li
>
<a
href=
"#"
><span
class=
"board-name"
>
Week 2
</span>
<span
class=
"unread"
>
27
</span></a>
<ul>
<li><a
href=
"#"
><span
class=
"board-name"
>
Problem 1
</span>
<span
class=
"unread"
>
14
</span></a></li>
<li><a
href=
"#"
><span
class=
"board-name"
>
Problem 2
</span>
<span
class=
"unread"
>
13
</span></a></li>
</ul>
</li>
<
/ul
>
<
/ul
>
<
/li
>
<
/li
>
<
/ul
>
<
/ul
>
<div
class=
"search"
>
<
/li
>
<form
class=
"post-search"
>
<
/ul
>
<input
type=
"text"
placeholder=
"Search all discussions"
class=
"post-search-field"
>
<
div
class
=
"search"
>
</form>
<
form
class
=
"post-search"
>
</div>
<
input
type
=
"text"
placeholder
=
"Search all discussions"
class
=
"post-search-field"
>
</div>
<
/form
>
<div
class=
"sort-bar"
>
<span
class=
"sort-label"
>
Sort by:
</span>
<ul>
<li><a
href=
"#"
class=
"active"
data-sort=
"date"
>
date
</a></li>
<li><a
href=
"#"
data-sort=
"votes"
>
votes
</a></li>
<li><a
href=
"#"
data-sort=
"comments"
>
comments
</a></li>
</ul>
</div>
<div
class=
"post-list-wrapper"
>
<ul
class=
"post-list"
>
</ul>
</div>
</div>
<div
class=
"discussion-column"
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
</div>
<
div
class
=
"sort-bar"
>
<
span
class
=
"sort-label"
>
Sort
by
:
<
/span
>
<
ul
>
<
li
><
a
href
=
"#"
class
=
"active"
data
-
sort
=
"date"
>
date
<
/a></
li
>
<
li
><
a
href
=
"#"
data
-
sort
=
"votes"
>
votes
<
/a></
li
>
<
li
><
a
href
=
"#"
data
-
sort
=
"comments"
>
comments
<
/a></
li
>
<
/ul
>
<
/div
>
<
div
class
=
"post-list-wrapper"
>
<
ul
class
=
"post-list"
>
<
/ul
>
<
/div
>
</script>
<script
type=
"text/template"
id=
"thread-template"
>
<script
type=
"text/template"
id=
"thread-template"
>
<
article
class
=
"discussion-article"
data
-
id
=
"${'<%= id %>'}"
>
<
article
class
=
"discussion-article"
data
-
id
=
"${'<%= id %>'}"
>
...
...
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