Commit 0fdf8b10 by dragonfi

Add workbench scenario

parent e8272f89
default_data = {
"zones": [
{
"index": 1,
"width": 200,
"title": "Zone A",
"height": 100,
"x": "120",
"y": "200",
"id": "zone-1"
},
{
"index": 2,
"width": 200,
"title": "Zone B",
"height": 100,
"x": "120",
"y": "360",
"id": "zone-2"
}
],
"items": [
{
"displayName": "A",
"feedback": {
"incorrect": "No, A does not belong here",
"correct": "Yes, it's an A"
},
"zone": "Zone A",
"backgroundImage": "",
"id": 0,
"size": {
"width": "190px",
"height": "auto"
}
},
{
"displayName": "B",
"feedback": {
"incorrect": "No, B does not belong here",
"correct": "Yes, it's a B"
},
"zone": "Zone B",
"backgroundImage": "",
"id": 1,
"size": {
"width": "190px",
"height": "auto"
}
},
{
"displayName": "X",
"feedback": {
"incorrect": "You silly, there are no zones for X",
"correct": ""
},
"zone": "none",
"backgroundImage": "",
"id": 2,
"size": {
"width": "100px",
"height": "100px"
}
},
],
"state": {
"items": {},
"finished": True
},
"feedback": {
"start": "Intro Feed",
"finish": "Final Feed"
},
}
...@@ -14,6 +14,7 @@ from xblock.fields import Scope, String, Dict, Float ...@@ -14,6 +14,7 @@ from xblock.fields import Scope, String, Dict, Float
from xblock.fragment import Fragment from xblock.fragment import Fragment
from .utils import render_template, load_resource from .utils import render_template, load_resource
from .default_data import default_data
# Globals ########################################################### # Globals ###########################################################
...@@ -52,15 +53,7 @@ class DragAndDropBlock(XBlock): ...@@ -52,15 +53,7 @@ class DragAndDropBlock(XBlock):
display_name="Drag and Drop", display_name="Drag and Drop",
help="JSON spec as generated by the builder", help="JSON spec as generated by the builder",
scope=Scope.content, scope=Scope.content,
default={ default=default_data
'feedback': {
'start': '',
'finish': ''
},
'items': [],
'zones': [],
'targetImg': None
}
) )
item_state = Dict( item_state = Dict(
...@@ -204,3 +197,8 @@ class DragAndDropBlock(XBlock): ...@@ -204,3 +197,8 @@ class DragAndDropBlock(XBlock):
'final_feedback': None, 'final_feedback': None,
'feedback': item['feedback']['incorrect'] 'feedback': item['feedback']['incorrect']
} }
@staticmethod
def workbench_scenarios():
"""A canned scenario for display in the workbench."""
return [("Drag-and-drop-v2 scenario", "<vertical_demo><drag-and-drop-v2/></vertical_demo>")]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment