Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
xblock-drag-and-drop-v2
Commits
0fdf8b10
Commit
0fdf8b10
authored
Aug 05, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add workbench scenario
parent
e8272f89
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
9 deletions
+81
-9
drag_and_drop_v2/default_data.py
+74
-0
drag_and_drop_v2/drag_and_drop_v2.py
+7
-9
No files found.
drag_and_drop_v2/default_data.py
0 → 100644
View file @
0fdf8b10
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"
},
}
drag_and_drop_v2/drag_and_drop_v2.py
View file @
0fdf8b10
...
@@ -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>"
)]
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