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
ed24dbef
Commit
ed24dbef
authored
Apr 01, 2015
by
Sven Marnach
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #30 from open-craft/smarnach/zone-deletion
Fix zone deletion.
parents
0b8af86c
8869d0c2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
drag_and_drop_v2/public/js/drag_and_drop_edit.js
+14
-3
No files found.
drag_and_drop_v2/public/js/drag_and_drop_edit.js
View file @
ed24dbef
...
...
@@ -145,7 +145,7 @@ function DragAndDropEditBlock(runtime, element) {
name
=
'zone-'
,
$elements
=
_fn
.
build
.
$el
,
num
,
o
bj
;
zoneO
bj
;
if
(
!
oldZone
)
oldZone
=
{};
...
...
@@ -168,7 +168,9 @@ function DragAndDropEditBlock(runtime, element) {
_fn
.
build
.
form
.
zone
.
obj
.
push
(
zoneObj
);
// Add fields to zone position form
$elements
.
zones
.
form
.
append
(
inputTemplate
(
zoneObj
));
$zoneNode
=
$
(
inputTemplate
(
zoneObj
));
$zoneNode
.
data
(
'index'
,
num
);
$elements
.
zones
.
form
.
append
(
$zoneNode
);
_fn
.
build
.
form
.
zone
.
enableDelete
();
// Add zone div to target
...
...
@@ -183,12 +185,21 @@ function DragAndDropEditBlock(runtime, element) {
remove
:
function
(
e
)
{
var
$el
=
$
(
e
.
currentTarget
).
closest
(
'.zone-row'
),
classes
=
$el
.
attr
(
'class'
),
id
=
classes
.
slice
(
classes
.
indexOf
(
'zone-row'
)
+
9
);
id
=
classes
.
slice
(
classes
.
indexOf
(
'zone-row'
)
+
9
),
index
=
$el
.
data
(
'index'
),
array_index
;
e
.
preventDefault
();
$el
.
detach
();
$
(
'#'
+
id
,
element
).
detach
();
// Find the index of the zone in the array and remove it.
for
(
array_index
=
0
;
array_index
<
_fn
.
build
.
form
.
zone
.
obj
.
length
;
array_index
++
)
{
if
(
_fn
.
build
.
form
.
zone
.
obj
[
array_index
].
index
==
index
)
break
;
}
_fn
.
build
.
form
.
zone
.
obj
.
splice
(
array_index
,
1
);
_fn
.
build
.
form
.
zone
.
formCount
--
;
_fn
.
build
.
form
.
zone
.
disableDelete
();
...
...
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