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
df825608
Commit
df825608
authored
Sep 05, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update display when creating new post.
parent
12c391ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
+13
-19
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+12
-2
lms/static/coffee/src/discussion/views/new_post_view.coffee
+1
-17
No files found.
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
df825608
...
@@ -12,6 +12,7 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -12,6 +12,7 @@ class @DiscussionThreadListView extends Backbone.View
initialize
:
->
initialize
:
->
@
displayedCollection
=
new
Discussion
(
@
collection
.
models
)
@
displayedCollection
=
new
Discussion
(
@
collection
.
models
)
@
collection
.
on
"change"
,
@
reloadDisplayedCollection
@
collection
.
on
"change"
,
@
reloadDisplayedCollection
@
collection
.
on
"add"
,
@
addAndSelectThread
@
sidebar_padding
=
10
@
sidebar_padding
=
10
@
sidebar_header_height
=
87
@
sidebar_header_height
=
87
...
@@ -24,6 +25,16 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -24,6 +25,16 @@ class @DiscussionThreadListView extends Backbone.View
if
active
if
active
@
setActiveThread
(
thread_id
)
@
setActiveThread
(
thread_id
)
addAndSelectThread
:
(
thread
)
=>
commentable_id
=
thread
.
get
(
"commentable_id"
)
commentable
=
@
$
(
".board-name[data-discussion_id]"
).
filter
(
->
$
(
this
).
data
(
"discussion_id"
).
id
==
commentable_id
)
commentable
.
click
()
@
displayedCollection
.
add
thread
content
=
@
renderThread
(
thread
)
$
(
".post-list"
).
prepend
content
content
.
wrap
(
"<li data-id='
#{
thread
.
get
(
'id'
)
}
' />"
)
content
.
click
()
updateSidebar
:
=>
updateSidebar
:
=>
scrollTop
=
$
(
window
).
scrollTop
();
scrollTop
=
$
(
window
).
scrollTop
();
...
@@ -153,8 +164,7 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -153,8 +164,7 @@ class @DiscussionThreadListView extends Backbone.View
item
=
$
(
event
.
target
).
closest
(
'li'
)
item
=
$
(
event
.
target
).
closest
(
'li'
)
if
item
.
find
(
"span.board-name"
).
data
(
"discussion_id"
)
==
"#all"
if
item
.
find
(
"span.board-name"
).
data
(
"discussion_id"
)
==
"#all"
item
=
item
.
parent
()
item
=
item
.
parent
()
discussionIds
=
_
.
compact
_
.
map
item
.
find
(
"span.board-name"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
)
discussionIds
=
_
.
map
item
.
find
(
".board-name[data-discussion_id]"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
).
id
discussionIds
=
_
.
map
discussionIds
,
(
info
)
->
info
.
id
filtered
=
@
collection
.
filter
(
thread
)
=>
filtered
=
@
collection
.
filter
(
thread
)
=>
_
.
include
(
discussionIds
,
thread
.
get
(
'commentable_id'
))
_
.
include
(
discussionIds
,
thread
.
get
(
'commentable_id'
))
@
displayedCollection
.
reset
filtered
@
displayedCollection
.
reset
filtered
...
...
lms/static/coffee/src/discussion/views/new_post_view.coffee
View file @
df825608
...
@@ -136,6 +136,7 @@ class @NewPostView extends Backbone.View
...
@@ -136,6 +136,7 @@ class @NewPostView extends Backbone.View
auto_subscribe
:
follow
auto_subscribe
:
follow
error
:
DiscussionUtil
.
formErrorHandler
(
@
$
(
".new-post-form-errors"
))
error
:
DiscussionUtil
.
formErrorHandler
(
@
$
(
".new-post-form-errors"
))
success
:
(
response
,
textStatus
)
=>
success
:
(
response
,
textStatus
)
=>
# TODO: Move this out of the callback, this makes it feel sluggish
thread
=
new
Thread
response
[
'content'
]
thread
=
new
Thread
response
[
'content'
]
DiscussionUtil
.
clearFormErrors
(
@
$
(
".new-post-form-errors"
))
DiscussionUtil
.
clearFormErrors
(
@
$
(
".new-post-form-errors"
))
@
$el
.
hide
()
@
$el
.
hide
()
...
@@ -144,20 +145,6 @@ class @NewPostView extends Backbone.View
...
@@ -144,20 +145,6 @@ class @NewPostView extends Backbone.View
@
$
(
".new-post-tags"
).
val
(
""
)
@
$
(
".new-post-tags"
).
val
(
""
)
@
$
(
".new-post-tags"
).
importTags
(
""
)
@
$
(
".new-post-tags"
).
importTags
(
""
)
@
collection
.
add
thread
@
collection
.
add
thread
@
collection
.
trigger
"reset"
@
trigger
"thread:created"
,
thread
.
id
#@$el.children(".threads").prepend($thread)
# no idea what this is
#@$el.children(".blank").remove()
#@$(".new-post-similar-posts").empty()
#@$(".new-post-similar-posts-wrapper").hide()
#DiscussionUtil.setWmdContent @$el, $.proxy(@$, @), "new-post-body", ""
#thread = @model.addThread response.content
#threadView = new ThreadView el: $thread[0], model: thread
#thread.updateInfo response.annotated_content_info
#@cancelNewPost()
setActiveItem
:
(
event
)
->
setActiveItem
:
(
event
)
->
if
event
.
which
==
13
if
event
.
which
==
13
...
@@ -182,6 +169,3 @@ class @NewPostView extends Backbone.View
...
@@ -182,6 +169,3 @@ class @NewPostView extends Backbone.View
scrollTarget
=
Math
.
min
(
index
*
itemHeight
,
$
(
".topic_menu"
).
scrollTop
())
scrollTarget
=
Math
.
min
(
index
*
itemHeight
,
$
(
".topic_menu"
).
scrollTop
())
scrollTarget
=
Math
.
max
(
index
*
itemHeight
-
$
(
".topic_menu"
).
height
()
+
itemHeight
,
scrollTarget
)
scrollTarget
=
Math
.
max
(
index
*
itemHeight
-
$
(
".topic_menu"
).
height
()
+
itemHeight
,
scrollTarget
)
$
(
".topic_menu"
).
scrollTop
(
scrollTarget
)
$
(
".topic_menu"
).
scrollTop
(
scrollTarget
)
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