Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
40b87e03
Commit
40b87e03
authored
Jun 12, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add loading spinner on ajax calls.
ECOM-7862
parent
d5e11a73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
0 deletions
+94
-0
course_discovery/static/images/ajax-loading.svg
+1
-0
course_discovery/static/js/publisher/ajax-loading.js
+91
-0
course_discovery/templates/publisher/base.html
+2
-0
No files found.
course_discovery/static/images/ajax-loading.svg
0 → 100755
View file @
40b87e03
<svg
width=
'120px'
height=
'120px'
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 100 100"
preserveAspectRatio=
"xMidYMid"
class=
"uil-default"
><rect
x=
"0"
y=
"0"
width=
"100"
height=
"100"
fill=
"none"
class=
"bk"
></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(0 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(30 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.08333333333333333s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(60 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.16666666666666666s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(90 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.25s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(120 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.3333333333333333s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(150 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.4166666666666667s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(180 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.5s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(210 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.5833333333333334s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(240 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.6666666666666666s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(270 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.75s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(300 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.8333333333333334s'
repeatCount=
'indefinite'
/></rect><rect
x=
'46.5'
y=
'40'
width=
'7'
height=
'20'
rx=
'5'
ry=
'5'
fill=
'#00b2ff'
transform=
'rotate(330 50 50) translate(0 -30)'
>
<animate
attributeName=
'opacity'
from=
'1'
to=
'0'
dur=
'1s'
begin=
'0.9166666666666666s'
repeatCount=
'indefinite'
/></rect></svg>
course_discovery/static/js/publisher/ajax-loading.js
0 → 100755
View file @
40b87e03
(
function
(
$
){
var
config
=
{};
$
.
loadingSpinner
=
function
(
options
)
{
var
opts
=
$
.
extend
(
$
.
loadingSpinner
.
default
,
options
);
config
=
opts
;
init
(
opts
);
var
selector
=
'#'
+
opts
.
id
;
$
(
document
).
on
(
'ajaxStart'
,
function
(){
if
(
config
.
ajax
)
{
$
(
selector
).
show
();
}
});
$
(
document
).
on
(
'ajaxComplete'
,
function
(){
setTimeout
(
function
(){
$
(
selector
).
hide
();
},
opts
.
minTime
);
});
return
$
.
loadingSpinner
;
};
$
.
loadingSpinner
.
open
=
function
(
time
)
{
var
selector
=
'#'
+
config
.
id
;
$
(
selector
).
show
();
if
(
time
)
{
setTimeout
(
function
(){
$
(
selector
).
hide
();
},
parseInt
(
time
));
}
};
$
.
loadingSpinner
.
close
=
function
()
{
var
selector
=
'#'
+
config
.
id
;
$
(
selector
).
hide
();
};
$
.
loadingSpinner
.
ajax
=
function
(
isListen
)
{
config
.
ajax
=
isListen
;
};
$
.
loadingSpinner
.
default
=
{
ajax
:
true
,
//wrap div
id
:
'ajaxLoading'
,
zIndex
:
'10000'
,
background
:
'rgba(0, 0, 0, 0.7)'
,
minTime
:
200
,
width
:
'100%'
,
height
:
'100%'
,
//loading img/gif
imgPath
:
'/static/images/ajax-loading.svg'
,
imgWidth
:
'65px'
,
imgHeight
:
'65px'
};
function
init
(
opts
)
{
//wrap div style
var
wrapCss
=
'display: none;position: fixed;top: 0;bottom: 0;left: 0;right: 0;margin: auto;text-align: center;vertical-align: middle;'
;
var
cssArray
=
[
'width:'
+
opts
.
width
,
'height:'
+
opts
.
height
,
'z-index:'
+
opts
.
zIndex
,
'background:'
+
opts
.
background
];
wrapCss
+=
cssArray
.
join
(
';'
);
//img style
var
imgCss
=
'top: 0;bottom: 0;left: 0;right: 0;margin: auto;position: absolute;'
;
cssArray
=
[
'width:'
+
opts
.
imgWidth
,
'height:'
+
opts
.
imgWidth
];
imgCss
+=
cssArray
.
join
(
';'
);
var
html
=
'<div id="'
+
opts
.
id
+
'" style="'
+
wrapCss
+
'">'
+
'<img src="'
+
opts
.
imgPath
+
'" style="'
+
imgCss
+
'">'
;
$
(
document
).
find
(
'body'
).
append
(
html
);
}
})(
window
.
jQuery
||
window
.
Zepto
);
course_discovery/templates/publisher/base.html
View file @
40b87e03
...
...
@@ -69,11 +69,13 @@
<script
src=
"{% static 'js/publisher/main.js' %}"
></script>
<script
src=
"{% static 'js/publisher/views/navbar.js' %}"
></script>
<script
src=
"{% static 'js/publisher/utils.js' %}"
></script>
<script
src=
"{% static 'js/publisher/ajax-loading.js' %}"
></script>
{% endcompress %}
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
addDatePicker
();
$
.
loadingSpinner
();
});
</script>
...
...
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