Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-utils
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
xblock-utils
Commits
7e7e6fc2
Commit
7e7e6fc2
authored
Sep 08, 2016
by
Tim Krones
Committed by
GitHub
Sep 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39 from eliangcs/master
Fix bug: Single-instance buttons do nothing after disabled
parents
3dd2fce4
353f0123
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
xblockutils/public/studio_container.js
+11
-6
No files found.
xblockutils/public/studio_container.js
View file @
7e7e6fc2
function
StudioContainerXBlockWithNestedXBlocksMixin
(
runtime
,
element
)
{
var
$buttons
=
$
(
".add-xblock-component-button"
,
element
),
$addComponent
=
$
(
'.add-xblock-component'
,
element
),
$element
=
$
(
element
);
function
isSingleInstance
(
$button
)
{
return
$button
.
data
(
'single-instance'
);
}
$buttons
.
click
(
function
(
ev
)
{
var
$this
=
$
(
this
);
if
(
$this
.
is
(
'.disabled'
))
{
// We use delegated events here, i.e., not binding a click event listener
// directly to $buttons, because we want to make sure any other click event
// listeners of the button are called first before we disable the button.
// Ref: OSPR-1393
$addComponent
.
on
(
'click'
,
'.add-xblock-component-button'
,
function
(
ev
)
{
var
$button
=
$
(
ev
.
currentTarget
);
if
(
$button
.
is
(
'.disabled'
))
{
ev
.
preventDefault
();
ev
.
stopPropagation
();
}
else
{
if
(
isSingleInstance
(
$
this
))
{
$
this
.
addClass
(
'disabled'
);
$
this
.
attr
(
'disabled'
,
'disabled'
);
if
(
isSingleInstance
(
$
button
))
{
$
button
.
addClass
(
'disabled'
);
$
button
.
attr
(
'disabled'
,
'disabled'
);
}
}
});
...
...
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