Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Features:

* Supports Two-Factor Authentication on the backend [GH-169]

Improvements:

* Replaced GIF spinner with a pure CSS spinner using CSS3 animations [GH-177].

### v1.1.0 - A Hard Day's Night

Expand Down
55 changes: 55 additions & 0 deletions postmaster/static/css/spinner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Parent div for gradient */
.spinnerParent {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.6);
}

/* Parent div for the circles */
.spinner {
position: absolute;
left: 50%;
top: 50%;
width: 70px;
margin: 0px auto;
}

/* Taken from http://tobiasahlin.com/spinkit/ */

.spinner > div {
width: 18px;
height: 18px;
background-color: #333;
border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}

@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
9 changes: 0 additions & 9 deletions postmaster/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,6 @@ ul.pagination li.disabled a:hover {
margin: auto;
width: 60%;
}

.loader {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.7) url('/static/img/loader.gif') no-repeat 50%;
}
/* End of Manage Page CSS */

/* Only Domains Page CSS */
Expand Down
Binary file removed postmaster/static/img/loader.gif
Binary file not shown.
23 changes: 14 additions & 9 deletions postmaster/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,25 @@ function changePage(obj, e) {
// This manages the loading spinner for the table
function manageSpinner(present) {

var spinner = $('div.loader');
var spinner = $('div.spinner');
var spinnerParent = $('div.spinnerParent');

if (present) {
if (spinner.length == 0) {
$('#dynamicTableDiv').prepend('<div class="loader"></div>');
// If the spinner isn't there, create it
if (spinnerParent.length == 0) {
var spinnerParentHtml = $('<div/>', {'class': 'spinnerParent'});
var spinnerHtml = $('<div/>', {'class': 'spinner'});
spinnerHtml.append($('<div/>', {'class': 'bounce1'}));
spinnerHtml.append($('<div/>', {'class': 'bounce2'}));
spinnerHtml.append($('<div/>', {'class': 'bounce3'}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use .addClass() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You prefer the following?

spinnerHtml.append($('<div/>').addClass('bounce1'));

It's really the same thing except this other way you create the div and then add the class, instead of creating the div with the class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I was really just trying to simplify this part: spinnerHtml.append($('<div/>',

It just looked odd to me. But then again I'm not really versed in DOM manipulation all that well.

spinnerParentHtml.append(spinnerHtml);

$('#dynamicTableDiv').prepend(spinnerParentHtml);
}
}
else {
// Remove the spinner but keep the gray background with opacity
spinner.css('background', 'rgba(255, 255, 255, 0.7)');
// Remove the gray background with opacity after 300 ms
setTimeout(function () {
spinner.fadeOut('fast', function() { spinner.remove() });
}, 400);
// Remove the spinner
spinner.fadeOut(500, function() { spinnerParent.remove(); });
}
}

Expand Down
2 changes: 1 addition & 1 deletion postmaster/templates/admins.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h2 class="textHeadingManage">PostMaster Administrators</h2>
</div>
<div class="row">
<div id="dynamicTableDiv">
<div class="loader"></div>
{% include 'spinner.html' %}
<table class="table table-striped table-bordered" id="dynamicTable">
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion postmaster/templates/aliases.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h2 class="textHeadingManage">Aliases</h2>
</div>
<div class="row">
<div id="dynamicTableDiv">
<div class="loader"></div>
{% include 'spinner.html' %}
<table class="table table-striped table-bordered" id="dynamicTable">
<thead>
<tr>
Expand Down
1 change: 1 addition & 0 deletions postmaster/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<script src="{{ url_for('static', filename='libraries/js/jquery.typewatch.js') }}"></script>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/spinner.css') }}">
<link rel="icon" type="img/ico" href="{{ url_for('static', filename='img/favicon.ico') }}">
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
{% block head %}{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion postmaster/templates/configs.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h2 class="textHeadingManageNoFilter">PostMaster Configurations</h2>
</div>
<div class="row">
<div id="dynamicTableDiv">
<div class="loader"></div>
{% include 'spinner.html' %}
<table class="table table-striped table-bordered" id="dynamicTable">
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion postmaster/templates/domains.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h2 class="textHeadingManage">Domains</h2>
</div>
<div class="row">
<div id="dynamicTableDiv" class="table-responsive">
<div class="loader"></div>
{% include 'spinner.html' %}
<table class="table table-striped table-bordered" id="dynamicTable">
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion postmaster/templates/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h2 class="textHeadingManageNoFilter">PostMaster Recent Logs</h2>
</div>
<div class="row">
<div id="dynamicTableDiv">
<div class="loader"></div>
{% include 'spinner.html' %}
<table class="table table-striped table-bordered" id="dynamicTable">
<thead>
<tr>
Expand Down
7 changes: 7 additions & 0 deletions postmaster/templates/spinner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="spinnerParent">
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</div>
2 changes: 1 addition & 1 deletion postmaster/templates/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h2 class="textHeadingManage">Users</h2>
</div>
<div class="row">
<div id="dynamicTableDiv">
<div class="loader"></div>
{% include 'spinner.html' %}
<table class="table table-striped table-bordered" id="dynamicTable">
<thead>
<tr>
Expand Down