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
4a605ab9
Commit
4a605ab9
authored
Aug 02, 2012
by
Brittany Cheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:dementrock/mitx into discussion2
parents
7f0282a2
7b65663e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
39 deletions
+71
-39
lms/static/coffee/src/discussion.coffee
+60
-33
lms/static/sass/course/courseware/_courseware.scss
+2
-0
lms/templates/discussion/_forum.html
+1
-2
lms/templates/discussion/_inline.html
+1
-1
lms/templates/discussion/_sort.html
+5
-1
lms/templates/discussion/_thread.html
+2
-2
No files found.
lms/static/coffee/src/discussion.coffee
View file @
4a605ab9
...
...
@@ -16,7 +16,6 @@ $ ->
Discussion
.
initializeDiscussion
(
discussion
)
Discussion
.
bindDiscussionEvents
(
discussion
)
generateLocal
=
(
elem
)
->
(
selector
)
->
$
(
elem
).
find
(
selector
)
...
...
@@ -106,6 +105,14 @@ Discussion =
retrieve_single_thread
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
"
}[
name
]
safeAjax
:
(
params
)
->
$elem
=
params
.
$elem
if
$elem
.
attr
(
"disabled"
)
return
$elem
.
attr
(
"disabled"
,
"disabled"
)
$
.
ajax
(
params
).
always
->
$elem
.
removeAttr
(
"disabled"
)
handleAnchorAndReload
:
(
response
)
->
#window.location = window.location.pathname + "#" + response['id']
window
.
location
.
reload
()
...
...
@@ -115,13 +122,11 @@ Discussion =
$local
=
generateLocal
(
$discussionModule
)
handleShowDiscussion
=
(
elem
)
->
$elem
=
$
(
elem
)
if
$elem
.
attr
(
"disabled"
)
return
if
not
$local
(
"section.discussion"
).
length
$elem
.
attr
(
"disabled"
,
"disabled"
)
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
url
=
Discussion
.
urlFor
'retrieve_discussion'
,
discussion_id
$
.
ajax
(
Discussion
.
safeAjax
$elem
:
$elem
url
:
url
method
:
"GET"
success
:
(
data
,
textStatus
,
xhr
)
->
...
...
@@ -133,14 +138,12 @@ Discussion =
$elem
.
unbind
(
'click'
).
click
->
handleHideDiscussion
(
this
)
dataType
:
'html'
).
always
->
$elem
.
removeAttr
(
"disabled"
)
else
$local
(
"section.discussion"
).
show
()
$elem
.
html
(
"Hide Discussion"
)
$elem
.
unbind
(
'click'
).
click
->
handleHideDiscussion
(
this
)
handleHideDiscussion
=
(
elem
)
->
$local
(
"section.discussion"
).
hide
()
$elem
=
$
(
elem
)
...
...
@@ -219,7 +222,7 @@ Discussion =
if
$$user_info
?
$local
(
".comment"
).
each
(
initializeVote
)
$local
(
".thread"
).
each
(
initializeVote
).
each
(
initializeWatchThreads
)
initializeWatchDiscussion
(
discussion
)
#initializeWatchDiscussion(discussion) TODO move this somewhere else
$local
(
".new-post-tags"
).
tagsInput
autocomplete_url
:
Discussion
.
urlFor
(
'tags_autocomplete'
)
...
...
@@ -260,8 +263,8 @@ Discussion =
}
$discussionContent
.
append
Mustache
.
render
Discussion
.
replyTemplate
,
view
Markdown
.
makeWmdEditor
$local
(
".reply-body"
),
"-reply-body-
#{
id
}
"
,
Discussion
.
urlFor
(
'upload'
)
$local
(
".discussion-submit-
reply
"
).
click
handleSubmitReply
$local
(
".discussion-cancel-
reply
"
).
click
handleCancelReply
$local
(
".discussion-submit-
post
"
).
click
handleSubmitReply
$local
(
".discussion-cancel-
post
"
).
click
handleCancelReply
$local
(
".discussion-link"
).
hide
()
$discussionContent
.
attr
(
"status"
,
"reply"
)
...
...
@@ -383,51 +386,56 @@ Discussion =
,
'json'
handleHideSingleThread
=
(
elem
)
->
$elem
=
$
(
elem
)
$threadTitle
=
$local
(
".thread-title"
)
$showComments
=
$local
(
".discussion-show-comments"
)
$content
.
children
(
".comments"
).
hide
()
$elem
.
unbind
(
'click'
).
click
->
handleShowSingleThread
(
this
)
$threadTitle
.
unbind
(
'click'
).
click
handleShowSingleThread
$showComments
.
unbind
(
'click'
).
click
handleShowSingleThread
prevHtml
=
$showComments
.
html
()
$showComments
.
html
prevHtml
.
replace
"Hide"
,
"Show"
handleShowSingleThread
=
->
$threadTitle
=
$local
(
".thread-title"
)
$showComments
=
$local
(
".discussion-show-comments"
)
rebindHideEvents
=
->
$threadTitle
.
unbind
(
'click'
).
click
handleHideSingleThread
$showComments
.
unbind
(
'click'
).
click
handleHideSingleThread
prevHtml
=
$showComments
.
html
()
$showComments
.
html
prevHtml
.
replace
"Show"
,
"Hide"
handleShowSingleThread
=
(
elem
)
->
$elem
=
$
(
elem
)
if
$elem
.
attr
(
"disabled"
)
return
if
$content
.
children
(
".comments"
).
length
$content
.
children
(
".comments"
).
show
()
$elem
.
unbind
(
'click'
).
click
->
handleHideSingleThread
(
this
)
rebindHideEvents
()
else
$elem
.
attr
(
"disabled"
,
"disabled"
)
discussion_id
=
$elem
.
parents
(
".discussion"
).
attr
(
"_id"
)
discussion_id
=
$threadTitle
.
parents
(
".discussion"
).
attr
(
"_id"
)
url
=
Discussion
.
urlFor
(
'retrieve_single_thread'
,
discussion_id
,
id
)
console
.
log
url
$
.
ajax
(
Discussion
.
safeAjax
$elem
:
$
.
merge
(
$threadTitle
,
$showComments
)
url
:
url
method
:
"GET"
success
:
(
response
,
textStatus
)
->
if
not
$$annotated_content_info
?
window
.
$
$annotated_content_info
=
{}
console
.
log
response
window
.
$
$annotated_content_info
=
$
.
extend
$$annotated_content_info
,
response
[
'annotated_content_info'
]
console
.
log
$$annotated_content_info
$content
.
append
(
response
[
'html'
])
$content
.
find
(
".comment"
).
each
(
index
,
comment
)
->
Discussion
.
initializeContent
(
comment
)
Discussion
.
bindContentEvents
(
comment
)
$elem
.
unbind
(
'click'
).
click
->
handleHideSingleThread
(
this
)
rebindHideEvents
()
dataType
:
'json'
).
always
->
$elem
.
removeAttr
(
"disabled"
)
$local
(
".thread-title"
).
click
->
handleShowSingleThread
(
this
)
$local
(
".thread-title"
).
click
handleShowSingleThread
$local
(
".discussion-show-comments"
).
click
handleShowSingleThread
$local
(
".discussion-reply"
).
click
->
$local
(
".discussion-reply
-thread
"
).
click
->
handleShowSingleThread
(
$local
(
".thread-title"
))
handleReply
(
this
)
$local
(
".discussion-reply-comment"
).
click
->
handleReply
(
this
)
$local
(
".discussion-cancel-reply"
).
click
->
handleCancelReply
(
this
)
...
...
@@ -518,6 +526,22 @@ Discussion =
$local
(
".discussion-cancel-post"
).
click
->
handleCancelNewPost
(
this
)
$
(
elem
).
hide
()
handleSort
=
(
elem
)
->
$elem
=
$
(
elem
)
$discussionModule
=
$elem
.
parents
(
".discussion-module"
)
$discussion
=
$discussionModule
.
find
(
".discussion"
)
Discussion
.
safeAjax
$elem
:
$elem
url
:
$elem
.
attr
(
"sort-url"
)
method
:
"GET"
success
:
(
data
,
textStatus
)
->
$discussion
.
replaceWith
(
data
)
$discussion
=
$discussionModule
.
find
(
".discussion"
)
Discussion
.
initializeDiscussion
(
$discussion
)
Discussion
.
bindDiscussionEvents
(
$discussion
)
dataType
:
'html'
$local
(
".discussion-search-form"
).
submit
(
event
)
->
event
.
preventDefault
()
...
...
@@ -531,6 +555,9 @@ Discussion =
$local
(
".discussion-search"
).
click
->
$local
(
".new-post-form"
).
submit
()
$discussion
.
children
(
".discussion-sort"
).
find
(
".discussion-inline-sort-link"
).
click
->
handleSort
(
this
)
$discussion
.
find
(
".thread"
).
each
(
index
,
thread
)
->
Discussion
.
initializeContent
(
thread
)
Discussion
.
bindContentEvents
(
thread
)
...
...
lms/static/sass/course/courseware/_courseware.scss
View file @
4a605ab9
...
...
@@ -79,6 +79,7 @@ div.course-wrapper {
}
.histogram
{
display
:
none
;
width
:
200px
;
height
:
150px
;
}
...
...
@@ -128,6 +129,7 @@ div.course-wrapper {
}
div
.staff_info
{
display
:
none
;
@include
clearfix
();
white-space
:
pre-wrap
;
border-top
:
1px
solid
#ccc
;
...
...
lms/templates/discussion/_forum.html
View file @
4a605ab9
<
%
namespace
name=
"renderer"
file=
"_thread.html"
/>
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<section
class=
"discussion
inline-discussion
"
_id=
"${discussion_id}"
>
<div
class=
"discussion-non-content"
>
<div
class=
"discussion-title-wrapper"
>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
...
...
@@ -10,7 +10,6 @@
<input
type=
"checkbox"
id=
"discussion-search-within-board-${discussion_id}"
class=
"discussion-search-within-board"
checked
/>
<label
for=
"discussion-search-within-board-${discussion_id}"
class=
"discussion-search-within-board"
>
Search within board
</label>
</div>
<div
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</div>
</div>
<
%
include
file=
"_sort.html"
/>
...
...
lms/templates/discussion/_inline.html
View file @
4a605ab9
<
%
namespace
name=
"renderer"
file=
"_thread.html"
/>
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<section
class=
"discussion
inline-discussion
"
_id=
"${discussion_id}"
>
<div
class=
"discussion-non-content"
>
<div
class=
"search-wrapper-inline"
>
${search_bar}
...
...
lms/templates/discussion/_sort.html
View file @
4a605ab9
...
...
@@ -20,7 +20,11 @@
def
url_for_sort
(
key
,
order
)
:
return
base_url
+
'?'
+
urlencode
(
merge
(
query_params
,
{'
page
'
:
1
,
'
sort_key
'
:
key
,
'
sort_order
'
:
order
}))
%
>
<a
href=
"${url_for_sort(key, order)}"
>
${title}
</a>
% if discussion_type == 'inline':
<a
class=
"discussion-sort-link discussion-inline-sort-link"
href=
"javascript:void(0)"
sort-url=
"${url_for_sort(key, order)}"
>
${title}
</a>
% else:
<a
class=
"discussion-sort-link"
href=
"${url_for_sort(key, order)}"
>
${title}
</a>
% endif
</
%
def>
<div
class=
"discussion-sort"
>
...
...
lms/templates/discussion/_thread.html
View file @
4a605ab9
...
...
@@ -70,7 +70,7 @@
<
%
def
name=
"render_bottom_bar(content, type, **kwargs)"
>
<div
class=
"info"
>
${render_info(content)}
${render_link("discussion-link discussion-reply
"
, "Reply")}
${render_link("discussion-link discussion-reply
discussion-reply-" + type
, "Reply")}
% if type == "thread" and kwargs['edit_thread'] or type == "comment":
${render_link("discussion-link discussion-edit", "Edit")}
% endif
...
...
@@ -93,7 +93,7 @@
user No.${content['user_id']}
% endif
% if content.get('comments_count', -1) >= 0:
, ${content['comments_count']} comment(s)
,
<a
href=
"javascript:void(0)"
class=
"discussion-show-comments"
>
Show ${content['comments_count']} comment(s)
</a>
% endif
</
%
def>
...
...
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