Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
cc2026a4
Commit
cc2026a4
authored
Sep 23, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #83 from aboudreault/lightchild-changes
Various changes in LightChildren
parents
0f58a6fc
1707e565
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
mentoring/html.py
+9
-4
mentoring/light_children.py
+6
-0
mentoring/questionnaire.py
+8
-2
No files found.
mentoring/html.py
View file @
cc2026a4
...
@@ -56,10 +56,15 @@ class HTMLBlock(LightChild):
...
@@ -56,10 +56,15 @@ class HTMLBlock(LightChild):
return
block
return
block
def
student_view
(
self
,
context
=
None
):
def
student_view
(
self
,
context
=
None
):
return
Fragment
(
u"<script type='text/template' id='{}'>
\n
{}
\n
</script>"
.
format
(
if
context
.
get
(
'as_template'
,
True
):
'light-child-template'
,
return
Fragment
(
u"<script type='text/template' id='{}'>
\n
{}
\n
</script>"
.
format
(
self
.
content
'light-child-template'
,
))
self
.
content
))
# bug? got AssertionError if I don't use unicode here. (assert isinstance(content, unicode))
# Although it is set when constructed?
return
Fragment
(
unicode
(
self
.
content
))
def
mentoring_view
(
self
,
context
=
None
):
def
mentoring_view
(
self
,
context
=
None
):
return
self
.
student_view
(
context
)
return
self
.
student_view
(
context
)
...
...
mentoring/light_children.py
View file @
cc2026a4
...
@@ -210,9 +210,12 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -210,9 +210,12 @@ class LightChild(Plugin, LightChildrenMixin):
Base class for the light children
Base class for the light children
"""
"""
entry_point
=
'xblock.light_children'
entry_point
=
'xblock.light_children'
block_type
=
None
def
__init__
(
self
,
parent
):
def
__init__
(
self
,
parent
):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
location
=
parent
.
location
self
.
scope_ids
=
parent
.
scope_ids
self
.
xblock_container
=
parent
.
xblock_container
self
.
xblock_container
=
parent
.
xblock_container
self
.
_student_data_loaded
=
False
self
.
_student_data_loaded
=
False
...
@@ -313,6 +316,9 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -313,6 +316,9 @@ class LightChild(Plugin, LightChildrenMixin):
)
)
return
lightchild_data
return
lightchild_data
def
local_resource_url
(
self
,
block
,
uri
):
return
self
.
runtime
.
local_resource_url
(
block
,
uri
,
block_type
=
self
.
block_type
)
class
LightChildField
(
object
):
class
LightChildField
(
object
):
"""
"""
...
...
mentoring/questionnaire.py
View file @
cc2026a4
...
@@ -73,14 +73,17 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
...
@@ -73,14 +73,17 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
return
block
return
block
def
mentoring
_view
(
self
,
context
=
None
):
def
student
_view
(
self
,
context
=
None
):
name
=
self
.
__class__
.
__name__
name
=
self
.
__class__
.
__name__
as_template
=
context
.
get
(
'as_template'
,
True
)
if
str
(
self
.
type
)
not
in
self
.
valid_types
:
if
str
(
self
.
type
)
not
in
self
.
valid_types
:
raise
ValueError
,
u'Invalid value for {}.type: `{}`'
.
format
(
name
,
self
.
type
)
raise
ValueError
,
u'Invalid value for {}.type: `{}`'
.
format
(
name
,
self
.
type
)
template_path
=
'templates/html/{}_{}.html'
.
format
(
name
.
lower
(),
self
.
type
)
template_path
=
'templates/html/{}_{}.html'
.
format
(
name
.
lower
(),
self
.
type
)
html
=
render_js_template
(
template_path
,
{
render_function
=
render_js_template
if
as_template
else
render_template
html
=
render_function
(
template_path
,
{
'self'
:
self
,
'self'
:
self
,
'custom_choices'
:
self
.
custom_choices
'custom_choices'
:
self
.
custom_choices
})
})
...
@@ -94,6 +97,9 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
...
@@ -94,6 +97,9 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
fragment
.
initialize_js
(
name
)
fragment
.
initialize_js
(
name
)
return
fragment
return
fragment
def
mentoring_view
(
self
,
context
=
None
):
return
self
.
student_view
(
context
)
@property
@property
def
custom_choices
(
self
):
def
custom_choices
(
self
):
custom_choices
=
[]
custom_choices
=
[]
...
...
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