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
eb030cc6
Commit
eb030cc6
authored
Mar 02, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load image resources with local_resource_url()
parent
27b6ba9c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
6 deletions
+10
-6
mentoring/light_children.py
+3
-0
mentoring/mentoring.py
+4
-3
mentoring/public/img/correct-icon.png
+0
-0
mentoring/public/img/immunity-map-assumptions-bg.png
+0
-0
mentoring/public/img/immunity-map-bg.png
+0
-0
mentoring/table.py
+2
-2
setup.py
+1
-1
No files found.
mentoring/light_children.py
View file @
eb030cc6
...
@@ -57,6 +57,7 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
...
@@ -57,6 +57,7 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
* get_children_objects()
* get_children_objects()
* Functionality of XBlockWithChildrenFragmentsMixin
* Functionality of XBlockWithChildrenFragmentsMixin
* self.xblock_container for when we need a real XBlock reference
Other changes caused by LightChild use:
Other changes caused by LightChild use:
...
@@ -152,6 +153,7 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
...
@@ -152,6 +153,7 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
"""
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
XBlockWithLightChildren
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
XBlockWithLightChildren
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
xblock_container
=
self
self
.
load_children_from_xml_content
()
self
.
load_children_from_xml_content
()
@XBlock.json_handler
@XBlock.json_handler
...
@@ -184,6 +186,7 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -184,6 +186,7 @@ class LightChild(Plugin, LightChildrenMixin):
def
__init__
(
self
,
parent
):
def
__init__
(
self
,
parent
):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
xblock_container
=
parent
.
xblock_container
@property
@property
def
runtime
(
self
):
def
runtime
(
self
):
...
...
mentoring/mentoring.py
View file @
eb030cc6
...
@@ -69,6 +69,9 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -69,6 +69,9 @@ class MentoringBlock(XBlockWithLightChildren):
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
not_instance_of
=
MentoringMessageBlock
)
not_instance_of
=
MentoringMessageBlock
)
correct_icon_url
=
self
.
runtime
.
local_resource_url
(
self
.
xblock_container
,
'public/img/correct-icon.png'
)
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
'self'
:
self
,
'self'
:
self
,
'named_children'
:
named_children
,
'named_children'
:
named_children
,
...
@@ -77,10 +80,8 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -77,10 +80,8 @@ class MentoringBlock(XBlockWithLightChildren):
fragment
.
add_css
(
load_resource
(
'static/css/mentoring.css'
))
fragment
.
add_css
(
load_resource
(
'static/css/mentoring.css'
))
fragment
.
add_javascript
(
load_resource
(
'static/js/vendor/underscore-min.js'
))
fragment
.
add_javascript
(
load_resource
(
'static/js/vendor/underscore-min.js'
))
fragment
.
add_javascript
(
load_resource
(
'static/js/mentoring.js'
))
fragment
.
add_javascript
(
load_resource
(
'static/js/mentoring.js'
))
# TODO-LMS-WORKAROUND: Use self.runtime.resources_url() when supported
fragment
.
add_resource
(
load_resource
(
'templates/html/mentoring_progress.html'
)
.
format
(
fragment
.
add_resource
(
load_resource
(
'templates/html/mentoring_progress.html'
)
.
format
(
completed
=
'/static/images/correct-icon.png'
),
completed
=
correct_icon_url
),
"text/html"
)
"text/html"
)
fragment
.
initialize_js
(
'MentoringBlock'
)
fragment
.
initialize_js
(
'MentoringBlock'
)
...
...
mentoring/public/img/correct-icon.png
0 → 100644
View file @
eb030cc6
224 Bytes
mentoring/
stat
ic/img/immunity-map-assumptions-bg.png
→
mentoring/
publ
ic/img/immunity-map-assumptions-bg.png
View file @
eb030cc6
File moved
mentoring/
stat
ic/img/immunity-map-bg.png
→
mentoring/
publ
ic/img/immunity-map-bg.png
View file @
eb030cc6
File moved
mentoring/table.py
View file @
eb030cc6
...
@@ -54,8 +54,8 @@ class MentoringTableBlock(LightChild):
...
@@ -54,8 +54,8 @@ class MentoringTableBlock(LightChild):
view_name
=
'mentoring_table_view'
)
view_name
=
'mentoring_table_view'
)
f
,
header_frags
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_table_header_view'
)
f
,
header_frags
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_table_header_view'
)
# TODO: What's the right way to link to images from CSS? This hack won't work in prod
bg_image_url
=
self
.
runtime
.
local_resource_url
(
self
.
xblock_container
,
bg_image_url
=
''
#self.runtime.resources_url('mentoring
/img/{}-bg.png'.format(self.type))
'public
/img/{}-bg.png'
.
format
(
self
.
type
))
# Load an optional description for the background image, for accessibility
# Load an optional description for the background image, for accessibility
try
:
try
:
...
...
setup.py
View file @
eb030cc6
...
@@ -71,5 +71,5 @@ setup(
...
@@ -71,5 +71,5 @@ setup(
'xblock.v1'
:
BLOCKS
,
'xblock.v1'
:
BLOCKS
,
'xblock.light_children'
:
BLOCKS_CHILDREN
,
'xblock.light_children'
:
BLOCKS_CHILDREN
,
},
},
package_data
=
package_data
(
"mentoring"
,
[
"static"
,
"templates"
]),
package_data
=
package_data
(
"mentoring"
,
[
"static"
,
"templates"
,
"public"
]),
)
)
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