Skip to content

Commit

Permalink
Merge pull request #47 from TAMULib/1.2.x-fixes
Browse files Browse the repository at this point in the history
Some minor lint fixes.
  • Loading branch information
jmicah authored Apr 25, 2017
2 parents ec720b8 + 47a8f64 commit b4251b8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
4 changes: 0 additions & 4 deletions app/controllers/loginController.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
core.controller('LoginController', function ($controller, $location, $scope, UserService) {

angular.extend(this, $controller('AbstractController', {
$scope: $scope
}));

angular.extend(this, $controller('AuthenticationController', {
$scope: $scope
}));
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/registrationController.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
core.controller('RegistrationController', function ($controller, $location, $scope, $timeout, AlertService) {

angular.extend(this, $controller('AbstractController', {
$scope: $scope
}));

angular.extend(this, $controller('AuthenticationController', {
$scope: $scope
}));
Expand Down
8 changes: 4 additions & 4 deletions app/model/abstractModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ core.factory("AbstractModel", function ($q, $rootScope, WsApi, ValidationStore,
}
});
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type != "INVALID") {
if (angular.fromJson(res.body).meta.type !== "INVALID") {
angular.extend(abstractModel, angular.fromJson(res.body).payload);
shadow = angular.copy(abstractModel);
}
Expand All @@ -138,7 +138,7 @@ core.factory("AbstractModel", function ($q, $rootScope, WsApi, ValidationStore,
});
var promise = WsApi.fetch(mapping.remove);
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractModel, angular.fromJson(res.body).payload);
}
});
Expand Down Expand Up @@ -204,7 +204,7 @@ core.factory("AbstractModel", function ($q, $rootScope, WsApi, ValidationStore,
if (abstractModel && mapping.listen) {
if (abstractModel.id) {
angular.extend(mapping.listen, {
method: "/" + abstractModel.id
method: abstractModel.id
});
}
var notifyPromise = WsApi.listen(mapping.listen);
Expand All @@ -221,7 +221,7 @@ core.factory("AbstractModel", function ($q, $rootScope, WsApi, ValidationStore,

var processResponse = function (res) {
var resObj = angular.fromJson(res.body);
if (resObj.meta.type != 'ERROR') {
if (resObj.meta.type !== 'ERROR') {
angular.forEach(resObj.payload, function (datum) {
angular[combinationOperation](abstractModel, datum);
});
Expand Down
19 changes: 11 additions & 8 deletions app/repo/abstractRepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {

var listenCallbacks = [];

var validations = ValidationStore.getValidations(modelName);
var validations = {};

if (abstractRepo.mapping.validations) {
validations = ValidationStore.getValidations(modelName);
}

$rootScope.$on("$locationChangeSuccess", function () {
listenCallbacks.length = 0;
Expand Down Expand Up @@ -135,7 +139,7 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {
abstractRepo.clearValidationResults();
var promise = model.delete();
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractRepo, angular.fromJson(res.body).payload);
}
});
Expand All @@ -146,7 +150,7 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {
abstractRepo.clearValidationResults();
var promise = abstractRepo.findById(id).delete();
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractRepo, angular.fromJson(res.body).payload);
}
});
Expand All @@ -160,7 +164,7 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {
});
var promise = WsApi.fetch(abstractRepo.mapping.create);
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractRepo, angular.fromJson(res.body).payload);
}
});
Expand All @@ -172,7 +176,7 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {
abstractRepo.clearValidationResults();
var promise = model.save();
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractRepo, angular.fromJson(res.body).payload);
}
});
Expand All @@ -193,7 +197,7 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {
});
var promise = WsApi.fetch(abstractRepo.mapping.sort);
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractRepo, angular.fromJson(res.body).payload);
console.log(abstractRepo);
}
Expand All @@ -208,9 +212,8 @@ core.service("AbstractRepo", function ($rootScope, $q, WsApi, ValidationStore) {
});
var promise = WsApi.fetch(abstractRepo.mapping.reorder);
promise.then(function (res) {
if (angular.fromJson(res.body).meta.type == "INVALID") {
if (angular.fromJson(res.body).meta.type === "INVALID") {
angular.extend(abstractRepo, angular.fromJson(res.body).payload);
console.log(abstractRepo);
}
});
return promise;
Expand Down
10 changes: 5 additions & 5 deletions app/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ function setUpApp(bootstrapApp) {

var sockJSConnection;

var jwt = getJWT();
var jwt = getJwt();

if (jwt) {
if (!sessionStorage.token) {
sessionStorage.token = jwt;
}
if (sessionStorage.role == appConfig.anonymousRole) {
if (sessionStorage.role === appConfig.anonymousRole) {
delete sessionStorage.role;
}
connect({
Expand Down Expand Up @@ -67,15 +67,15 @@ function setUpApp(bootstrapApp) {
});
};

function getJWT() {
function getJwt() {

if (sessionStorage.token) {
return sessionStorage.token;
}

var queriesString = location.search;

if (typeof (queriesString) == "undefined") {
if (typeof (queriesString) === "undefined") {
return null;
}

Expand All @@ -86,7 +86,7 @@ function setUpApp(bootstrapApp) {
for (var key in queries) {
var queryString = queries[key];
var query = queryString.split("=");
if (query[0] == "jwt") jwt = query[1];
if (query[0] === "jwt") jwt = query[1];

}

Expand Down

0 comments on commit b4251b8

Please sign in to comment.