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
ff94541e
Commit
ff94541e
authored
Sep 11, 2012
by
Tom Giannattasio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaked inline hide/show and new post buttons
parent
452414da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
16 deletions
+27
-16
lms/static/coffee/src/discussion/discussion_module_view.coffee
+20
-10
lms/static/sass/_discussion.scss
+5
-5
lms/templates/discussion/_discussion_module.html
+1
-0
lms/templates/discussion/mustache/_inline_discussion.mustache
+1
-1
No files found.
lms/static/coffee/src/discussion/discussion_module_view.coffee
View file @
ff94541e
...
...
@@ -9,7 +9,8 @@ if Backbone?
paginationTemplate
:
->
DiscussionUtil
.
getTemplate
(
"_pagination"
)
page_re
:
/\?discussion_page=(\d+)/
initialize
:
->
# Set the page if it was set in the URL. This is used to allow deep linking to pages
@
toggleDiscussionBtn
=
@
$
(
".discussion-show"
)
# Set the page if it was set in the URL. This is used to allow deep linking to pages
match
=
@
page_re
.
exec
(
window
.
location
.
href
)
if
match
@
page
=
parseInt
(
match
[
1
])
...
...
@@ -18,31 +19,38 @@ if Backbone?
toggleNewPost
:
(
event
)
->
event
.
preventDefault
()
if
@
newPostForm
.
is
(
':hidden'
)
if
!
@
newPostForm
@
toggleDiscussion
()
@
isWaitingOnNewPost
=
true
;
return
if
@
showed
@
newPostForm
.
slideDown
(
300
)
else
@
newPostForm
.
slideUp
(
300
)
@
newPostForm
.
show
()
@
toggleDiscussionBtn
.
addClass
(
'shown'
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
"Hide Discussion"
)
@
$
(
"section.discussion"
).
slideDown
()
@
showed
=
true
hideNewPost
:
(
event
)
->
event
.
preventDefault
()
@
newPostForm
.
slideUp
(
300
)
toggleDiscussion
:
(
event
)
->
thisButton
=
$
(
event
.
target
).
closest
(
'a'
)
if
@
showed
@
$
(
"section.discussion"
).
slideUp
()
thisButto
n
.
removeClass
(
'shown'
)
thisButto
n
.
find
(
'.button-text'
).
html
(
"Show Discussion"
)
@
toggleDiscussionBt
n
.
removeClass
(
'shown'
)
@
toggleDiscussionBt
n
.
find
(
'.button-text'
).
html
(
"Show Discussion"
)
@
showed
=
false
else
thisButto
n
.
addClass
(
'shown'
)
thisButto
n
.
find
(
'.button-text'
).
html
(
"Hide Discussion"
)
@
toggleDiscussionBt
n
.
addClass
(
'shown'
)
@
toggleDiscussionBt
n
.
find
(
'.button-text'
).
html
(
"Hide Discussion"
)
if
@
retrieved
@
$
(
"section.discussion"
).
slideDown
()
@
showed
=
true
else
$elem
=
$
(
event
.
target
)
$elem
=
@
toggleDiscussionBtn
@
loadPage
$elem
loadPage
:
(
$elem
)
=>
...
...
@@ -59,7 +67,7 @@ if Backbone?
renderDiscussion
:
(
$elem
,
response
,
textStatus
,
discussionId
)
=>
window
.
user
=
new
DiscussionUser
(
response
.
user_info
)
Content
.
loadContentInfos
(
response
.
annotated_content_info
)
$elem
.
html
(
"Hide Discussion"
)
#
$elem.html("Hide Discussion")
@
discussion
=
new
Discussion
()
@
discussion
.
reset
(
response
.
discussion_data
,
{
silent
:
false
})
$discussion
=
$
(
Mustache
.
render
$
(
"script#_inline_discussion"
).
html
(),
{
'threads'
:
response
.
discussion_data
,
'discussionId'
:
discussionId
})
...
...
@@ -77,6 +85,8 @@ if Backbone?
@
retrieved
=
true
@
showed
=
true
@
renderPagination
(
2
,
response
.
num_pages
)
if
@
isWaitingOnNewPost
@
newPostForm
.
show
()
addThread
:
(
thread
,
collection
,
options
)
=>
# TODO: When doing pagination, this will need to repaginate. Perhaps just reload page 1?
...
...
lms/static/sass/_discussion.scss
View file @
ff94541e
...
...
@@ -1620,7 +1620,7 @@ body.discussion {
.discussion-module
{
@extend
.discussion-body
;
margin
:
20px
0
;
padding
:
20px
20px
28px
20px
;
padding
:
20px
;
background
:
#f6f6f6
!
important
;
border-radius
:
3px
;
...
...
@@ -1634,9 +1634,8 @@ body.discussion {
}
.discussion-show
{
display
:
block
;
width
:
200px
;
margin
:
auto
;
position
:
relative
;
top
:
3px
;
font-size
:
14px
;
text-align
:
center
;
...
...
@@ -1660,10 +1659,11 @@ body.discussion {
.new-post-btn
{
display
:
inline-block
;
float
:
right
;
}
section
.discussion
{
margin-top
:
2
0px
;
margin-top
:
3
0px
;
.threads
{
margin-top
:
20px
;
...
...
lms/templates/discussion/_discussion_module.html
View file @
ff94541e
...
...
@@ -2,4 +2,5 @@
<div
class=
"discussion-module"
data-discussion-id=
"${discussion_id | h}"
>
<a
class=
"discussion-show control-button"
href=
"javascript:void(0)"
data-discussion-id=
"${discussion_id | h}"
><span
class=
"show-hide-discussion-icon"
></span><span
class=
"button-text"
>
Show Discussion
</span></a>
<a
href=
"#"
class=
"new-post-btn"
><span
class=
"new-post-icon"
></span>
New Post
</a>
</div>
lms/templates/discussion/mustache/_inline_discussion.mustache
View file @
ff94541e
<section
class=
"discussion"
data-discussion-id=
"
{{
discussionId
}}
"
>
<a
href=
"#"
class=
"new-post-btn"
><span
class=
"new-post-icon"
></span>
New Post
</a>
<article
class=
"new-post-article"
>
<span
class=
"topic"
data-discussion-id=
"
{{
discussionId
}}
"
/>
...
...
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