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
7dbea50d
Commit
7dbea50d
authored
Sep 14, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reasonable behavior when creating a thread
parent
27b80bc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
lms/static/coffee/src/discussion/discussion_router.coffee
+1
-2
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+25
-6
No files found.
lms/static/coffee/src/discussion/discussion_router.coffee
View file @
7dbea50d
...
...
@@ -13,7 +13,7 @@ if Backbone?
@
nav
.
render
()
@
newPostView
=
new
NewPostView
(
el
:
$
(
".new-post-article"
),
collection
:
@
discussion
)
@
n
ewPostView
.
on
"thread:created"
,
@
navigateToThread
@
n
av
.
on
"thread:created"
,
@
navigateToThread
allThreads
:
->
@
nav
.
updateSidebar
()
...
...
@@ -42,5 +42,4 @@ if Backbone?
@
navigate
(
"
#{
thread
.
get
(
"commentable_id"
)
}
/threads/
#{
thread_id
}
"
,
trigger
:
true
)
navigateToAllThreads
:
=>
console
.
log
"navigating"
@
navigate
(
""
,
trigger
:
true
)
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
7dbea50d
...
...
@@ -40,15 +40,13 @@ if Backbone?
if
active
@
setActiveThread
(
thread_id
)
#TODO fix this entire chain of events
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
()
@
setTopicHack
(
commentable
)
@
retrieveDiscussion
commentable_id
,
=>
@
trigger
"thread:created"
,
thread
.
get
(
'id'
)
updateSidebar
:
=>
...
...
@@ -187,6 +185,13 @@ if Backbone?
$
(
"body"
).
unbind
"click"
,
@
toggleTopicDrop
$
(
"body"
).
unbind
"keydown"
,
@
setActiveItem
# TODO get rid of this asap
setTopicHack
:
(
boardNameContainer
)
->
item
=
$
(
boardNameContainer
).
closest
(
'a'
)
boardName
=
item
.
find
(
".board-name"
).
html
()
_
.
each
item
.
parents
(
'ul'
).
not
(
'.browse-topic-drop-menu'
),
(
parent
)
->
boardName
=
$
(
parent
).
siblings
(
'a'
).
find
(
'.board-name'
).
html
()
+
' / '
+
boardName
@
$
(
".current-board"
).
html
(
@
fitName
(
boardName
))
setTopic
:
(
event
)
->
item
=
$
(
event
.
target
).
closest
(
'a'
)
...
...
@@ -243,6 +248,20 @@ if Backbone?
discussionIds
=
_
.
map
item
.
find
(
".board-name[data-discussion_id]"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
).
id
@
retrieveDiscussions
(
discussionIds
)
retrieveDiscussion
:
(
discussion_id
,
callback
=
null
)
->
url
=
DiscussionUtil
.
urlFor
(
"retrieve_discussion"
,
discussion_id
)
DiscussionUtil
.
safeAjax
url
:
url
type
:
"GET"
success
:
(
response
,
textStatus
)
=>
@
collection
.
current_page
=
response
.
page
@
collection
.
pages
=
response
.
num_pages
@
collection
.
reset
(
response
.
discussion_data
)
Content
.
loadContentInfos
(
response
.
content_info
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
if
callback
?
callback
()
retrieveDiscussions
:
(
discussion_ids
)
->
@
discussionIds
=
discussion_ids
.
join
(
','
)
url
=
DiscussionUtil
.
urlFor
(
"search"
)
...
...
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