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
0560bb7e
Commit
0560bb7e
authored
Aug 07, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add hide similar post button
parent
0863e346
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
lms/static/coffee/src/discussion/discussion.coffee
+16
-2
lms/static/coffee/src/discussion/templates.coffee
+1
-1
No files found.
lms/static/coffee/src/discussion/discussion.coffee
View file @
0560bb7e
...
...
@@ -62,6 +62,15 @@ initializeFollowDiscussion = (discussion) ->
$local
(
".discussion-new-post"
).
show
()
handleSimilarPost
=
(
elem
)
->
$title
=
$local
(
".new-post-title"
)
$wrapper
=
$local
(
".new-post-similar-posts-wrapper"
)
$similarPosts
=
$local
(
".new-post-similar-posts"
)
prevText
=
$title
.
attr
(
"prev-text"
)
text
=
$title
.
val
()
if
text
==
prevText
if
$local
(
".similar-post"
).
length
$wrapper
.
show
()
else
if
$
.
trim
(
text
).
length
Discussion
.
safeAjax
$elem
:
$
(
elem
)
url
:
Discussion
.
urlFor
'search_similar_threads'
,
id
...
...
@@ -70,8 +79,7 @@ initializeFollowDiscussion = (discussion) ->
data
:
text
:
$local
(
".new-post-title"
).
val
()
success
:
(
response
,
textStatus
)
->
$wrapper
=
$local
(
".new-post-similar-posts-wrapper"
)
$similarPosts
=
$local
(
".new-post-similar-posts"
)
console
.
log
"request"
$similarPosts
.
empty
()
if
$
.
type
(
response
)
==
"array"
and
response
.
length
$wrapper
.
show
()
...
...
@@ -83,6 +91,9 @@ initializeFollowDiscussion = (discussion) ->
.
appendTo
(
$similarPosts
)
else
$wrapper
.
hide
()
else
$wrapper
.
hide
()
$title
.
attr
(
"prev-text"
,
text
)
handleNewPost
=
(
elem
)
->
newPostForm
=
$local
(
".new-post-form"
)
...
...
@@ -102,6 +113,9 @@ initializeFollowDiscussion = (discussion) ->
$local
(
".new-post-title"
).
blur
->
handleSimilarPost
(
this
)
$local
(
".hide-similar-posts"
).
click
->
$local
(
".new-post-similar-posts-wrapper"
).
hide
()
$local
(
".discussion-submit-post"
).
click
->
handleSubmitNewPost
(
this
)
$local
(
".discussion-cancel-post"
).
click
->
...
...
lms/static/coffee/src/discussion/templates.coffee
View file @
0560bb7e
...
...
@@ -11,7 +11,7 @@ Discussion = @Discussion
<ul class="discussion-errors"></ul>
<input type="text" class="new-post-title title-input" placeholder="Title"/>
<div class="new-post-similar-posts-wrapper" style="display: none">
Do you mean...
Do you mean...
<a class="hide-similar-posts" href="javascript:void(0)">No you got it wrong lol</a>
<div class="new-post-similar-posts"></div>
</div>
<div class="new-post-body body-input"></div>
...
...
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