Changeset 4104 for cats


Ignore:
Timestamp:
11/28/13 09:34:58 (11 years ago)
Author:
andmor
Message:

Improved UI error handeling and AngularJS 1.2.2 compatibility

Location:
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/accountDetails.html

    r4091 r4104  
    4747                                </span>
    4848                            </p>
     49                            <span class="control-group error" data-ng-show="removeEmailAjaxError">
     50                                <small class="help-block">
     51                                    <div>The server responded with an error. Please try again!</div>
     52                                    <div>If the problem persists contact us at:</div>
     53                                    <div><a href="mailto:tla@mpi.nl">isocat@mpi.nl</a></div>
     54                                </small>
     55                            </span>
    4956                            <form data-ng-show="edditingEmail" name="editEmailForm" class="form-inline" novalidate="novalidate">
    5057                                <input name="editEmailInput" type="email" required="required" data-ng-model="editEmailText"/>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.js

    r4091 r4104  
    147147                //controller (next page), thus we have to keep the server data across controller
    148148                //reloads by saving it in the parent scope.
    149                 parentScope.schemasResult = SchemasList.get({userID:UserService.id,
     149                SchemasList.get({userID:UserService.id,
    150150                    startPage:page, pageSize:$scope.pageSize},
    151151                        function(result){
     
    167167                            loadSchemaMetadata($location.search().schemaIndex);
    168168                           
    169                             return result;
     169                            parentScope.schemasResult = result;
    170170                        });           
    171171            }
     
    189189                //make AJAX call to get the schema metadata for the selected row
    190190                var selectedSchemaRow = parentScope.schemasList[Number(index)];
    191                 parentScope.selectedSchema = Schema.get({schemaID:selectedSchemaRow['xml:id']},
     191                Schema.get({schemaID:selectedSchemaRow['xml:id']},
    192192                    function(result){
    193193                        //when there is just one element we create an array with it, so ng-repeat repeats just once
     
    210210                            $scope.animateSchemaChange='';
    211211                       
     212                        parentScope.selectedSchema = result;
    212213                        parentScope.resultHasArrived = true;
    213214                    });
     
    532533        function updateAddingEmail(){
    533534            $scope.waitingForServer = false;
    534             $scope.ajaxError = false;
     535           
    535536            if($location.search().addingEmail)
    536537                $scope.addingEmail = true;
     
    551552       
    552553        $scope.terminateAddEmail = function (){
     554            $scope.ajaxError = false;
    553555            $scope.newEmailInputText = '';
    554556            $scope.newEmailForm.$setPristine();
     
    565567            user.$save({userID:UserService.id},
    566568                function(result) {
    567                     if(result['sc:response'].success){
     569                    if(result['sc:response'] !== undefined && result['sc:response'].success){
    568570                        UserService.email.push(email);
    569571                        $scope.newEmailForm.$setPristine();
     
    601603            user.$save({userID:UserService.id},
    602604                function(result) {
    603                     if(result['sc:response'].success){
     605                    if(result['sc:response'] !== undefined && result['sc:response'].success){
    604606                        $scope.displayName = UserService.displayName = $scope.editDisplayNameText;
    605607                        $scope.terminateEditDisplayName();
     
    608610                        //server reports an handeled error
    609611                        $scope.waitingForServerEditDisplayName = false;
    610                         $scope.ajaxError = true;
     612                        $scope.editDisplayNameAjaxError = true;
    611613                    }
    612614                },
     
    650652            function updateEdditingEmail(){
    651653                $scope.waitingForServerEditEmail = false;
    652                 $scope.editEmailAjaxError = false;
    653654                if($location.search().edditingEmail !== undefined && $location.search().edditingEmail.indexOf($scope.emailInstance) !== -1){
    654655                    if($scope.editEmailText === undefined)
     
    662663            updateEdditingEmail();
    663664               
    664             $scope.editEmail = function (emailInstance){         
     665            $scope.editEmail = function (emailInstance){     
    665666                var locationSearch = $location.search();
     667                $scope.removeEmailAjaxError = false;
    666668                if(locationSearch.edditingEmail === undefined)
    667669                    locationSearch.edditingEmail = emailInstance;
     
    681683                user.$save({userID:UserService.id},
    682684                    function(result) {
    683                         if(result['sc:response'].success){
     685                        if(result['sc:response'] !== undefined && result['sc:response'].success){
    684686                            UserService.email.splice(index, 1);
    685687                        }
     
    687689                            //server reports an handeled error
    688690                            $scope.waitingForServerEditEmail = false;
    689                             $scope.editEmailAjaxError = true;
     691                            $scope.removeEmailAjaxError = true;
    690692                        }
    691693                    },
     
    693695                    function(){
    694696                        $scope.waitingForServerEditEmail = false;
    695                         $scope.editEmailAjaxError = true;
     697                        $scope.removeEmailAjaxError = true;
    696698                    });
    697699            };
     
    706708                user.$save({userID:UserService.id},
    707709                    function(result) {
    708                         if(result['sc:response'].success){
     710                        if(result['sc:response'] !== undefined && result['sc:response'].success){
    709711                            $scope.cancelEditEmail(UserService.email[index]);
    710712                            UserService.email[index] = $scope.editEmailText;
     
    726728            $scope.cancelEditEmail = function (emailInstance){
    727729                var locationSearch = $location.search();
    728                
     730                $scope.editEmailAjaxError = false;
    729731                $scope.editEmailText = undefined;
    730732               
     
    788790                user.$save({userID:UserService.id},
    789791                    function(result) {
    790                         if(result['sc:response'].success)
     792                        if(result['sc:response'] !== undefined && result['sc:response'].success)
    791793                            document.location.pathname = "schemacat/site/index.html";
    792794                        else {
Note: See TracChangeset for help on using the changeset viewer.