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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+12
-2
lms/static/coffee/src/discussion/views/new_post_view.coffee
+5
-21
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
initialize
:
->
@
displayedCollection
=
new
Discussion
(
@
collection
.
models
)
@
collection
.
on
"change"
,
@
reloadDisplayedCollection
@
collection
.
on
"add"
,
@
addAndSelectThread
@
sidebar_padding
=
10
@
sidebar_header_height
=
87
...
...
@@ -24,6 +25,16 @@ class @DiscussionThreadListView extends Backbone.View
if
active
@
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
:
=>
scrollTop
=
$
(
window
).
scrollTop
();
...
...
@@ -153,8 +164,7 @@ class @DiscussionThreadListView extends Backbone.View
item
=
$
(
event
.
target
).
closest
(
'li'
)
if
item
.
find
(
"span.board-name"
).
data
(
"discussion_id"
)
==
"#all"
item
=
item
.
parent
()
discussionIds
=
_
.
compact
_
.
map
item
.
find
(
"span.board-name"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
)
discussionIds
=
_
.
map
discussionIds
,
(
info
)
->
info
.
id
discussionIds
=
_
.
map
item
.
find
(
".board-name[data-discussion_id]"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
).
id
filtered
=
@
collection
.
filter
(
thread
)
=>
_
.
include
(
discussionIds
,
thread
.
get
(
'commentable_id'
))
@
displayedCollection
.
reset
filtered
...
...
lms/static/coffee/src/discussion/views/new_post_view.coffee
View file @
df825608
...
...
@@ -30,10 +30,10 @@ class @NewPostView extends Backbone.View
toggleTopicDropdown
:
(
event
)
->
event
.
stopPropagation
()
if
@
menuOpen
@
hideTopicDropdown
()
@
hideTopicDropdown
()
else
@
showTopicDropdown
()
@
showTopicDropdown
()
showTopicDropdown
:
()
->
@
menuOpen
=
true
@
dropdownButton
.
addClass
(
'dropped'
)
...
...
@@ -85,7 +85,7 @@ class @NewPostView extends Backbone.View
width
=
test
.
width
()
test
.
remove
()
return
width
fitName
:
(
name
)
->
width
=
@
getNameWidth
(
name
)
if
width
<
@
maxNameWidth
...
...
@@ -136,6 +136,7 @@ class @NewPostView extends Backbone.View
auto_subscribe
:
follow
error
:
DiscussionUtil
.
formErrorHandler
(
@
$
(
".new-post-form-errors"
))
success
:
(
response
,
textStatus
)
=>
# TODO: Move this out of the callback, this makes it feel sluggish
thread
=
new
Thread
response
[
'content'
]
DiscussionUtil
.
clearFormErrors
(
@
$
(
".new-post-form-errors"
))
@
$el
.
hide
()
...
...
@@ -144,20 +145,6 @@ class @NewPostView extends Backbone.View
@
$
(
".new-post-tags"
).
val
(
""
)
@
$
(
".new-post-tags"
).
importTags
(
""
)
@
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
)
->
if
event
.
which
==
13
...
...
@@ -182,6 +169,3 @@ class @NewPostView extends Backbone.View
scrollTarget
=
Math
.
min
(
index
*
itemHeight
,
$
(
".topic_menu"
).
scrollTop
())
scrollTarget
=
Math
.
max
(
index
*
itemHeight
-
$
(
".topic_menu"
).
height
()
+
itemHeight
,
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