frontend: fix angular syntax error

This commit is contained in:
nemunaire 2019-01-17 19:13:46 +01:00
parent f4c3f9b511
commit 108814b8b7
2 changed files with 7 additions and 9 deletions

View File

@ -493,7 +493,6 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
return cur.firstname.capitalize() + " " + cur.lastname.capitalize();
}).join(", ");
}
$scope.newName = "";
$rootScope.message = "";
$rootScope.sberr = "";
@ -501,17 +500,17 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$scope.tsubmit = function() {
$rootScope.sberr = "";
if ($scope.newName.length < 1) {
if ($scope.my.newName.length < 1) {
$rootScope.messageClass = {"text-danger": true};
$rootScope.sberr = "Nom d'équipe invalide: pas d'entrée.";
return false;
}
else if ($scope.newName.length > 32) {
else if ($scope.my.newName.length > 32) {
$rootScope.messageClass = {"text-danger": true};
$rootScope.sberr = "Nom d'équipe invalide: pas plus de 32 caractères.";
return false;
}
else if (!$scope.newName.match(/^[A-Za-z0-9 àéèêëîïôùûü_-]+$/)) {
else if (!$scope.my.newName.match(/^[A-Za-z0-9 àéèêëîïôùûü_-]+$/)) {
$rootScope.messageClass = {"text-danger": true};
$rootScope.sberr = "Nom d'équipe invalide: seuls les caractères alpha-numériques sont autorisés.";
return false;
@ -520,7 +519,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$http({
url: "/submit/name",
method: "POST",
data: {newName: $scope.newName}
data: {newName: $scope.my.newName}
}).then(function(response) {
$rootScope.messageClass = {"text-success": true};
$rootScope.message = response.data.errmsg;
@ -528,7 +527,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
var checkDiff = function() {
$http.get("/my.json").then(function(response) {
if ($scope.my.name != response.data.name) {
$scope.newName = "";
$scope.my.newName = undefined;
$rootScope.message = "";
$rootScope.recvMy(response.data);
$rootScope.refreshTeams();

View File

@ -6,7 +6,7 @@
<ul class="list-group" ng-if="my.members.length">
<li class="list-group-item" ng-repeat="member in my.members">
{{ member.firstname | capitalize }}
<span style="font-style: italic" ng-if="{{ member.nickname }}">{{ member.nickname }}</span>
<span style="font-style: italic" ng-if="member.nickname">{{ member.nickname }}</span>
<span style="font-variant: small-caps;">{{ member.lastname | capitalize }}</span>
<span ng-if="member.company">- {{ member.company}}</span>
</li>
@ -22,14 +22,13 @@
<label for="newName" class="col col-form-label">Nouveau nom</label>
<div class="col-sm-10">
<div class="input-group">
<input type="text" class="form-control" id="newName" ng-model="newName" placeholder="{{ my.name }}">
<input type="text" class="form-control" id="newName" ng-model="my.newName" placeholder="{{ my.name }}">
<div class="input-group-append">
<button type="submit" class="btn btn-info">Valider</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>