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
098b90eb
Commit
098b90eb
authored
Sep 03, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Top level discussions
parent
99ad4c0b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
17 deletions
+18
-17
lms/djangoapps/django_comment_client/utils.py
+15
-8
lms/static/coffee/src/discussion/views/new_post_view.coffee
+2
-8
lms/templates/discussion/_new_post.html
+1
-1
No files found.
lms/djangoapps/django_comment_client/utils.py
View file @
098b90eb
...
...
@@ -65,6 +65,15 @@ def get_discussion_category_map(course):
initialize_discussion_info
(
course
)
return
_DISCUSSIONINFO
[
'category_map'
]
def
sort_map_entries
(
category_map
):
things
=
[]
for
title
,
entry
in
category_map
[
"entries"
]
.
items
():
things
.
append
((
title
,
entry
))
for
title
,
category
in
category_map
[
"subcategories"
]
.
items
():
things
.
append
((
title
,
category
))
sort_map_entries
(
category_map
[
"subcategories"
][
title
])
category_map
[
"children"
]
=
[
x
[
0
]
for
x
in
sorted
(
things
,
key
=
lambda
x
:
x
[
1
][
"sort_key"
])]
def
initialize_discussion_info
(
course
):
global
_DISCUSSIONINFO
...
...
@@ -77,7 +86,9 @@ def initialize_discussion_info(course):
all_modules
=
get_full_modules
()[
course_id
]
discussion_id_map
=
{}
unexpanded_category_map
=
defaultdict
(
list
)
for
location
,
module
in
all_modules
.
items
():
if
location
.
category
==
'discussion'
:
id
=
module
.
metadata
[
'id'
]
...
...
@@ -109,14 +120,10 @@ def initialize_discussion_info(course):
node
[
level
][
"entries"
][
entry
[
"title"
]]
=
{
"id"
:
entry
[
"id"
],
"sort_key"
:
entry
[
"sort_key"
]}
def
sort_map_entries
(
map
):
things
=
[]
for
title
,
entry
in
map
[
"entries"
]
.
items
():
things
.
append
((
title
,
entry
))
for
title
,
category
in
map
[
"subcategories"
]
.
items
():
things
.
append
((
title
,
category
))
sort_map_entries
(
map
[
"subcategories"
][
title
])
map
[
"children"
]
=
[
x
[
0
]
for
x
in
sorted
(
things
,
key
=
lambda
x
:
x
[
1
][
"sort_key"
])]
for
topic
,
entry
in
course
.
metadata
[
'discussion_topics'
]
.
items
():
category_map
[
'entries'
][
topic
]
=
{
"id"
:
entry
[
"id"
],
"sort_key"
:
entry
.
get
(
"sort_key"
,
topic
)}
sort_map_entries
(
category_map
)
#for level in category_map["subcategories"].values():
...
...
lms/static/coffee/src/discussion/views/new_post_view.coffee
View file @
098b90eb
...
...
@@ -9,6 +9,7 @@ class @NewPostView extends Backbone.View
@
topicId
=
@
$
(
".topic"
).
first
().
data
(
"discussion_id"
)
@
topicText
=
@
getFullTopicName
(
@
$
(
".topic"
).
first
())
@
maxNameWidth
=
100
@
setSelectedTopic
()
events
:
...
...
@@ -31,7 +32,6 @@ class @NewPostView extends Backbone.View
@
showTopicDropdown
()
showTopicDropdown
:
()
->
console
.
log
"showing"
@
menuOpen
=
true
@
dropdownButton
.
addClass
(
'dropped'
)
@
topicMenu
.
show
()
...
...
@@ -58,13 +58,9 @@ class @NewPostView extends Backbone.View
@
topicText
=
@
getFullTopicName
(
$target
)
@
topicId
=
$target
.
data
(
'discussion_id'
)
@
setSelectedTopic
()
else
console
.
log
"NOTHING IN "
console
.
log
$target
setSelectedTopic
:
->
if
@
topicText
@
dropdownButton
.
html
(
@
fitName
(
@
topicText
)
+
' <span class="drop-arrow">▾</span>'
)
@
dropdownButton
.
html
(
@
fitName
(
@
topicText
)
+
' <span class="drop-arrow">▾</span>'
)
getFullTopicName
:
(
topicElement
)
->
name
=
topicElement
.
html
()
...
...
@@ -87,7 +83,6 @@ class @NewPostView extends Backbone.View
return
width
fitName
:
(
name
)
->
console
.
log
name
width
=
@
getNameWidth
(
name
)
if
width
<
@
maxNameWidth
return
name
...
...
@@ -138,7 +133,6 @@ class @NewPostView extends Backbone.View
auto_subscribe
:
follow
error
:
DiscussionUtil
.
formErrorHandler
(
@
$
(
".new-post-form-errors"
))
success
:
(
response
,
textStatus
)
=>
console
.
log
response
thread
=
new
Thread
response
[
'content'
]
DiscussionUtil
.
clearFormErrors
(
@
$
(
".new-post-form-errors"
))
@
$el
.
hide
()
...
...
lms/templates/discussion/_new_post.html
View file @
098b90eb
...
...
@@ -42,7 +42,7 @@
<div
class=
"options"
>
<input
type=
"checkbox"
name=
"follow"
class=
"discussion-follow"
class=
"discussion-follow"
id=
"new-post-follow"
checked
><label
for=
"new-post-follow"
>
follow this post
</label>
<br>
<input
type=
"checkbox"
name=
"anonymous"
class=
"discussion-anonymous"
id=
"new-post-anonymous"
checked
><label
for=
"new-post-anonymous"
>
post anonymously
</label>
<input
type=
"checkbox"
name=
"anonymous"
class=
"discussion-anonymous"
id=
"new-post-anonymous"
><label
for=
"new-post-anonymous"
>
post anonymously
</label>
</div>
</div>
<div
class=
"right-column"
>
...
...
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