From 7355a912b67e1a0940902488ae1b56a11e3135e0 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 16 Jun 2014 16:14:58 +0100 Subject: [PATCH] recomend roles and still show form when complete --- services/web/app/views/project/list.jade | 22 ++++++++++--------- .../public/coffee/UserDetailsUpdater.coffee | 10 +++++++-- .../web/public/stylesheets/less/list.less | 2 +- .../web/public/stylesheets/less/style.less | 4 ++++ 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index b69b3d2c0b..11bbe3f714 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -101,21 +101,21 @@ block content ul#projectList mixin projectList(projects) - .span3#userProfileInformation() + .span3#userProfileInformation(ng-cloak) div(ng-controller="UpdateForm").userProfileInformationArea div(ng-hide="hidePersonalInfoSection").alert.alert-info - div(ng-show="percentComplete >= 100") - h4 100% complete, well done! - div(ng-hide="percentComplete >= 100") - h4 Your account is - strong {{percentComplete}}% - | complete + div(ng-show="percentComplete >= 100") + h4 100% complete, well done! + div(ng-hide="percentComplete >= 100") + h4 Your account is + strong {{percentComplete}}% + | complete .progress .bar.bar-success(ng-style="{'width' : (percentComplete+'%')}") - button#completeUserProfileInformation.btn.btn-primary(ng-hide="formVisable", ng-click="formVisable = true") Complete now + button#completeUserProfileInformation.btn.btn-primary(ng-hide="formVisable", ng-click="showForm()") Complete now div(ng-show="formVisable") form(enctype='multipart/form-data', method='post') @@ -124,9 +124,11 @@ block content .input input(type='text', name='last_name', ng-model="userInfoForm.last_name", ng-blur="sendUpdate()", placeholder='Last Name') .input#institution_auto_complete - autocomplete(ng-model="userInfoForm.institution", data="institutions", on-type="updateInstitutionsList", attr-placeholder="Institution") + autocomplete(ng-model="userInfoForm.institution", data="institutions", ng-blur="sendUpdate()", on-type="updateInstitutionsList", attr-placeholder="Institution") .input - input(type='text', name='role', ng-model="userInfoForm.role", placeholder='Role', ng-blur="sendUpdate()") + input(type='text', name='role', ng-model="userInfoForm.role", placeholder='Role', ng-blur="sendUpdate()", list="_roles") + datalist#_roles + option(ng-repeat='role in roles') {{role}} .span3 .tag-list h2 Tags diff --git a/services/web/public/coffee/UserDetailsUpdater.coffee b/services/web/public/coffee/UserDetailsUpdater.coffee index a80de93026..e6d204bf09 100644 --- a/services/web/public/coffee/UserDetailsUpdater.coffee +++ b/services/web/public/coffee/UserDetailsUpdater.coffee @@ -7,10 +7,12 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc app.controller "UpdateForm", ($scope, $http, Institutions)-> $scope.institutions = [] + $scope.formVisable = false $scope.hidePersonalInfoSection = true + $scope.roles = ["Student", "Post-graduate student", "Post-doctoral researcher", "Lecturer", "Proffessor"] $http.get("/user/personal_info").success (data)-> - $scope.userInfoForm = + $scope.userInfoForm = first_name: data.first_name last_name: data.last_name role: data.role @@ -21,10 +23,12 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc $scope.percentComplete = getPercentComplete() $scope.hidePersonalInfoSection = false + $scope.showForm = -> + $scope.formVisable = true + $scope.sendUpdate = -> request = $http.post "/user/personal_info", $scope.userInfoForm request.success (data, status)-> - console.log "the post worked" request.error (data, status)-> console.log "the request failed" $scope.percentComplete = getPercentComplete() @@ -37,5 +41,7 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc Institutions.search $scope.userInfoForm.institution, (err, response)-> $scope.institutions = _.pluck response.hits, "name" + + angular.bootstrap(document.getElementById("userProfileInformation"), ['userProfileInformationApp']) diff --git a/services/web/public/stylesheets/less/list.less b/services/web/public/stylesheets/less/list.less index 062020667f..d0d07b0cb6 100644 --- a/services/web/public/stylesheets/less/list.less +++ b/services/web/public/stylesheets/less/list.less @@ -297,7 +297,7 @@ a.archived-projects { } .autocomplete li.active{ - background-color: #BDE1F6; + background-color: #b5d4fd; } .autocomplete .highlight { diff --git a/services/web/public/stylesheets/less/style.less b/services/web/public/stylesheets/less/style.less index daee55e16a..c849c73a82 100644 --- a/services/web/public/stylesheets/less/style.less +++ b/services/web/public/stylesheets/less/style.less @@ -80,3 +80,7 @@ input.large{ } } + +[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { + display: none !important; +}