Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
21ddc7db
Commit
21ddc7db
authored
May 23, 2014
by
Nimisha Asthagiri
Committed by
Calen Pennington
May 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed DeleteComponent on Container Page.
parent
29f7fe14
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
cms/static/js/spec/views/pages/container_spec.js
+7
-2
cms/static/js/views/container.js
+4
-4
cms/static/js/views/pages/container.js
+4
-1
No files found.
cms/static/js/spec/views/pages/container_spec.js
View file @
21ddc7db
...
@@ -218,10 +218,15 @@ define(["jquery", "underscore", "js/spec_helpers/create_sinon", "js/spec_helpers
...
@@ -218,10 +218,15 @@ define(["jquery", "underscore", "js/spec_helpers/create_sinon", "js/spec_helpers
clickDelete
(
componentIndex
);
clickDelete
(
componentIndex
);
create_sinon
.
respondWithJson
(
requests
,
{});
create_sinon
.
respondWithJson
(
requests
,
{});
//
expect request URL to contain given component's id
//
first request contains given component's id (to delete the component)
expect
(
lastRequest
()
.
url
).
toMatch
(
expect
(
requests
[
requests
.
length
-
2
]
.
url
).
toMatch
(
new
RegExp
(
"locator-component-"
+
GROUP_TO_TEST
+
(
componentIndex
+
1
))
new
RegExp
(
"locator-component-"
+
GROUP_TO_TEST
+
(
componentIndex
+
1
))
);
);
// second request contains parent's id (to remove as child)
expect
(
lastRequest
().
url
).
toMatch
(
new
RegExp
(
"locator-group-"
+
GROUP_TO_TEST
)
);
};
};
deleteComponentWithSuccess
=
function
(
componentIndex
)
{
deleteComponentWithSuccess
=
function
(
componentIndex
)
{
...
...
cms/static/js/views/container.js
View file @
21ddc7db
...
@@ -41,12 +41,12 @@ define(["jquery", "underscore", "js/views/xblock", "js/utils/module", "gettext",
...
@@ -41,12 +41,12 @@ define(["jquery", "underscore", "js/views/xblock", "js/utils/module", "gettext",
// avoid creating an orphan if the addition fails.
// avoid creating an orphan if the addition fails.
if
(
newParent
)
{
if
(
newParent
)
{
removeFromParent
=
oldParent
;
removeFromParent
=
oldParent
;
self
.
reorder
(
newParent
,
function
()
{
self
.
updateChildren
(
newParent
,
function
()
{
self
.
reorder
(
removeFromParent
,
hideSaving
);
self
.
updateChildren
(
removeFromParent
,
hideSaving
);
});
});
}
else
{
}
else
{
// No new parent, only reordering within same container.
// No new parent, only reordering within same container.
self
.
reorder
(
oldParent
,
hideSaving
);
self
.
updateChildren
(
oldParent
,
hideSaving
);
}
}
oldParent
=
undefined
;
oldParent
=
undefined
;
...
@@ -79,7 +79,7 @@ define(["jquery", "underscore", "js/views/xblock", "js/utils/module", "gettext",
...
@@ -79,7 +79,7 @@ define(["jquery", "underscore", "js/views/xblock", "js/utils/module", "gettext",
});
});
},
},
reorder
:
function
(
targetParent
,
successCallback
)
{
updateChildren
:
function
(
targetParent
,
successCallback
)
{
var
children
,
childLocators
;
var
children
,
childLocators
;
// Find descendants with class "studio-xblock-wrapper" whose parent === targetParent.
// Find descendants with class "studio-xblock-wrapper" whose parent === targetParent.
...
...
cms/static/js/views/pages/container.js
View file @
21ddc7db
...
@@ -152,9 +152,12 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification",
...
@@ -152,9 +152,12 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification",
type
:
'DELETE'
,
type
:
'DELETE'
,
url
:
self
.
getURLRoot
()
+
"/"
+
url
:
self
.
getURLRoot
()
+
"/"
+
xblockElement
.
data
(
'locator'
)
+
"?"
+
xblockElement
.
data
(
'locator'
)
+
"?"
+
$
.
param
({
recurse
:
true
,
all_versions
:
tru
e
})
$
.
param
({
recurse
:
true
,
all_versions
:
fals
e
})
}).
success
(
function
()
{
}).
success
(
function
()
{
// get the parent so we can remove this component from its parent.
var
parent
=
self
.
findXBlockElement
(
xblockElement
.
parent
());
xblockElement
.
remove
();
xblockElement
.
remove
();
self
.
xblockView
.
updateChildren
(
parent
);
});
});
});
});
});
});
...
...
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