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
3397e652
Commit
3397e652
authored
Aug 30, 2012
by
Tom Giannattasio
Browse files
Options
Browse Files
Download
Plain Diff
merge conflict fixes
parents
46367657
ebaee9e0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
126 additions
and
79 deletions
+126
-79
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
+18
-22
lms/static/sass/_discussion.scss
+1
-1
lms/templates/discussion/single_thread.html
+41
-43
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
3397e652
...
...
@@ -20,7 +20,7 @@ import django_comment_client.utils as utils
import
comment_client
as
cc
THREADS_PER_PAGE
=
5
THREADS_PER_PAGE
=
5
0000
PAGES_NEARBY_DELTA
=
2
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
3397e652
...
...
@@ -427,6 +427,22 @@ if Backbone?
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
@
Comment
extends
@
Content
...
...
lms/static/coffee/src/discussion/discussion_router.coffee
View file @
3397e652
...
...
@@ -5,9 +5,10 @@ class @DiscussionRouter extends Backbone.Router
initialize
:
(
options
)
->
@
discussion
=
options
[
'discussion'
]
@
nav
=
new
DiscussionThreadListView
(
collection
:
@
discussion
,
el
:
$
(
".
post-list
"
))
@
nav
=
new
DiscussionThreadListView
(
collection
:
@
discussion
,
el
:
$
(
".
sidebar
"
))
@
nav
.
on
"thread:selected"
,
@
navigateToThread
@
nav
.
render
()
@
main
=
new
DiscussionThreadView
(
el
:
$
(
".discussion-column"
))
allThreads
:
->
true
...
...
@@ -15,8 +16,8 @@ class @DiscussionRouter extends Backbone.Router
showThread
:
(
forum_name
,
thread_id
)
->
@
nav
.
setActiveThread
(
thread_id
)
thread
=
@
discussion
.
get
(
thread_id
)
view
=
new
DiscussionThreadView
(
el
:
$
(
".discussion-column"
),
model
:
thread
)
view
.
render
()
@
main
.
model
=
thread
@
main
.
render
()
navigateToThread
:
(
thread_id
)
=>
thread
=
@
discussion
.
get
(
thread_id
)
...
...
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
3397e652
class
@
DiscussionThreadListView
extends
Backbone
.
View
template
:
_
.
template
(
$
(
"#thread-list-template"
).
html
())
events
:
"click .search"
:
"showSearch"
"keyup .post-search-field"
:
"performSearch"
render
:
->
@
collection
.
each
@
renderThreadListItem
@
timer
=
0
;
@
$el
.
html
(
@
template
())
@
collection
.
on
"reset"
,
@
renderThreads
@
renderThreads
()
@
renderThreads
:
=>
@
$
(
".post-list"
).
html
(
""
)
@
collection
.
each
@
renderThreadListItem
renderThreadListItem
:
(
thread
)
=>
view
=
new
ThreadListItemView
(
model
:
thread
)
view
.
on
"thread:selected"
,
@
threadSelected
view
.
render
()
@
$
el
.
append
(
view
.
el
)
@
$
(
".post-list"
)
.
append
(
view
.
el
)
threadSelected
:
(
thread_id
)
=>
@
setActiveThread
(
thread_id
)
...
...
@@ -16,3 +29,28 @@ class @DiscussionThreadListView extends Backbone.View
@
$
(
"a"
).
removeClass
(
"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 @
3397e652
...
...
@@ -5,14 +5,9 @@ class @DiscussionThreadView extends Backbone.View
"click .discussion-submit-post"
:
"submitComment"
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
:
->
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
model
.
bind
"change"
,
@
updateModelDetails
if
window
.
user
.
following
(
@
model
)
@
$
(
".dogear"
).
addClass
(
"is-followed"
)
...
...
@@ -24,6 +19,9 @@ class @DiscussionThreadView extends Backbone.View
@
renderResponses
()
@
updateModelDetails
:
=>
@
$
(
".discussion-vote .votes-count-number"
).
html
(
@
model
.
get
(
"votes"
)[
"up_count"
])
convertMath
:
->
element
=
@
$
(
".post-body"
)
element
.
html
DiscussionUtil
.
postMathJaxProcessor
DiscussionUtil
.
markdownWithHighlight
element
.
html
()
...
...
lms/static/js/discussions-temp.js
View file @
3397e652
...
...
@@ -20,13 +20,14 @@ var scrollTop;
var
tooltipTimer
;
var
tooltipCoords
;
var
SIDEBAR_PADDING
=
-
1
;
var
SIDEBAR_HEADER_HEIGHT
=
87
;
$
(
document
).
ready
(
function
()
{
$body
=
$
(
'body'
);
$browse
=
$
(
'.browse-search .browse'
);
$search
=
$
(
'.browse-search .search'
);
$searchField
=
$
(
'.post-search-field'
);
//
$search = $('.browse-search .search');
//
$searchField = $('.post-search-field');
$topicDrop
=
$
(
'.board-drop-menu'
);
$currentBoard
=
$
(
'.current-board'
);
$tooltip
=
$
(
'<div class="tooltip"></div>'
);
...
...
@@ -39,11 +40,10 @@ $(document).ready(function() {
$body
.
append
(
$sidebarWidthStyles
);
sidebarWidth
=
$
(
'.sidebar'
).
width
();
sidebarHeaderHeight
=
$sidebar
.
find
(
'.browse-search'
).
height
()
+
$sidebar
.
find
(
'.sort-bar'
).
height
();
sidebarXOffset
=
$sidebar
.
offset
().
top
;
$browse
.
bind
(
'click'
,
showTopicDrop
);
$search
.
bind
(
'click'
,
showSearch
);
//
$search.bind('click', showSearch);
$topicDrop
.
bind
(
'click'
,
setTopic
);
$formTopicDropBtn
.
bind
(
'click'
,
showFormTopicDrop
);
$formTopicDropMenu
.
bind
(
'click'
,
setFormTopic
);
...
...
@@ -111,13 +111,13 @@ function showBrowse(e) {
$searchField
.
val
(
''
);
}
function
showSearch
(
e
)
{
$search
.
addClass
(
'is-open'
);
$browse
.
removeClass
(
'is-open'
);
setTimeout
(
function
()
{
$searchField
.
focus
();
},
200
);
}
//
function showSearch(e) {
//
$search.addClass('is-open');
//
$browse.removeClass('is-open');
//
setTimeout(function() {
//
$searchField.focus();
//
}, 200);
//
}
function
showTopicDrop
(
e
)
{
e
.
preventDefault
();
...
...
@@ -200,10 +200,6 @@ function setFormTopic(e) {
$formTopicDropBtn
.
html
(
boardName
+
' <span class="drop-arrow">▾</span>'
);
}
function
updateSidebarCoordinates
(
e
)
{
scrollTop
=
$
(
window
).
scrollTop
();
...
...
@@ -226,12 +222,11 @@ function updateSidebarDimensions(e) {
var
titleWidth
=
sidebarWidth
-
115
;
$sidebar
.
css
(
'height'
,
sidebarHeight
+
'px'
);
$postListWrapper
.
css
(
'height'
,
(
sidebarHeight
-
sidebarHeaderHeight
-
4
)
+
'px'
);
$sidebarWidthStyles
.
html
(
'.discussion-body .post-list a .title { width: '
+
titleWidth
+
'px !important; }'
);
}
if
(
!
$postListWrapper
[
0
])
{
$postListWrapper
=
$
(
'.post-list-wrapper'
);
}
$postListWrapper
.
css
(
'height'
,
(
sidebarHeight
-
SIDEBAR_HEADER_HEIGHT
-
4
)
+
'px'
);
$sidebarWidthStyles
.
html
(
'.discussion-body .post-list a .title { width: '
+
titleWidth
+
'px !important; }'
);
}
\ No newline at end of file
lms/static/sass/_discussion.scss
View file @
3397e652
...
...
@@ -756,7 +756,7 @@ body.discussion {
display
:
block
;
position
:
absolute
;
top
:
-1px
;
right
:
-
1
px
;
right
:
-
2
px
;
width
:
52px
;
height
:
51px
;
background
:
url(../images/follow-dog-ear.png)
0
-52px
no-repeat
;
...
...
lms/templates/discussion/single_thread.html
View file @
3397e652
...
...
@@ -116,56 +116,54 @@
<div
class=
"discussion container"
>
<div
class=
"discussion-body"
>
<div
class=
"sidebar"
>
<div
class=
"browse-search"
>
<div
class=
"browse is-open"
>
<a
href=
"#"
class=
"board-drop-icon"
></a>
<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>
<div
class=
"sidebar"
></div>
<div
class=
"discussion-column"
></div>
</div>
</div>
<script
type=
"text/template"
id=
"thread-list-template"
>
<
div
class
=
"browse-search"
>
<
div
class
=
"browse is-open"
>
<
a
href
=
"#"
class
=
"board-drop-icon"
><
/a
>
<
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
>
<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
>
<li><a
href=
"#"
><span
class=
"board-name"
>
Week 1
</span>
<span
class=
"unread"
>
24
</span></a></li>
<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>
<
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
>
<div
class=
"search"
>
<form
class=
"post-search"
>
<input
type=
"text"
placeholder=
"Search all discussions"
class=
"post-search-field"
>
</form>
</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>
</div>
<div
class=
"discussion-column"
>
<
/li
>
<
/ul
>
<
div
class
=
"search"
>
<
form
class
=
"post-search"
>
<
input
type
=
"text"
placeholder
=
"Search all discussions"
class
=
"post-search-field"
>
<
/form
>
<
/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"
>
<
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