Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
ConceptXBlock
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
ConceptXBlock
Commits
94b19d8e
Commit
94b19d8e
authored
Mar 20, 2014
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Studio view?
parent
3073110c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
concept/concept.py
+9
-15
No files found.
concept/concept.py
View file @
94b19d8e
"""TO-DO: Write a description of what this XBlock is."""
"""This XBlock allows students to edit a concept map. Why students? We
can integrate with the LMS more easily than with Studio, so it's in
many ways an easier environment where to do this."""
import
pkg_resources
...
...
@@ -14,8 +16,6 @@ class ConceptXBlock(XBlock):
This XBlock allows concept tagging in a course.
"""
# Fields are defined on the class. You can access them in your code as
# self.<fieldname>.
server
=
String
(
scope
=
Scope
.
settings
,
help
=
"Concept map server URL"
...
...
@@ -28,17 +28,13 @@ class ConceptXBlock(XBlock):
@XBlock.json_handler
def
update_concept_map
(
self
,
request
,
suffix
):
print
request
self
.
concept_map
=
json
.
dumps
(
request
)
print
"Wrote:"
,
self
.
concept_map
return
{
'success'
:
True
}
@XBlock.json_handler
def
relay_handler
(
self
,
request
,
suffix
):
#print request, type(request), dict(request)
url
=
self
.
server
+
request
[
'suffix'
]
r
=
requests
.
get
(
url
,
params
=
request
)
#print url,":", r.text[:80]
return
json
.
loads
(
r
.
text
)
def
resource_string
(
self
,
path
):
...
...
@@ -46,32 +42,30 @@ class ConceptXBlock(XBlock):
data
=
pkg_resources
.
resource_string
(
__name__
,
path
)
return
data
.
decode
(
"utf8"
)
# TO-DO: change this view to display your data your own way.
def
student_view
(
self
,
context
=
None
):
"""
The primary view of the ConceptXBlock, shown to students
when viewing courses.
"""
print
"HERE"
,
self
.
concept_map
html
=
self
.
resource_string
(
"static/html/concept.html"
)
#.replace("PLACEHOLDER_FOR_CONCEPT_MAP",json.dumps(self.concept_map))
#print self.server
#print html.format
cm
=
self
.
concept_map
print
"Read"
,
cm
frag
=
Fragment
(
html
.
replace
(
"PLACEHOLDER_FOR_CONCEPT_MAP"
,
cm
)
.
replace
(
"SERVER"
,
self
.
server
))
#)#format(server = self.server, concept_map = cm))
if
not
cm
:
cm
=
'{"required":[], "taught":[], "exercised":[]}'
frag
=
Fragment
(
html
.
replace
(
"PLACEHOLDER_FOR_CONCEPT_MAP"
,
cm
)
.
replace
(
"SERVER"
,
self
.
server
))
frag
.
add_css_url
(
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css"
)
frag
.
add_css
(
self
.
resource_string
(
"static/css/concept.css"
))
frag
.
add_javascript_url
(
"http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"
)
# frag.add_javascript_url("https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js")
frag
.
add_javascript_url
(
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"
)
frag
.
add_javascript
(
self
.
resource_string
(
"static/js/concept.js"
))
frag
.
initialize_js
(
'ConceptXBlock'
)
print
self
.
xml_text_content
()
return
frag
def
studio_view
(
self
,
context
=
None
):
return
""
# TO-DO: change this to create the scenarios you'd like to see in the
# workbench while developing your XBlock.
@staticmethod
...
...
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