Skip to content

Commit 4182092

Browse files
committed
Add spinner to loading charts
1 parent afd5a97 commit 4182092

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

Diff for: controllers.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from novaconfig import apikey, logger
77

88
logger = logging.getLogger(__name__)
9+
logger.setLevel(logging.DEBUG)
910

1011
class MeetupMembers(object):
1112
'''

Diff for: static/js/spin.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: templates/index.html

+37-12
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ <h1>Statistics</h1>
161161
<hr>
162162

163163
<footer>
164-
<p>&copy; Nova Python 2012</p>
164+
<p>&copy; Nova Python 2012-2013</p>
165165
</footer>
166166

167167
</div><!--/.fluid-container-->
168168

169169
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
170-
<!--<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>-->
171170
<script src="/static/js/bootstrap.min.js"></script>
172171
<script src="/static/js/jquery.flot.min.js"></script>
173172
<script src="/static/js/jquery.flot.resize.min.js"></script>
173+
<script src="/static/js/spin.min.js"></script>
174174
<script type="text/javascript">
175175

176176
var _gaq = _gaq || [];
@@ -225,19 +225,42 @@ <h1>Statistics</h1>
225225

226226
$(document).ready(
227227
function() {
228-
setInterval(rotateimage, 5000);
228+
//setInterval(rotateimage, 5000);
229229
$('#menulist').css('margin-left',
230230
($(document).width()/2) - ($('#menulist').width()/2));
231+
231232
$.getJSON('/events/1546792',
232-
function(data) {
233-
$.each(data.results,
234-
function(i, e) {
235-
link = '<p><a href="' + e.event_url +
236-
'">' + e.name + ' (' + e.yes_rsvp_count +
237-
' RSVPs)</a></p>';
238-
$('#events').append(link);
239-
});
240-
});
233+
function(data) {
234+
$.each(data.results,
235+
function(i, e) {
236+
link = '<p><a href="' + e.event_url +
237+
'">' + e.name + ' (' + e.yes_rsvp_count +
238+
' RSVPs)</a></p>';
239+
$('#events').append(link);
240+
});
241+
});
242+
243+
var opts = {
244+
lines: 13, // The number of lines to draw
245+
length: 7, // The length of each line
246+
width: 4, // The line thickness
247+
radius: 10, // The radius of the inner circle
248+
corners: 1, // Corner roundness (0..1)
249+
rotate: 0, // The rotation offset
250+
color: '#000', // #rgb or #rrggbb
251+
speed: 1, // Rounds per second
252+
trail: 60, // Afterglow percentage
253+
shadow: false, // Whether to render a shadow
254+
hwaccel: false, // Whether to use hardware acceleration
255+
className: 'spinner', // The CSS class to assign to the spinner
256+
zIndex: 2e9, // The z-index (defaults to 2000000000)
257+
top: 'auto', // Top position relative to parent in px
258+
left: 'auto' // Left position relative to parent in px
259+
};
260+
var total_chart = document.getElementById('totalchart');
261+
var member_chart = document.getElementById('memberchart');
262+
var total_spinner = new Spinner(opts).spin(total_chart);
263+
var member_spinner = new Spinner(opts).spin(member_chart);
241264

242265
$.getJSON('/members/1546792',
243266
function(data) {
@@ -284,6 +307,8 @@ <h1>Statistics</h1>
284307
}
285308
};
286309

310+
total_spinner.stop();
311+
member_spinner.stop();
287312
$.plot($('#memberchart'), [{label: 'Joins', data: joins}], opts);
288313
$.plot($('#totalchart'), [{label: 'Total Members', data: total}], opts);
289314

0 commit comments

Comments
 (0)