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
3f47c54b
Commit
3f47c54b
authored
Mar 02, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show missing dependency warning through JS to avoid refresh flickering
parent
ea944a50
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
static/css/mentoring.css
+4
-0
static/js/mentoring.js
+17
-2
templates/html/mentoring.html
+1
-3
No files found.
static/css/mentoring.css
View file @
3f47c54b
...
@@ -13,6 +13,10 @@
...
@@ -13,6 +13,10 @@
background-color
:
#FEEFB3
;
background-color
:
#FEEFB3
;
}
}
.mentoring
.missing-dependency.warning
{
display
:
none
;
}
.mentoring
.bold
{
.mentoring
.bold
{
font-weight
:
bold
;
font-weight
:
bold
;
}
}
...
...
static/js/mentoring.js
View file @
3f47c54b
...
@@ -6,6 +6,15 @@ function MentoringBlock(runtime, element) {
...
@@ -6,6 +6,15 @@ function MentoringBlock(runtime, element) {
$
(
'.indicator'
,
element
).
html
(
progressTemplate
(
data
));
$
(
'.indicator'
,
element
).
html
(
progressTemplate
(
data
));
}
}
function
renderDependency
()
{
var
warning_dom
=
$
(
'.missing-dependency'
,
element
),
data
=
warning_dom
.
data
();
if
(
data
.
missing
===
'True'
)
{
warning_dom
.
show
();
}
}
function
callIfExists
(
obj
,
fn
)
{
function
callIfExists
(
obj
,
fn
)
{
if
(
typeof
obj
!==
'undefined'
&&
typeof
obj
[
fn
]
==
'function'
)
{
if
(
typeof
obj
!==
'undefined'
&&
typeof
obj
[
fn
]
==
'function'
)
{
return
obj
[
fn
].
apply
(
obj
,
Array
.
prototype
.
slice
.
call
(
arguments
,
2
));
return
obj
[
fn
].
apply
(
obj
,
Array
.
prototype
.
slice
.
call
(
arguments
,
2
));
...
@@ -59,7 +68,9 @@ function MentoringBlock(runtime, element) {
...
@@ -59,7 +68,9 @@ function MentoringBlock(runtime, element) {
}
}
function
initXBlock
()
{
function
initXBlock
()
{
$
(
element
).
find
(
'.submit'
).
bind
(
'click'
,
function
()
{
var
submit_dom
=
$
(
element
).
find
(
'.submit'
);
submit_dom
.
bind
(
'click'
,
function
()
{
var
data
=
{};
var
data
=
{};
var
children
=
getChildren
(
element
);
var
children
=
getChildren
(
element
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
@@ -72,7 +83,11 @@ function MentoringBlock(runtime, element) {
...
@@ -72,7 +83,11 @@ function MentoringBlock(runtime, element) {
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
data
)).
success
(
handleSubmitResults
);
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
data
)).
success
(
handleSubmitResults
);
});
});
renderProgress
();
if
(
submit_dom
.
length
)
{
renderProgress
();
}
renderDependency
();
}
}
function
handleRefreshResults
(
results
)
{
function
handleRefreshResults
(
results
)
{
...
...
templates/html/mentoring.html
View file @
3f47c54b
<div
class=
"mentoring"
>
<div
class=
"mentoring"
>
{% if missing_dependency_url %}
<div
class=
"missing-dependency warning"
data-missing=
"{{ self.has_missing_dependency }}"
>
<div
class=
"warning"
>
You need to complete
<a
href=
"{{ missing_dependency_url }}"
>
the following step
</a>
before
You need to complete
<a
href=
"{{ missing_dependency_url }}"
>
the following step
</a>
before
attempting this step.
attempting this step.
</div>
</div>
{% endif %}
{% for name, c in named_children %}
{% for name, c in named_children %}
{{c.body_html|safe}}
{{c.body_html|safe}}
{% endfor %}
{% endfor %}
...
...
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