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
80ba9bd0
Commit
80ba9bd0
authored
May 10, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused `init_js` and `destroy_js`
parent
d393a503
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
38 deletions
+3
-38
djangoapps/courseware/management/commands/check_course.py
+1
-1
djangoapps/courseware/module_render.py
+2
-9
djangoapps/courseware/modules/vertical_module.py
+0
-9
djangoapps/courseware/modules/x_module.py
+0
-19
No files found.
djangoapps/courseware/management/commands/check_course.py
View file @
80ba9bd0
...
@@ -33,7 +33,7 @@ class Command(BaseCommand):
...
@@ -33,7 +33,7 @@ class Command(BaseCommand):
ajax_url
=
''
,
ajax_url
=
''
,
state
=
None
,
state
=
None
,
track_function
=
lambda
x
,
y
,
z
:
None
,
track_function
=
lambda
x
,
y
,
z
:
None
,
render_function
=
lambda
x
:
{
'content'
:
''
,
'
destroy_js'
:
''
,
'init_js'
:
''
,
'
type'
:
'video'
})
render_function
=
lambda
x
:
{
'content'
:
''
,
'type'
:
'video'
})
except
:
except
:
print
"==============> Error in "
,
etree
.
tostring
(
module
)
print
"==============> Error in "
,
etree
.
tostring
(
module
)
check
=
False
check
=
False
...
...
djangoapps/courseware/module_render.py
View file @
80ba9bd0
...
@@ -130,8 +130,6 @@ def render_x_module(user, request, xml_module, module_object_preload):
...
@@ -130,8 +130,6 @@ def render_x_module(user, request, xml_module, module_object_preload):
# Grab content
# Grab content
content
=
instance
.
get_html
()
content
=
instance
.
get_html
()
init_js
=
instance
.
get_init_js
()
destory_js
=
instance
.
get_destroy_js
()
# special extra information about each problem, only for users who are staff
# special extra information about each problem, only for users who are staff
if
user
.
is_staff
:
if
user
.
is_staff
:
...
@@ -140,13 +138,8 @@ def render_x_module(user, request, xml_module, module_object_preload):
...
@@ -140,13 +138,8 @@ def render_x_module(user, request, xml_module, module_object_preload):
content
=
content
+
render_to_string
(
"staff_problem_info.html"
,
{
'xml'
:
etree
.
tostring
(
xml_module
),
content
=
content
+
render_to_string
(
"staff_problem_info.html"
,
{
'xml'
:
etree
.
tostring
(
xml_module
),
'module_id'
:
module_id
,
'module_id'
:
module_id
,
'render_histogram'
:
render_histogram
})
'render_histogram'
:
render_histogram
})
if
render_histogram
:
init_js
=
init_js
+
render_to_string
(
"staff_problem_histogram.js"
,
{
'histogram'
:
histogram
,
content
=
{
'content'
:
content
,
'module_id'
:
module_id
})
content
=
{
'content'
:
content
,
"destroy_js"
:
destory_js
,
'init_js'
:
init_js
,
'type'
:
module_type
}
'type'
:
module_type
}
return
content
return
content
...
...
djangoapps/courseware/modules/vertical_module.py
View file @
80ba9bd0
...
@@ -18,17 +18,8 @@ class Module(XModule):
...
@@ -18,17 +18,8 @@ class Module(XModule):
def
get_html
(
self
):
def
get_html
(
self
):
return
render_to_string
(
'vert_module.html'
,{
'items'
:
self
.
contents
})
return
render_to_string
(
'vert_module.html'
,{
'items'
:
self
.
contents
})
def
get_init_js
(
self
):
return
self
.
init_js_text
def
get_destroy_js
(
self
):
return
self
.
destroy_js_text
def
__init__
(
self
,
system
,
xml
,
item_id
,
state
=
None
):
def
__init__
(
self
,
system
,
xml
,
item_id
,
state
=
None
):
XModule
.
__init__
(
self
,
system
,
xml
,
item_id
,
state
)
XModule
.
__init__
(
self
,
system
,
xml
,
item_id
,
state
)
xmltree
=
etree
.
fromstring
(
xml
)
xmltree
=
etree
.
fromstring
(
xml
)
self
.
contents
=
[(
e
.
get
(
"name"
),
self
.
render_function
(
e
))
\
self
.
contents
=
[(
e
.
get
(
"name"
),
self
.
render_function
(
e
))
\
for
e
in
xmltree
]
for
e
in
xmltree
]
self
.
init_js_text
=
""
.
join
([
e
[
1
][
'init_js'
]
for
e
in
self
.
contents
if
'init_js'
in
e
[
1
]])
self
.
destroy_js_text
=
""
.
join
([
e
[
1
][
'destroy_js'
]
for
e
in
self
.
contents
if
'destroy_js'
in
e
[
1
]])
djangoapps/courseware/modules/x_module.py
View file @
80ba9bd0
...
@@ -78,25 +78,6 @@ class XModule(object):
...
@@ -78,25 +78,6 @@ class XModule(object):
'''
'''
return
"Unimplemented"
return
"Unimplemented"
# TODO:
# def get_header_js(self):
# ''' Filename of common js that needs to be included in the header
# '''
# raise NotImplementedError
def
get_init_js
(
self
):
''' JavaScript code to be run when problem is shown. Be aware
that this may happen several times on the same page
(e.g. student switching tabs). Common functions should be put
in the main course .js files for now. '''
return
""
def
get_destroy_js
(
self
):
''' JavaScript called to destroy the problem (e.g. when a user switches to a different tab).
We make an attempt, but not a promise, to call this when the user closes the web page.
'''
return
""
def
handle_ajax
(
self
,
dispatch
,
get
):
def
handle_ajax
(
self
,
dispatch
,
get
):
''' dispatch is last part of the URL.
''' dispatch is last part of the URL.
get is a dictionary-like object '''
get is a dictionary-like object '''
...
...
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