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
401f57b8
Commit
401f57b8
authored
Jul 31, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show new post form after clicking button
parent
799f66b7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
23 deletions
+47
-23
lms/static/coffee/src/discussion.coffee
+45
-15
lms/static/sass/_discussion.scss
+1
-1
lms/templates/discussion/inline.html
+1
-7
No files found.
lms/static/coffee/src/discussion.coffee
View file @
401f57b8
...
...
@@ -29,6 +29,17 @@ generateDiscussionLink = (cls, txt, handler) ->
Discussion
=
newPostTemplate
:
"""
<form class="new-post-form" _id="{{discussion_id}}">
<ul class="discussion-errors"></ul>
<input type="text" class="new-post-title title-input" placeholder="Title"/>
<div class="new-post-body body-input"></div>
<input class="new-post-tags" placeholder="Tags"/>
<a class="discussion-submit-post control-button" href="javascript:void(0)">Submit</a>
<a class="discussion-cancel-post control-button" href="javascript:void(0)">Cancel</a>
</form>
"""
replyTemplate
:
"""
<form class="discussion-reply-new">
<ul class="discussion-errors"></ul>
...
...
@@ -169,9 +180,7 @@ Discussion =
watchDiscussion
=
generateDiscussionLink
(
"discussion-watch-discussion"
,
"Watch"
,
handleWatchDiscussion
)
$local
(
".discussion-title-wrapper"
).
append
(
watchDiscussion
)
newPostBody
=
$
(
discussion
).
find
(
".new-post-body"
)
if
newPostBody
.
length
Markdown
.
makeWmdEditor
newPostBody
,
"-new-post-body-
#{
$
(
discussion
).
attr
(
'_id'
)
}
"
,
Discussion
.
urlFor
(
'upload'
)
initializeWatchThreads
=
(
index
,
thread
)
->
$thread
=
$
(
thread
)
...
...
@@ -192,7 +201,6 @@ Discussion =
Discussion
.
handleAnchorAndReload
(
response
)
,
'json'
if
id
in
$$user_info
.
subscribed_thread_ids
unwatchThread
=
generateDiscussionLink
(
"discussion-unwatch-thread"
,
"Unwatch"
,
handleUnwatchThread
)
$local
(
".info"
).
append
(
unwatchThread
)
...
...
@@ -207,15 +215,6 @@ Discussion =
$local
(
".thread"
).
each
(
initializeVote
).
each
(
initializeWatchThreads
)
initializeWatchDiscussion
(
discussion
)
$local
(
".new-post-tags"
).
tagsInput
autocomplete_url
:
Discussion
.
urlFor
(
'tags_autocomplete'
)
autocomplete
:
remoteDataType
:
'json'
interactive
:
true
defaultText
:
"add a tag"
height
:
"30px"
removeWithBackspace
:
true
bindContentEvents
:
(
content
)
->
$content
=
$
(
content
)
...
...
@@ -404,7 +403,7 @@ Discussion =
else
window
.
location
=
Discussion
.
urlFor
(
'search'
)
+
'?text='
+
encodeURI
(
text
)
handleSubmitNew
Thread
=
(
elem
)
->
handleSubmitNew
Post
=
(
elem
)
->
title
=
$local
(
".new-post-title"
).
val
()
body
=
$local
(
"#wmd-input-new-post-body-
#{
id
}
"
).
val
()
tags
=
$local
(
".new-post-tags"
).
val
()
...
...
@@ -417,6 +416,37 @@ Discussion =
else
Discussion
.
handleAnchorAndReload
(
response
)
,
'json'
handleCancelNewPost
=
(
elem
)
->
$local
(
".new-post-form"
).
hide
()
$local
(
".discussion-new-post"
).
show
()
handleNewPost
=
(
elem
)
->
newPostForm
=
$local
(
".new-post-form"
)
if
newPostForm
.
length
newPostForm
.
show
()
$
(
elem
).
hide
()
else
view
=
{
discussion_id
:
id
}
$discussionNonContent
.
append
Mustache
.
render
Discussion
.
newPostTemplate
,
view
newPostBody
=
$
(
discussion
).
find
(
".new-post-body"
)
if
newPostBody
.
length
Markdown
.
makeWmdEditor
newPostBody
,
"-new-post-body-
#{
$
(
discussion
).
attr
(
'_id'
)
}
"
,
Discussion
.
urlFor
(
'upload'
)
$local
(
".new-post-tags"
).
tagsInput
autocomplete_url
:
Discussion
.
urlFor
(
'tags_autocomplete'
)
autocomplete
:
remoteDataType
:
'json'
interactive
:
true
defaultText
:
"add a tag"
height
:
"30px"
removeWithBackspace
:
true
$local
(
".discussion-submit-post"
).
click
->
handleSubmitNewPost
(
this
)
$local
(
".discussion-cancel-post"
).
click
->
handleCancelNewPost
(
this
)
$
(
elem
).
hide
()
$local
(
".discussion-search-form"
).
submit
(
event
)
->
event
.
preventDefault
()
...
...
@@ -425,7 +455,7 @@ Discussion =
handleSearch
(
text
,
isSearchWithinBoard
)
$local
(
".discussion-new-post"
).
click
->
handle
SubmitNewThread
(
this
)
handle
NewPost
(
this
)
$local
(
".discussion-search"
).
click
->
$local
(
".new-post-form"
).
submit
()
...
...
lms/static/sass/_discussion.scss
View file @
401f57b8
...
...
@@ -127,7 +127,7 @@ $discussion_input_width: 85%;
height
:
100%
;
}
}
.discussion-content-edit
,
.discussion-reply-new
{
.discussion-content-edit
,
.discussion-reply-new
,
.new-post-form
{
.control-button
{
display
:
inline-block
;
}
...
...
lms/templates/discussion/inline.html
View file @
401f57b8
...
...
@@ -6,13 +6,7 @@
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
</div>
${search_bar}
<form
class=
"new-post-form"
_id=
"${discussion_id}"
>
<ul
class=
"discussion-errors"
></ul>
<input
type=
"text"
class=
"new-post-title title-input"
placeholder=
"Title"
/>
<div
class=
"new-post-body body-input"
></div>
<input
class=
"new-post-tags"
placeholder=
"Tags"
/>
<a
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</a>
</form>
<a
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</a>
</div>
% for thread in threads:
${renderer.render_thread(course_id, thread, edit_thread=False, show_comments=False)}
...
...
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