Skip to content

Commit

Permalink
Merge pull request #511 from phuonghuynh/master
Browse files Browse the repository at this point in the history
Update changes
  • Loading branch information
phuonghuynh committed Feb 3, 2016
2 parents 9dcff0d + a9d941e commit ffaa30d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 76 deletions.
6 changes: 5 additions & 1 deletion src/main/webapp/assets/modules/common/joinAnythingService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
techlooper.factory("joinAnythingService", function (apiService, localStorageService, $location, $rootScope, $route, $translate) {
techlooper.factory("joinAnythingService", function (apiService, localStorageService, $location, $rootScope, $route, $translate, securityService) {

var successfulJoinChallenge = function (joiningRegistrant) {
var contestId = localStorageService.get("joiningChallengeId");
Expand Down Expand Up @@ -26,6 +26,10 @@ techlooper.factory("joinAnythingService", function (apiService, localStorageServ

joinChallenge: function(success, error) {
var contestId = localStorageService.get("joiningChallengeId");
if (!contestId && localStorageService.get("joinNow")) {
return securityService.routeByRole();
}

if (!contestId) return;

var firstName = localStorageService.get("firstName");
Expand Down
75 changes: 0 additions & 75 deletions src/main/webapp/assets/modules/loading-box/loadingBoxController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,6 @@ techlooper.controller("loadingBoxController", function (utils, jsonValue, $scope
utils.sendNotification(jsonValue.notifications.loaded);
});

//var contestId = localStorageService.get("joiningChallengeId");
////var joinNowInternalChallenge = localStorageService.get("joinNowInternalChallenge");
//var firstName = localStorageService.get("firstName");
//var lastName = localStorageService.get("lastName");
//var email = localStorageService.get("email");
//var internalEmail = localStorageService.get("internalEmail");
//var passcode = localStorageService.get("passcode");
//
//var successfulJoinChallenge = function (joiningRegistrant) {
// var joinContests = localStorageService.get("joinContests") || "";
// joinContests = joinContests.length > 0 ? joinContests.split(",") : [];
// if ($.inArray(contestId, joinContests) < 0) {
// joinContests.push(contestId);
// }
// localStorageService.set("joinContests", joinContests.join(","));
// localStorageService.remove("failedJoin");
//}
//
//var joinChallenge = function () {
// //if (joinNowInternalChallenge) {
// //
// //}
// //else {
// // apiService.joinContest(contestId, firstName, lastName, email, $translate.use())
// // .success(successfulJoinChallenge)
// // .error(function () {
// // localStorageService.set("failedJoin", true);
// // })
// // .finally(function () {
// // $route.reload();
// // });
// //}
// apiService.joinContest(contestId, firstName, lastName, email, $translate.use(), internalEmail, passcode)
// .success(successfulJoinChallenge)
// .error(function () {
// localStorageService.set("failedJoin", true);
// })
// .finally(function () {
// $route.reload();
// });
//
// //if (contestId && !joinNowInternalChallenge) {
// // email && apiService.joinContest(contestId, firstName, lastName, email, $translate.use())
// // .success(successfulJoinChallenge)
// // .error(function () {
// // localStorageService.set("failedJoin", true);
// // })
// // .finally(function () {
// // $route.reload();
// // });
// // localStorageService.remove("joinNow");
// // localStorageService.remove("joinNowInternalChallenge");
// //}
// //else if (contestId && joinNowInternalChallenge) {
// // apiService.joinedChallenge(email, contestId)
// // .success(function(joined) {
// // if (joined == "true") {
// // var joinContests = localStorageService.get("joinContests") || "";
// // joinContests = joinContests.length > 0 ? joinContests.split(",") : [];
// // if ($.inArray(contestId, joinContests) < 0) {
// // joinContests.push(contestId);
// // }
// // localStorageService.set("joinContests", joinContests.join(","));
// // localStorageService.remove("failedJoin");
// // $route.reload();
// // }
// // else {
// // localStorageService.remove("joinNow");
// // localStorageService.remove("joinNowInternalChallenge");
// // $route.reload();
// // }
// // });
// //}
//};

var joinNow = localStorageService.get("joinNow");
if (joinNow == true) {
return joinAnythingService.joinChallenge();
Expand Down

0 comments on commit ffaa30d

Please sign in to comment.