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
7750bb47
Commit
7750bb47
authored
Sep 28, 2012
by
kimth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #788 from MITx/bug/tomg/new-collapsibles
Added HTML and Problem collapsibles
parents
1977b42d
04119cce
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
33 deletions
+50
-33
common/lib/xmodule/xmodule/html_module.py
+3
-0
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+18
-0
common/lib/xmodule/xmodule/js/src/html/display.coffee
+27
-0
lms/templates/problem.html
+2
-33
No files found.
common/lib/xmodule/xmodule/html_module.py
View file @
7750bb47
...
...
@@ -17,6 +17,9 @@ log = logging.getLogger("mitx.courseware")
class
HtmlModule
(
XModule
):
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/html/display.coffee'
)]}
js_module_name
=
"HTMLModule"
def
get_html
(
self
):
return
self
.
html
...
...
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
7750bb47
...
...
@@ -26,6 +26,13 @@ class @Problem
@
$
(
'section.action input.show'
).
click
@
show
@
$
(
'section.action input.save'
).
click
@
save
# Collapsibles
@
$
(
'.longform'
).
hide
();
@
$
(
'.shortform'
).
append
(
'<a href="#" class="full">See full output</a>'
);
@
$
(
'.collapsible section'
).
hide
();
@
$
(
'.full'
).
click
@
toggleFull
@
$
(
'.collapsible header a'
).
click
@
toggleHint
# Dynamath
@
$
(
'input.math'
).
keyup
(
@
refreshMath
)
@
$
(
'input.math'
).
each
(
index
,
element
)
=>
...
...
@@ -333,6 +340,17 @@ class @Problem
element
.
CodeMirror
.
save
()
if
element
.
CodeMirror
.
save
@
answers
=
@
inputs
.
serialize
()
toggleFull
:
(
event
)
=>
$
(
event
.
target
).
parent
().
siblings
().
slideToggle
()
$
(
event
.
target
).
parent
().
parent
().
toggleClass
(
'open'
)
text
=
$
(
event
.
target
).
text
()
==
'See full output'
?
'Hide output'
:
'See full output'
$
(
this
).
text
(
text
)
toggleHint
:
(
event
)
=>
event
.
preventDefault
()
$
(
event
.
target
).
parent
().
siblings
().
slideToggle
()
$
(
event
.
target
).
parent
().
parent
().
toggleClass
(
'open'
)
inputtypeSetupMethods
:
'text-input-dynamath'
:
(
element
)
=>
...
...
common/lib/xmodule/xmodule/js/src/html/display.coffee
0 → 100644
View file @
7750bb47
class
@
HTMLModule
constructor
:
(
@
element
)
->
@
el
=
$
(
@
element
)
@
setCollapsibles
()
$
:
(
selector
)
->
$
(
selector
,
@
el
)
setCollapsibles
:
=>
$
(
'.longform'
).
hide
();
$
(
'.shortform'
).
append
(
'<a href="#" class="full">See full output</a>'
);
$
(
'.collapsible section'
).
hide
();
$
(
'.full'
).
click
@
toggleFull
$
(
'.collapsible header a'
).
click
@
toggleHint
toggleFull
:
(
event
)
=>
$
(
event
.
target
).
parent
().
siblings
().
slideToggle
()
$
(
event
.
target
).
parent
().
parent
().
toggleClass
(
'open'
)
text
=
$
(
event
.
target
).
text
()
==
'See full output'
?
'Hide output'
:
'See full output'
$
(
this
).
text
(
text
)
toggleHint
:
(
event
)
=>
event
.
preventDefault
()
$
(
event
.
target
).
parent
().
siblings
().
slideToggle
()
$
(
event
.
target
).
parent
().
parent
().
toggleClass
(
'open'
)
\ No newline at end of file
lms/templates/problem.html
View file @
7750bb47
...
...
@@ -30,36 +30,4 @@
</section>
% endif
</section>
</section>
<
%
block
name=
"js_extra"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
var
collapsibleSet
;
$
(
function
(){
// this should be brought back into problems
$
(
'.longform'
).
hide
();
$
(
'.shortform'
).
append
(
'<a href="#" class="full">See full output</a>'
);
$
(
'.full'
).
click
(
function
()
{
$
(
this
).
parent
().
siblings
().
slideToggle
();
$
(
this
).
parent
().
parent
().
toggleClass
(
'open'
);
var
text
=
$
(
this
).
text
()
==
'See full output'
?
'Hide output'
:
'See full output'
;
$
(
this
).
text
(
text
);
return
false
;
});
function
toggleHint
(
e
)
{
$
(
this
).
parent
().
siblings
().
slideToggle
();
$
(
this
).
parent
().
parent
().
toggleClass
(
'open'
);
return
false
;
}
if
(
!
collapsibleSet
)
{
collapsibleSet
=
true
;
$
(
'.collapsible section'
).
hide
();
$
(
'.collapsible header a'
).
bind
(
'click'
,
toggleHint
);
}
});
</script>
</
%
block>
</section>
\ No newline at end of file
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