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
cb9bd01c
Commit
cb9bd01c
authored
Jul 05, 2014
by
Filippo Valsorda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly detect a finished state also when there is not feedback
parent
c2ad71f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
drag_and_drop_v2/drag_and_drop_v2.py
+8
-1
drag_and_drop_v2/public/js/drag_and_drop.js
+4
-4
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
cb9bd01c
...
...
@@ -161,7 +161,10 @@ class DragAndDropBlock(XBlock):
if
len
(
self
.
item_state
)
!=
tot_items
:
del
data
[
'feedback'
][
'finish'
]
data
[
'state'
]
=
self
.
item_state
data
[
'state'
]
=
{
'items'
:
self
.
item_state
,
'finished'
:
len
(
self
.
item_state
)
==
tot_items
}
return
webob
.
response
.
Response
(
body
=
json
.
dumps
(
data
))
...
...
@@ -174,8 +177,10 @@ class DragAndDropBlock(XBlock):
self
.
item_state
[
item
[
'id'
]]
=
(
attempt
[
'top'
],
attempt
[
'left'
])
if
len
(
self
.
item_state
)
==
tot_items
:
finished
=
True
final_feedback
=
self
.
data
[
'feedback'
][
'finish'
]
else
:
finished
=
False
final_feedback
=
None
try
:
...
...
@@ -190,12 +195,14 @@ class DragAndDropBlock(XBlock):
return
{
'correct'
:
True
,
'finished'
:
finished
,
'final_feedback'
:
final_feedback
,
'feedback'
:
item
[
'feedback'
][
'correct'
]
}
else
:
return
{
'correct'
:
False
,
'finished'
:
finished
,
'final_feedback'
:
None
,
'feedback'
:
item
[
'feedback'
][
'incorrect'
]
}
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
cb9bd01c
...
...
@@ -55,7 +55,7 @@ function DragAndDropBlock(runtime, element) {
_fn
.
items
.
init
();
// Load welcome or final feedback
if
(
_fn
.
data
.
feedback
.
finish
)
if
(
_fn
.
data
.
state
.
finished
)
_fn
.
finish
(
_fn
.
data
.
feedback
.
finish
);
else
_fn
.
feedback
.
set
(
_fn
.
data
.
feedback
.
start
);
...
...
@@ -70,7 +70,7 @@ function DragAndDropBlock(runtime, element) {
_fn
.
$items
.
draggable
(
'disable'
);
// Show final feedback
_fn
.
feedback
.
set
(
final_feedback
);
if
(
final_feedback
)
_fn
.
feedback
.
set
(
final_feedback
);
},
clickHandlers
:
{
...
...
@@ -109,7 +109,7 @@ function DragAndDropBlock(runtime, element) {
if
(
data
.
correct
)
{
$el
.
draggable
(
'disable'
);
if
(
data
.
fin
al_feedback
)
{
if
(
data
.
fin
ished
)
{
_fn
.
finish
(
data
.
final_feedback
);
}
}
else
{
...
...
@@ -155,7 +155,7 @@ function DragAndDropBlock(runtime, element) {
init
:
function
()
{
_fn
.
$items
.
each
(
function
(){
var
$el
=
$
(
this
),
saved_entry
=
_fn
.
data
.
state
[
$el
.
data
(
'value'
)];
saved_entry
=
_fn
.
data
.
state
.
items
[
$el
.
data
(
'value'
)];
if
(
saved_entry
)
{
_fn
.
clickHandlers
.
drag
.
set
(
$el
,
saved_entry
[
0
],
saved_entry
[
1
]);
...
...
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