Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
problem-builder
Commits
433ce153
Commit
433ce153
authored
Sep 22, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow only one review step per mentoring block.
parent
defaff35
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
problem_builder/public/js/mentoring_with_steps_edit.js
+25
-9
No files found.
problem_builder/public/js/mentoring_with_steps_edit.js
View file @
433ce153
function
MentoringWithStepsEdit
(
runtime
,
element
)
{
"use strict"
;
// Disable "add" buttons when a message of that type already exists:
var
$buttons
=
$
(
'.add-xblock-component-button[data-category=pb-message]'
,
element
);
var
updateButtons
=
function
()
{
$buttons
.
each
(
function
()
{
var
msg_type
=
$
(
this
).
data
(
'boilerplate'
);
$
(
this
).
toggleClass
(
'disabled'
,
$
(
'.xblock .submission-message.'
+
msg_type
).
length
>
0
);
});
var
blockIsPresent
=
function
(
klass
)
{
return
$
(
'.xblock '
+
klass
).
length
>
0
;
};
updateButtons
();
$buttons
.
click
(
function
(
ev
)
{
var
updateButton
=
function
(
button
,
condition
)
{
button
.
toggleClass
(
'disabled'
,
condition
);
};
var
disableButton
=
function
(
ev
)
{
if
(
$
(
this
).
is
(
'.disabled'
))
{
ev
.
preventDefault
();
ev
.
stopPropagation
();
}
else
{
$
(
this
).
addClass
(
'disabled'
);
}
};
var
initButtons
=
function
(
dataCategory
)
{
var
$buttons
=
$
(
'.add-xblock-component-button[data-category='
+
dataCategory
+
']'
,
element
);
$buttons
.
each
(
function
()
{
if
(
dataCategory
===
'pb-message'
)
{
var
msg_type
=
$
(
this
).
data
(
'boilerplate'
);
updateButton
(
$
(
this
),
blockIsPresent
(
'.submission-message.'
+
msg_type
));
}
else
{
updateButton
(
$
(
this
),
blockIsPresent
(
'.xblock-header-sb-review-step'
));
}
});
$buttons
.
on
(
'click'
,
disableButton
);
};
initButtons
(
'pb-message'
);
initButtons
(
'sb-review-step'
);
ProblemBuilderUtil
.
transformClarifications
(
element
);
StudioEditableXBlockMixin
(
runtime
,
element
);
...
...
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