Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
RecommenderXBlock
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
RecommenderXBlock
Commits
9b07e807
Commit
9b07e807
authored
Jan 27, 2015
by
swdanielli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initialize template_lookup
parent
1148e2b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
recommender/recommender.py
+19
-11
No files found.
recommender/recommender.py
View file @
9b07e807
...
@@ -384,6 +384,22 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -384,6 +384,22 @@ class RecommenderXBlock(HelperXBlock):
response
.
body
=
json
.
dumps
({
'error'
:
error
})
response
.
body
=
json
.
dumps
({
'error'
:
error
})
return
response
return
response
def
_init_template_lookup
(
self
):
"""
Initialize template_lookup by adding mappings between strings and urls.
"""
global
template_lookup
template_lookup
=
TemplateLookup
()
template_lookup
.
put_string
(
"recommenderstudio.html"
,
self
.
resource_string
(
"static/html/recommenderstudio.html"
))
template_lookup
.
put_string
(
"recommender.html"
,
self
.
resource_string
(
"static/html/recommender.html"
))
template_lookup
.
put_string
(
"resourcebox.html"
,
self
.
resource_string
(
"static/html/resourcebox.html"
))
def
get_client_side_settings
(
self
):
def
get_client_side_settings
(
self
):
"""
"""
Return the parameters for client-side configuration settings.
Return the parameters for client-side configuration settings.
...
@@ -892,13 +908,7 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -892,13 +908,7 @@ class RecommenderXBlock(HelperXBlock):
global
template_lookup
global
template_lookup
if
not
template_lookup
:
if
not
template_lookup
:
template_lookup
=
TemplateLookup
()
self
.
_init_template_lookup
()
template_lookup
.
put_string
(
"recommender.html"
,
self
.
resource_string
(
"static/html/recommender.html"
))
template_lookup
.
put_string
(
"resourcebox.html"
,
self
.
resource_string
(
"static/html/resourcebox.html"
))
# Ideally, we'd estimate score based on votes, such that items with
# Ideally, we'd estimate score based on votes, such that items with
# 1 vote have a sensible ranking (rather than a perfect rating)
# 1 vote have a sensible ranking (rather than a perfect rating)
...
@@ -949,10 +959,8 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -949,10 +959,8 @@ class RecommenderXBlock(HelperXBlock):
"""
"""
global
template_lookup
global
template_lookup
if
not
template_lookup
:
if
not
template_lookup
:
template_lookup
=
TemplateLookup
()
self
.
_init_template_lookup
()
template_lookup
.
put_string
(
"recommenderstudio.html"
,
self
.
resource_string
(
"static/html/recommenderstudio.html"
))
frag
=
Fragment
(
template_lookup
.
get_template
(
"recommenderstudio.html"
)
.
render
())
frag
=
Fragment
(
template_lookup
.
get_template
(
"recommenderstudio.html"
)
.
render
())
frag
.
add_css
(
pkg_resources
.
resource_string
(
__name__
,
"static/css/recommenderstudio.css"
))
frag
.
add_css
(
pkg_resources
.
resource_string
(
__name__
,
"static/css/recommenderstudio.css"
))
frag
.
add_javascript_url
(
"//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"
)
frag
.
add_javascript_url
(
"//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"
)
...
...
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