Navigation Menu

Skip to content

Commit

Permalink
Added a "loading" spinner when advancing states.
Browse files Browse the repository at this point in the history
This will give appropriate feedback on slow networks (mobile phones in the
middle of the forest?)...
  • Loading branch information
exhuma committed Apr 9, 2013
1 parent d70c613 commit 95196c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions js/app.js
Expand Up @@ -19,6 +19,9 @@ lost_tracker.app = function() {

lost_tracker.app.advanceState = function(event_source, groupId, stationId) {
var container = event_source.parentNode;
var elem = goog.dom.getElement(
'icon_' + stationId + '_' + groupId);
elem.src = '/static/icons/loading.gif';
goog.dom.classlist.removeAll(
container, ['state_0', 'state_1', 'state_2']);
goog.net.XhrIo.send(
Expand All @@ -29,13 +32,8 @@ lost_tracker.app.advanceState = function(event_source, groupId, stationId) {
if (!goog.isDefAndNotNull(data.new_state)){
return;
}
var elem = goog.dom.getElement(
'icon_' + data.station_id + '_' + data.group_id);

if (goog.isDefAndNotNull(elem)){
elem.src = '/static/icons/' +
data.new_state + '.png';
}
elem.src = '/static/icons/' + data.new_state + '.png';
goog.dom.classlist.add(container, 'state_' + data.new_state);
});
};
Expand Down
Binary file added lost_tracker/static/icons/loading.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lost_tracker/static/js/lost_tracker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 95196c2

Please sign in to comment.