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
5d403493
Commit
5d403493
authored
Aug 02, 2012
by
Dhaval Adjodah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trying to figure out handle ajax/coffeescript
parent
f8d3a024
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
12 deletions
+28
-12
common/lib/xmodule/xmodule/survey_module.py
+28
-12
No files found.
common/lib/xmodule/xmodule/survey_module.py
View file @
5d403493
...
...
@@ -3,6 +3,7 @@ import logging
from
lxml
import
etree
from
pkg_resources
import
resource_string
from
xmodule.x_module
import
XModule
from
xmodule.raw_module
import
RawDescriptor
...
...
@@ -13,11 +14,11 @@ class SurveyModule(XModule):
video_time
=
0
icon_class
=
'video'
# js = {'coffee': [resource_string(__name__, 'js/src/capa
/display.coffee')],
#
'js': [resource_string(__name__, 'js/src/capa/imageinput.js'),
#
resource_string(__name__, 'js/src/capa/schematic.js')]}
# js_module_name = "Problem
"
#
css = {'scss': [resource_string(__name__, 'css/capa/display.scss')]}
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/survey
/display.coffee'
)],
'js'
:
[
resource_string
(
__name__
,
'js/src/capa/imageinput.js'
),
resource_string
(
__name__
,
'js/src/capa/schematic.js'
)]}
js_module_name
=
"Survey
"
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/capa/display.scss'
)]}
def
__init__
(
self
,
system
,
location
,
definition
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
instance_state
,
shared_state
,
**
kwargs
)
...
...
@@ -33,12 +34,12 @@ class SurveyModule(XModule):
# <section format="Video" name="Welcome">
# <video youtube="0.75:izygArpw-Qo,1.0:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"/>
# </section>
def
get_html
(
self
):
return
self
.
system
.
render_template
(
'problem_ajax.html'
,
{
'element_id'
:
self
.
location
.
html_id
(),
'id'
:
self
.
id
,
'ajax_url'
:
self
.
system
.
ajax_url
,
})
#
def get_html(self):
#
return self.system.render_template('problem_ajax.html', {
#
'element_id': self.location.html_id(),
#
'id': self.id,
#
'ajax_url': self.system.ajax_url,
#
})
def
handle_ajax
(
self
,
dispatch
,
get
):
...
...
@@ -49,6 +50,18 @@ class SurveyModule(XModule):
# log.info(u"NEW POSITION {0}".format(self.position))
# return json.dumps({'success':True})
# raise Http404()
handlers
=
{
'problem_show'
:
self
.
get_answer
}
if
dispatch
not
in
handlers
:
print
'Error poop'
return
'Error'
# return json.dumps(d, cls=ComplexEncoder)
print
"poop"
print
dispatch
print
get
...
...
@@ -70,7 +83,10 @@ class SurveyModule(XModule):
return
self
.
question_list
#dirty test:
def
survey_context
(
self
):
self
.
context
=
{
'took_survey'
:
False
,
self
.
context
=
{
'element_id'
:
self
.
location
.
html_id
(),
'id'
:
self
.
id
,
'ajax_url'
:
self
.
system
.
ajax_url
,
'took_survey'
:
False
,
'survey_list'
:
self
.
survey_question_list
(),
'survey_name'
:
self
.
name
}
return
self
.
context
...
...
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