Commit 2195512161a34a63891cc9c1845ee0dfb0548a4e

Authored by Caio Almeida
1 parent 9145bafa

Ticket #132: Check profile completeness

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