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
363ca703
Commit
363ca703
authored
Jan 18, 2013
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add coffeescript/js for conditional module, does XModule.loadModules
parent
19051e40
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
5 deletions
+32
-5
common/lib/xmodule/xmodule/conditional_module.py
+3
-3
common/lib/xmodule/xmodule/js/src/conditional/display.coffee
+26
-0
lms/templates/conditional_ajax.html
+1
-0
lms/templates/conditional_module.html
+2
-2
No files found.
common/lib/xmodule/xmodule/conditional_module.py
View file @
363ca703
...
...
@@ -21,12 +21,12 @@ class ConditionalModule(XModule):
'''
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/c
apa
/display.coffee'
),
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/c
onditional
/display.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
),
]}
js_module_name
=
"
Problem
"
js_module_name
=
"
Conditional
"
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/capa/display.scss'
)]}
...
...
@@ -74,7 +74,7 @@ class ConditionalModule(XModule):
def
get_html
(
self
):
self
.
is_condition_satisfied
()
return
self
.
system
.
render_template
(
'
problem
_ajax.html'
,
{
return
self
.
system
.
render_template
(
'
conditional
_ajax.html'
,
{
'element_id'
:
self
.
location
.
html_id
(),
'id'
:
self
.
id
,
'ajax_url'
:
self
.
system
.
ajax_url
,
...
...
common/lib/xmodule/xmodule/js/src/conditional/display.coffee
0 → 100644
View file @
363ca703
class
@
Conditional
constructor
:
(
element
)
->
@
el
=
$
(
element
).
find
(
'.conditional-wrapper'
)
@
id
=
@
el
.
data
(
'problem-id'
)
@
element_id
=
@
el
.
attr
(
'id'
)
@
url
=
@
el
.
data
(
'url'
)
@
render
()
$
:
(
selector
)
->
$
(
selector
,
@
el
)
updateProgress
:
(
response
)
=>
if
response
.
progress_changed
@
el
.
attr
progress
:
response
.
progress_status
@
el
.
trigger
(
'progressChanged'
)
render
:
(
content
)
->
if
content
@
el
.
html
(
content
)
XModule
.
loadModules
(
'display'
,
@
el
)
else
$
.
postWithPrefix
"
#{
@
url
}
/conditional_get"
,
(
response
)
=>
@
el
.
html
(
response
.
html
)
XModule
.
loadModules
(
'display'
,
@
el
)
lms/templates/conditional_ajax.html
0 → 100644
View file @
363ca703
<div
id=
"conditional_${element_id}"
class=
"conditional-wrapper"
data-problem-id=
"${id}"
data-url=
"${ajax_url}"
></div>
lms/templates/conditional_module.html
View file @
363ca703
...
...
@@ -4,6 +4,6 @@
course_id =
module.system.course_id
%
>
<p>
Sorry, you must complete
<a
<p><a
href=
"${reverse('jump_to',kwargs=dict(course_id=course_id, location=reqm.location.url()))}"
>
${reqm.display_name}
</a>
before this is
visible.
</p>
must be completed before this will become
visible.
</p>
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