Skip to content

Commit c665117

Browse files
committed
Prevent extra page load when clicking login/logout button
1 parent 13fba6b commit c665117

15 files changed

+46
-23
lines changed

public/partials/details.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<span class="fa fa-user fa-3x"/>
2525
</li>
2626
<li>
27-
<a id="usrBtn" ng-click="usrBtnClk()" href='#'>
27+
<a id="usrBtn" ng-click="usrBtnClk($event)" href='#'>
2828
{{session.user.uid}} {{usrBtnTxt}}
2929
</a>
3030
</li>

public/partials/instDetails.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<span class="fa fa-user fa-3x"/>
2525
</li>
2626
<li>
27-
<a id="usrBtn" ng-click="usrBtnClk()" href='#'>
27+
<a id="usrBtn" ng-click="usrBtnClk($event)" href='#'>
2828
{{session.user.uid}} {{usrBtnTxt}}
2929
</a>
3030
</li>

public/partials/instList.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<span class="fa fa-user fa-3x"/>
2525
</li>
2626
<li>
27-
<a id="usrBtn" ng-click="usrBtnClk()" href='#'>
27+
<a id="usrBtn" ng-click="usrBtnClk($event)" href='#'>
2828
{{session.user.uid}} {{usrBtnTxt}}
2929
</a>
3030
</li>

public/partials/instNew.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<span class="fa fa-user fa-3x"/>
2525
</li>
2626
<li>
27-
<a id="usrBtn" ng-click="usrBtnClk()" href='#'>
27+
<a id="usrBtn" ng-click="usrBtnClk($event)" href='#'>
2828
{{session.user.uid}} {{usrBtnTxt}}
2929
</a>
3030
</li>

public/partials/list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<span class="fa fa-user fa-3x"/>
2525
</li>
2626
<li>
27-
<a id="usrBtn" ng-click="usrBtnClk()" href='#'>
27+
<a id="usrBtn" ng-click="usrBtnClk($event)" href='#'>
2828
{{session.user.uid}} {{usrBtnTxt}}
2929
</a>
3030
</li>

public/partials/new.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<span class="fa fa-user fa-3x"/>
2525
</li>
2626
<li>
27-
<a id="usrBtn" ng-click="usrBtnClk()" href='#'>
27+
<a id="usrBtn" ng-click="usrBtnClk($event)" href='#'>
2828
{{session.user.uid}} {{usrBtnTxt}}
2929
</a>
3030
</li>

src/web/ts/ctlr-inst-details.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ function InstDetailsPromiseCtrl(
2424
}
2525
}, true);
2626

27-
$scope.usrBtnClk = () => {
27+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
28+
if (event) {
29+
event.preventDefault();
30+
}
2831
if ($scope.session.user) {
2932
$window.location.href = `${basePath}/logout`;
3033
} else {

src/web/ts/ctlr-inst-new.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ function InstNewPromiseCtrl(
2424
}
2525
}, true);
2626

27-
$scope.usrBtnClk = () => {
27+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
28+
if (event) {
29+
event.preventDefault();
30+
}
2831
if ($scope.session.user) {
2932
$window.location.href = `${basePath}/logout`;
3033
} else {

src/web/ts/ctlr-inst-update.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ function InstUpdatePromiseCtrl(
5353
$location.path('/inst/details/' + $scope.formData.id);
5454
};
5555

56-
$scope.usrBtnClk = () => {
56+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
57+
if (event) {
58+
event.preventDefault();
59+
}
5760
if ($scope.session.user) {
5861
$window.location.href = `${basePath}/logout`;
5962
} else {

src/web/ts/ctlr-inst.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ appController.controller('InstListController', function(
2727
}
2828
}, true);
2929

30-
$scope.usrBtnClk = () => {
30+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
31+
if (event) {
32+
event.preventDefault();
33+
}
3134
if ($scope.session.user) {
3235
$window.location.href = `${basePath}/logout`;
3336
} else {

src/web/ts/ctlr-swdb-details.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ function DetailsPromiseCtrl(
2626
}
2727
}, true);
2828

29-
$scope.usrBtnClk = () => {
29+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
30+
if (event) {
31+
event.preventDefault();
32+
}
3033
if ($scope.session.user) {
3134
$window.location.href = `${basePath}/logout`;
3235
} else {

src/web/ts/ctlr-swdb-new.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ function NewPromiseCtrl(
2727
}
2828
}, true);
2929

30-
$scope.usrBtnClk = () => {
30+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
31+
if (event) {
32+
event.preventDefault();
33+
}
3134
if ($scope.session.user) {
3235
$location.path(`${basePath}/logout`);
3336
} else {

src/web/ts/ctlr-swdb-update.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ function UpdatePromiseCtrl(
2727
}
2828
}, true);
2929

30-
$scope.usrBtnClk = () => {
30+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
31+
if (event) {
32+
event.preventDefault();
33+
}
3134
if ($scope.session.user) {
3235
$window.location.href = `${basePath}/logout`;
3336
} else {

src/web/ts/ctlr-swdb.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface IListControllerScope extends ng.IScope {
4545
};
4646
props: IConfigProps;
4747
usrBtnTxt?: string;
48-
usrBtnClk(): void;
48+
usrBtnClk(event: ng.IAngularEvent): void;
4949
}
5050

5151
appController.controller('ListController', function(
@@ -55,7 +55,6 @@ appController.controller('ListController', function(
5555
$http: ng.IHttpService,
5656
$q: ng.IQService,
5757
$scope: IListControllerScope,
58-
$cookies: {},
5958
$window: ng.IWindowService,
6059
configService: IConfigService,
6160
userService: IUserService,
@@ -72,7 +71,10 @@ appController.controller('ListController', function(
7271
}
7372
}, true);
7473

75-
$scope.usrBtnClk = () => {
74+
$scope.usrBtnClk = (event: ng.IAngularEvent) => {
75+
if (event) {
76+
event.preventDefault();
77+
}
7678
if ($scope.session.user) {
7779
$window.location.href = `${basePath}/logout`;
7880
} else {

src/web/ts/index.d.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ interface ISwdbDetailsControllerScope extends ng.IScope {
113113
rawHistory: IHistory[];
114114
isHistCollapsed: boolean;
115115
history: string;
116-
usrBtnClk(): void;
116+
usrBtnClk(event: ng.IAngularEvent): void;
117117
updateBtnClk(): void;
118118
bumpVerBtnClk(): void;
119119
}
@@ -147,7 +147,7 @@ interface ISwdbNewControllerScope extends ng.IScope {
147147
};
148148
newItem(event: {currentTarget: HTMLInputElement}): void;
149149
removeItem(event: {currentTarget: HTMLInputElement}): void;
150-
usrBtnClk(): void;
150+
usrBtnClk(event: ng.IAngularEvent): void;
151151
bckBtnClk(): void;
152152
processForm(): void;
153153
updateBtnClk(): void;
@@ -190,7 +190,7 @@ interface ISwdbUpdateControllerScope extends ng.IScope {
190190
newItem(event: {currentTarget: HTMLInputElement}): void;
191191
removeItem(event: {currentTarget: HTMLInputElement}): void;
192192
onStatusChange(): void;
193-
usrBtnClk(): void;
193+
usrBtnClk(event: ng.IAngularEvent): void;
194194
bckBtnClk(): void;
195195
processForm(): void;
196196
updateBtnClk(): void;
@@ -204,7 +204,7 @@ interface IInstListControllerScope extends ng.IScope {
204204
props: IConfigProps;
205205
swMeta: SWMeta;
206206
usrBtnTxt?: string;
207-
usrBtnClk(): void;
207+
usrBtnClk(event: ng.IAngularEvent): void;
208208
}
209209

210210
interface IInstDetailsControllerScope extends ng.IScope {
@@ -220,7 +220,7 @@ interface IInstDetailsControllerScope extends ng.IScope {
220220
statusDateDisplay: string;
221221
vvApprovalDateDisplay: string;
222222
rawHistory: {};
223-
usrBtnClk(): void;
223+
usrBtnClk(event: ng.IAngularEvent): void;
224224
updateBtnClk(): void;
225225
}
226226

@@ -248,7 +248,7 @@ interface IInstNewControllerScope extends ng.IScope {
248248
formShowErr: boolean,
249249
formShowStatus: boolean,
250250
};
251-
usrBtnClk(): void;
251+
usrBtnClk(event: ng.IAngularEvent): void;
252252
updateBtnClk(): void;
253253
bckBtnClk(): void;
254254
swSelect(item: webapi.Inst): void;
@@ -290,7 +290,7 @@ interface IInstUpdateControllerScope extends ng.IScope {
290290
formShowErr: boolean,
291291
formShowStatus: boolean,
292292
};
293-
usrBtnClk(): void;
293+
usrBtnClk(event: ng.IAngularEvent): void;
294294
updateBtnClk(): void;
295295
bckBtnClk(): void;
296296
swSelect(item: webapi.Inst): void;

0 commit comments

Comments
 (0)