Commit 2195512161a34a63891cc9c1845ee0dfb0548a4e

Authored by Caio Almeida
1 parent 9145bafa

Ticket #132: Check profile completeness

www/html/_edit_profile.html
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <input type="text" placeholder="Nome" ng-model="profile.name" /> 12 <input type="text" placeholder="Nome" ng-model="profile.name" />
13 </label> 13 </label>
14 14
15 - <ng-include src="'html/_signup_person_fields.html?1'"></ng-include> 15 + <ng-include src="'html/_signup_person_fields.html?2'"></ng-include>
16 16
17 <ng-include src="'html/_select_state.html'"></ng-include> 17 <ng-include src="'html/_select_state.html'"></ng-include>
18 </div> 18 </div>
www/html/_profile.html
@@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
18 18
19 <h2>Suas Medalhas</h2> 19 <h2>Suas Medalhas</h2>
20 20
21 - <!-- FIXME Need some badges in order to add style to this  
22 <div id="badges"> 21 <div id="badges">
23 <div ng-repeat="badge in profile.badges" class="badge"> 22 <div ng-repeat="badge in profile.badges" class="badge">
24 <span>{{badge.level}}</span> 23 <span>{{badge.level}}</span>
@@ -26,7 +25,6 @@ @@ -26,7 +25,6 @@
26 <p>Level {{badge.level}}</p> 25 <p>Level {{badge.level}}</p>
27 </div> 26 </div>
28 </div> 27 </div>
29 - -->  
30 28
31 <h2>Nome</h2> 29 <h2>Nome</h2>
32 <p>{{profile.name}}</p> 30 <p>{{profile.name}}</p>
www/js/controllers.js
@@ -1441,7 +1441,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -1441,7 +1441,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1441 } 1441 }
1442 1442
1443 if ($scope.signupPersonFields.length == 0) $scope.loadSignupPersonFields(); 1443 if ($scope.signupPersonFields.length == 0) $scope.loadSignupPersonFields();
1444 - $ionicModal.fromTemplateUrl('html/_edit_profile.html?1', { 1444 + $ionicModal.fromTemplateUrl('html/_edit_profile.html?2', {
1445 scope: $scope, 1445 scope: $scope,
1446 animation: 'slide-in-up' 1446 animation: 'slide-in-up'
1447 }).then(function(modal) { 1447 }).then(function(modal) {
@@ -1491,6 +1491,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -1491,6 +1491,7 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1491 popup.then(function() { 1491 popup.then(function() {
1492 $scope.loading = false; 1492 $scope.loading = false;
1493 $scope.closeEditProfile(); 1493 $scope.closeEditProfile();
  1494 + $scope.checkCompleteness(profile);
1494 }); 1495 });
1495 $scope.loading = false; 1496 $scope.loading = false;
1496 }, function(err) { 1497 }, function(err) {
@@ -1502,7 +1503,10 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -1502,7 +1503,10 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
1502 $scope.profileComplete = true; 1503 $scope.profileComplete = true;
1503 $scope.hideProfileWarning = !!window.localStorage['hide_profile_warning']; 1504 $scope.hideProfileWarning = !!window.localStorage['hide_profile_warning'];
1504 $scope.checkCompleteness = function(p) { 1505 $scope.checkCompleteness = function(p) {
1505 - if (!!!p.name || !!!p.orientacao_sexual || !!!p.identidade_genero || !!!p.etnia || !!!p.city || !!!p.membro_conselho) { 1506 + if (!!p.name && !!p.orientacao_sexual && !!p.identidade_genero && !!p.etnia && !!p.membro_conselho && (!!p.region || !!p.city)) {
  1507 + $scope.profileComplete = true;
  1508 + }
  1509 + else {
1506 $scope.profileComplete = false; 1510 $scope.profileComplete = false;
1507 } 1511 }
1508 }; 1512 };