settings: add canJoinTeam parameter
This commit is contained in:
parent
921644deb4
commit
2b95995104
7 changed files with 159 additions and 36 deletions
|
@ -712,7 +712,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$rootScope.title = "Bienvenue au challenge forensic !";
|
||||
$rootScope.authors = null;
|
||||
|
||||
$scope.form = {"teamName": "", "members": [{}]};
|
||||
$scope.form = {"teamName": "", "jTeam": 0, "members": [{}]};
|
||||
|
||||
$scope.AddMember = function() {
|
||||
$scope.form.members.push({});
|
||||
|
@ -725,16 +725,29 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$('#teamName').addClass("is-invalid")
|
||||
return;
|
||||
} else {
|
||||
$('#teamName').removeClass("is-invalid")
|
||||
$('#vldBtn').removeClass("input-group-btn");
|
||||
$('#vldBtn').css("display", "none");
|
||||
$scope.part2 = true;
|
||||
$('#jvldBtn').css("display", "none");
|
||||
$scope.partR = true;
|
||||
$scope.partJ = false;
|
||||
}
|
||||
}
|
||||
$scope.JValidate = function() {
|
||||
if (!$scope.teams[$scope.form.jTeam]) {
|
||||
$('#jTeam').addClass("is-invalid")
|
||||
return;
|
||||
} else {
|
||||
$('#jTeam').removeClass("is-invalid")
|
||||
$('#jvldBtn').removeClass("input-group-btn");
|
||||
$('#jvldBtn').css("display", "none");
|
||||
$('#vldBtn').css("display", "none");
|
||||
$scope.partR = false;
|
||||
$scope.partJ = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.rsubmit = function() {
|
||||
if (!$scope.part2)
|
||||
return $scope.Validate();
|
||||
|
||||
var commonsubmit = function(registration) {
|
||||
// Remove empty members
|
||||
$scope.form.members = $scope.form.members.filter(function(m) {
|
||||
return ((m.lastname != undefined && m.lastname != "") || (m.firstname != undefined && m.firstname != "") || (m.nickname != undefined && m.nickname != ""));
|
||||
|
@ -748,6 +761,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
return;
|
||||
}
|
||||
|
||||
$scope.form.jTeam = parseInt($scope.form.jTeam);
|
||||
|
||||
$http({
|
||||
url: "registration",
|
||||
method: "POST",
|
||||
|
@ -771,6 +786,20 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
});
|
||||
}
|
||||
|
||||
$scope.rsubmit = function() {
|
||||
if (!$scope.partR)
|
||||
return $scope.Validate();
|
||||
else
|
||||
return commonsubmit(true);
|
||||
}
|
||||
|
||||
$scope.jsubmit = function() {
|
||||
if (!$scope.partJ)
|
||||
return $scope.JValidate();
|
||||
else
|
||||
return commonsubmit(false);
|
||||
}
|
||||
|
||||
$scope.$watch("my", function(my){
|
||||
if (my)
|
||||
$location.url(".");
|
||||
|
|
Reference in a new issue