Skip to content

Commit f7281f1

Browse files
committed
Global "loading..." indicator
1 parent bfa14f0 commit f7281f1

File tree

12 files changed

+43
-36
lines changed

12 files changed

+43
-36
lines changed

BlogEngine/BlogEngine.NET/admin/app/controllers/commentList.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$scope.focusInput = false;
99

1010
$scope.load = function () {
11+
spinOn();
1112
dataService.getItems('/api/comments')
1213
.success(function (data) {
1314
angular.copy(data, $scope.vm);
@@ -23,9 +24,11 @@
2324
if ($scope.filter == 'spm') {
2425
$scope.gridFilter('IsSpam', true, 'spm');
2526
}
27+
spinOff();
2628
})
2729
.error(function (data) {
2830
toastr.error($rootScope.lbl.failed);
31+
spinOff();
2932
});
3033
}
3134

BlogEngine/BlogEngine.NET/admin/app/controllers/common.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ if (typeof String.prototype.startsWith != 'function') {
5555
}
5656

5757
function spinOn() {
58-
$("#spinner").removeClass("loaded");
59-
$("#spinner").addClass("loading");
58+
$("#ng-view").hide();
59+
$("#global-loading").show();
6060
}
6161

6262
function spinOff() {
63-
$("#spinner").removeClass("loading");
64-
$("#spinner").addClass("loaded");
63+
$("#ng-view").show();
64+
$("#global-loading").hide();
6565
}
6666

6767
function loading(id) {

BlogEngine/BlogEngine.NET/admin/app/controllers/custom.js

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ angular.module('blogAdmin').controller('CustomController', ["$rootScope", "$scop
2323
$scope.selectedRating = 0;
2424
$scope.author = UserVars.Name;
2525
$scope.activeTheme = ActiveTheme;
26-
$scope.spin = true;
2726

2827
if ($location.path().indexOf("/custom/plugins") == 0) {
2928
$scope.fltr = 'extensions';
@@ -40,26 +39,24 @@ angular.module('blogAdmin').controller('CustomController', ["$rootScope", "$scop
4039
}
4140

4241
$scope.load = function () {
43-
$scope.spin = true;
42+
spinOn();
4443
dataService.getItems('/api/packages', { take: 0, skip: 0, filter: $scope.fltr, order: 'LastUpdated desc' })
4544
.success(function (data) {
4645
angular.copy(data, $scope.items);
47-
4846
gridInit($scope, $filter);
4947
if ($scope.galleryFilter) {
5048
$scope.setFilter();
5149
}
52-
$scope.spin = false;
53-
5450
var pkgId = getFromQueryString('pkgId');
5551
if (pkgId != null) {
5652
$scope.query = pkgId;
5753
$scope.search();
5854
}
55+
spinOff();
5956
})
6057
.error(function () {
6158
toastr.error($rootScope.lbl.errorLoadingPackages);
62-
$scope.spin = false;
59+
spinOff();
6360
});
6461
}
6562

@@ -77,26 +74,25 @@ angular.module('blogAdmin').controller('CustomController', ["$rootScope", "$scop
7774
}
7875

7976
$scope.save = function () {
80-
$scope.spin = true;
77+
spinOn();
8178

8279
dataService.updateItem("/api/packages/update/foo", $scope.package)
8380
.success(function (data) {
8481
toastr.success($rootScope.lbl.completed);
85-
$scope.spin = false;
82+
spinOff();
8683
})
8784
.error(function () {
8885
toastr.error($rootScope.lbl.failed);
89-
$scope.spin = false;
86+
spinOff();
9087
});
9188

9289
dataService.updateItem("/api/customfields", $scope.customFields)
9390
.success(function (data) {
9491
$scope.load();
95-
$scope.spin = false;
9692
})
9793
.error(function () {
9894
toastr.error($rootScope.lbl.updateFailed);
99-
$scope.spin = false;
95+
spinOff();
10096
});
10197
}
10298

@@ -117,44 +113,41 @@ angular.module('blogAdmin').controller('CustomController', ["$rootScope", "$scop
117113
}
118114

119115
$scope.installPackage = function (pkgId) {
120-
$scope.spin = true;
116+
spinOn();
121117
dataService.updateItem("/api/packages/install/" + pkgId, pkgId)
122118
.success(function (data) {
123119
toastr.success($rootScope.lbl.completed);
124120
$scope.load();
125-
$scope.spin = false;
126121
})
127122
.error(function () {
128123
toastr.error($rootScope.lbl.failed);
129-
$scope.spin = false;
124+
spinOff();
130125
});
131126
}
132127

133128
$scope.uninstallPackage = function (pkgId) {
134-
$scope.spin = true;
129+
spinOn();
135130
dataService.updateItem("/api/packages/uninstall/" + pkgId, pkgId)
136131
.success(function (data) {
137132
toastr.success($rootScope.lbl.completed);
138133
$scope.load();
139-
$scope.spin = false;
140134
})
141135
.error(function () {
142136
toastr.error($rootScope.lbl.failed);
143-
$scope.spin = false;
137+
spinOff();
144138
});
145139
}
146140

147141
$scope.refreshGalleryList = function () {
148-
$scope.spin = true;
142+
spinOn();
149143
dataService.updateItem("/api/packages/refresh/list", { })
150144
.success(function (data) {
151145
toastr.success($rootScope.lbl.completed);
152-
$scope.spin = false;
153146
$scope.load();
154147
})
155148
.error(function () {
156149
toastr.error($rootScope.lbl.failed);
157-
$scope.spin = false;
150+
spinOff();
158151
});
159152
}
160153

@@ -168,18 +161,17 @@ angular.module('blogAdmin').controller('CustomController', ["$rootScope", "$scop
168161
}
169162

170163
$scope.setDefaultTheme = function (id) {
171-
$scope.spin = true;
164+
spinOn();
172165
dataService.updateItem("/api/packages/settheme/" + id, id)
173166
.success(function (data) {
174167
ActiveTheme = id;
175168
$scope.activeTheme = id;
176169
toastr.success($rootScope.lbl.completed);
177170
$scope.load();
178-
$scope.spin = false;
179171
})
180172
.error(function () {
181173
toastr.error($rootScope.lbl.failed);
182-
$scope.spin = false;
174+
spinOff();
183175
});
184176
}
185177

@@ -286,9 +278,7 @@ angular.module('blogAdmin').controller('CustomController', ["$rootScope", "$scop
286278
})
287279
.error(function () {
288280
toastr.error($rootScope.lbl.errorLoadingPackages);
289-
$scope.spin = false;
290281
});
291-
292282
$("#modal-info").modal();
293283
}
294284

BlogEngine/BlogEngine.NET/admin/app/controllers/dashboard.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@
124124
dataService.getItems('/api/dashboard')
125125
.success(function (data) {
126126
angular.copy(data, $scope.vm);
127+
spinOff();
127128
})
128-
.error(function (data) { toastr.success($rootScope.lbl.errorGettingStats); });
129+
.error(function (data) {
130+
toastr.success($rootScope.lbl.errorGettingStats);
131+
spinOff();
132+
});
129133
}
130134
$scope.loadPackages = function () {
131135
if (!$scope.security.showTabCustom) {

BlogEngine/BlogEngine.NET/admin/app/controllers/pageEditor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@
190190
dataService.getItems('/api/customfields', { filter: 'CustomType == "PAGE" && ObjectId == "' + $scope.page.Id + '"' })
191191
.success(function (data) {
192192
angular.copy(data, $scope.customFields);
193+
spinOff();
193194
})
194195
.error(function () {
195196
toastr.error($rootScope.lbl.errorLoadingCustomFields);
197+
spinOff();
196198
});
197199
}
198200

BlogEngine/BlogEngine.NET/admin/app/controllers/pages.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
$scope.load = function () {
77
var url = '/api/pages';
88
var p = { take: 0, skip: 0 }
9+
spinOn();
910
dataService.getItems('/api/pages', p)
1011
.success(function (data) {
1112
angular.copy(data, $scope.items);
1213
gridInit($scope, $filter);
1314
if ($scope.filter) {
1415
$scope.setFilter($scope.filter);
1516
}
16-
rowSpinOff($scope.items);
17+
spinOff();
1718
})
1819
.error(function () {
1920
toastr.error($rootScope.lbl.errorLoadingPages);
21+
spinOff();
2022
});
2123
}
2224

BlogEngine/BlogEngine.NET/admin/app/controllers/posts.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77
$scope.load = function () {
88
var url = '/api/posts';
99
var p = { take: 0, skip: 0 }
10+
11+
spinOn();
1012
dataService.getItems(url, p)
1113
.success(function (data) {
1214
angular.copy(data, $scope.items);
1315
gridInit($scope, $filter);
1416
if ($scope.filter) {
1517
$scope.setFilter($scope.filter);
1618
}
17-
rowSpinOff($scope.items);
19+
spinOff();
1820
})
1921
.error(function () {
2022
toastr.error($rootScope.lbl.errorLoadingPosts);
23+
spinOff();
2124
});
2225
}
2326

BlogEngine/BlogEngine.NET/admin/index.cshtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
Layout = "~/admin/themes/standard/layout.cshtml";
44
}
55
<div class="content">
6+
<div class="page-header clearfix" id="global-loading" style="text-align: center">
7+
<i class="fa fa-spinner fa-pulse fa-2x fa-fw fa-spin"></i>
8+
</div>
69
<div class="" ng-view="" id="ng-view"></div>
710
</div>
811
@Scripts.Render("~/scripts/blogadmin")

BlogEngine/BlogEngine.NET/admin/views/custom/gallery.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div data-ng-controller="CustomController">
22
<div class="page-header clearfix">
33
<h2 class="page-title pull-left">
4-
{{lbl.gallery}} <i ng-if="spin" class="fa fa-spinner fa-spin"></i>
4+
{{lbl.gallery}}
55
</h2>
66
<button type="button" class="btn btn-default btn-sm btn-hasicon pull-left" onclick="window.history.back()"><i class="fa fa-angle-left"></i>Back</button>
77
<button ng-click="processChecked('install')" ng-disabled="itemsChecked() === false" class="btn btn-success btn-hasicon btn-sm pull-left"><i class="fa fa-check"></i>{{lbl.install}}</button>

BlogEngine/BlogEngine.NET/admin/views/custom/plugins.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ <h4 class="modal-title">{{package.Title}}</h4>
103103
<div class="page-header clearfix">
104104
<h2 class="page-title pull-left">
105105
<a href="#" class="help-link" data-title=""><i class="fa fa-question-circle"></i></a>
106-
Plugins <i ng-if="spin" class="fa fa-spinner fa-spin"></i>
106+
Plugins
107107
</h2>
108108
<a ng-if="IsPrimary" href="{{SiteVars.RelativeWebRoot}}admin/#/custom/gallery?ftr=plugin" class="btn btn-success btn-sm btn-hasicon pull-left"><i class="fa fa-plus"></i>{{lbl.theNew}}</a>
109109
<div ng-if="IsPrimary" class="btn-group befdv pull-left">

BlogEngine/BlogEngine.NET/admin/views/custom/themes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ <h4 class="modal-title">{{lbl.customFields}}</h4>
7878
<div class="page-header clearfix">
7979
<h2 class="page-title pull-left">
8080
<a href="#" class="help-link" data-title=""><i class="fa fa-question-circle"></i></a>
81-
{{lbl.themes}} <i ng-if="spin" class="fa fa-spinner fa-spin"></i>
81+
{{lbl.themes}}
8282
</h2>
8383
<a ng-if="IsPrimary" href="{{SiteVars.RelativeWebRoot}}admin/#/custom/gallery?ftr=theme" class="btn btn-success btn-sm btn-hasicon pull-left"><i class="fa fa-plus"></i>{{lbl.theNew}}</a>
8484
<div ng-if="IsPrimary" class="btn-group befdv pull-left">

BlogEngine/BlogEngine.NET/admin/views/custom/widgets.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="page-header clearfix">
33
<h2 class="page-title pull-left">
44
<a href="#" class="help-link" data-title=""><i class="fa fa-question-circle"></i></a>
5-
{{lbl.widgets}} <i ng-if="spin" class="fa fa-spinner fa-spin"></i>
5+
{{lbl.widgets}}
66
</h2>
77
<!-- currently gallery does not have widgets, only plugins and themes
88
<a href="{{SiteVars.RelativeWebRoot}}admin/#/gallery" class="btn btn-success pull-left"><i class="fa fa-plus"></i>Add</a>

0 commit comments

Comments
 (0)