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
16a4dfee
Commit
16a4dfee
authored
Aug 05, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish item picked-up event
parent
21e0ed0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletions
+25
-1
drag_and_drop_v2/drag_and_drop_v2.py
+12
-0
drag_and_drop_v2/public/js/drag_and_drop.js
+13
-1
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
16a4dfee
...
@@ -206,6 +206,18 @@ class DragAndDropBlock(XBlock):
...
@@ -206,6 +206,18 @@ class DragAndDropBlock(XBlock):
'feedback'
:
item
[
'feedback'
][
'correct'
]
if
is_correct
else
item
[
'feedback'
][
'incorrect'
]
'feedback'
:
item
[
'feedback'
][
'correct'
]
if
is_correct
else
item
[
'feedback'
][
'incorrect'
]
}
}
@XBlock.json_handler
def
publish_event
(
self
,
data
,
suffix
=
''
):
try
:
event_type
=
data
.
pop
(
'event_type'
)
except
KeyError
as
e
:
return
{
'result'
:
'error'
,
'message'
:
'Missing event_type in JSON data'
}
data
[
'component_id'
]
=
self
.
scope_ids
.
usage_id
data
[
'user_id'
]
=
self
.
runtime
.
user_id
self
.
runtime
.
publish
(
self
,
event_type
,
data
)
return
{
'result'
:
'success'
}
@staticmethod
@staticmethod
def
workbench_scenarios
():
def
workbench_scenarios
():
...
...
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
16a4dfee
...
@@ -90,7 +90,19 @@ function DragAndDropBlock(runtime, element) {
...
@@ -90,7 +90,19 @@ function DragAndDropBlock(runtime, element) {
},
},
drag
:
{
drag
:
{
start
:
function
(
event
,
ui
)
{
start
:
function
(
event
,
ui
)
{
$
(
event
.
currentTarget
).
removeClass
(
'within-dropzone fade'
);
target
=
$
(
event
.
currentTarget
);
target
.
removeClass
(
'within-dropzone fade'
);
function
publish_event
(
data
)
{
$
.
ajax
({
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
),
data
:
JSON
.
stringify
(
data
)
});
}
var
item_id
=
target
.
data
(
"value"
);
publish_event
({
event_type
:
'drag-and-drop-v2.item.picked-up'
,
item_id
:
item_id
});
},
},
stop
:
function
(
event
,
ui
)
{
stop
:
function
(
event
,
ui
)
{
...
...
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