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
f24e09fc
Commit
f24e09fc
authored
Sep 14, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9732 from open-craft/fix-add-component
Fix add component buttons to be backward compatible
parents
0a434e43
7647fd9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
cms/static/js/spec/views/pages/container_spec.js
+19
-0
cms/static/js/views/components/add_xblock.js
+2
-2
No files found.
cms/static/js/spec/views/pages/container_spec.js
View file @
f24e09fc
...
...
@@ -574,6 +574,25 @@ define(["jquery", "underscore", "underscore.string", "common/js/spec_helpers/aja
});
});
it
(
'also works for older-style add component links'
,
function
()
{
// Some third party xblocks (problem-builder in particular) expect add
// event handlers on custom <a> add buttons which is what the platform
// used to use instead of <button>s.
// This can be removed once there is a proper API that XBlocks can use
// to add children or allow authors to add children.
renderContainerPage
(
this
,
mockContainerXBlockHtml
);
$
(
".add-xblock-component-button"
).
each
(
function
()
{
var
htmlAsLink
=
$
(
$
(
this
).
prop
(
'outerHTML'
).
replace
(
/
(
<
\/?)
button/g
,
"$1a"
));
$
(
this
).
replaceWith
(
htmlAsLink
);
});
$
(
".add-xblock-component-button"
).
first
().
click
();
EditHelpers
.
verifyXBlockRequest
(
requests
,
{
"category"
:
"discussion"
,
"type"
:
"discussion"
,
"parent_locator"
:
"locator-group-A"
});
});
it
(
'shows a notification while creating'
,
function
()
{
var
notificationSpy
=
EditHelpers
.
createNotificationSpy
();
renderContainerPage
(
this
,
mockContainerXBlockHtml
);
...
...
cms/static/js/views/components/add_xblock.js
View file @
f24e09fc
...
...
@@ -6,8 +6,8 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "common/js/compo
function
(
$
,
_
,
gettext
,
BaseView
,
ViewUtils
,
AddXBlockButton
,
AddXBlockMenu
)
{
var
AddXBlockComponent
=
BaseView
.
extend
({
events
:
{
'click .new-component .new-component-type
button
.multiple-templates'
:
'showComponentTemplates'
,
'click .new-component .new-component-type
button
.single-template'
:
'createNewComponent'
,
'click .new-component .new-component-type .multiple-templates'
:
'showComponentTemplates'
,
'click .new-component .new-component-type .single-template'
:
'createNewComponent'
,
'click .new-component .cancel-button'
:
'closeNewComponent'
,
'click .new-component-templates .new-component-template .button-component'
:
'createNewComponent'
,
'click .new-component-templates .cancel-button'
:
'closeNewComponent'
...
...
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