Changeset 3586


Ignore:
Timestamp:
09/16/13 16:23:01 (11 years ago)
Author:
andmor
Message:

First implementation for: workspace directive, schema metadata pane, CSS3 transitions between pages and selected schemas.

Location:
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site
Files:
1 added
5 edited

Legend:

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

    r3580 r3586  
    1212        <link href="./lib/bootstrap-2.3.2/css/bootstrap.css" rel="stylesheet" />
    1313        <link href="./lib/bootstrap-2.3.2/css/bootstrap-responsive.css" rel="stylesheet" />
     14        <link href="./lib/animate.css" rel="stylesheet" />
    1415        <link href="./styles/SCHEMAcat.css" rel="stylesheet" />
    1516
     
    5354            </div>
    5455            <div id="pushh"></div>
    55             <div data-ng-view=""/>                   
     56            <div data-workspace-directive="">
     57                <div data-ng-view=""/>
     58            </div>
    5659            <div id="pushf"></div>
    5760        </div>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/workspace.html

    r3581 r3586  
    1 <div id="workspace" class="container-fluid">
     1<div id="workspace" class="container-fluid" data-ng-class="animatePageChange">
    22    <div class="row-fluid">
    33        <div class="span3">
     
    1919                    <tbody>
    2020                        <tr data-ng-class="{selected: $index==selectedSchemaIndex}" data-ng-repeat="schema in schemasResult['sc:result']['sc:schemas']['sc:schema']" data-ng-click="selectSchema($index)">
    21                             <td data-ng-bind="schema['sc:name']"/>
     21                            <td data-ng-bind="schema['sc:name']"></td>
    2222                            <td data-ng-show="schema['sc:version'] != '[object Object]'" data-ng-bind="schema['sc:version']"/>
    2323                            <td data-ng-hide="schema['sc:version'] != '[object Object]'"/>
     
    3434        <div class="span9">
    3535            <div class="hero-unit">
    36                 <h1>Hello, world!</h1>
    37                 <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
    38                 <p>
    39                     <a href="#" class="btn btn-primary btn-large">Learn more ...</a>
    40                 </p>
     36                <div id="schema-div" class="container-fluid" data-ng-class="animateSchemaChange">
     37                    <h1 data-ng-bind="selectedSchema['sc:schema']['sc:name']"/>
     38                    <p data-ng-show="selectedSchema['sc:schema']['sc:description'] != '[object Object]'" data-ng-bind="selectedSchema['sc:schema']['sc:description']"/>
     39                    <p data-ng-hide="selectedSchema['sc:schema']['sc:description'] != '[object Object]'">--</p>
     40                    <div class="row-fluid">
     41                        <div class="span2">
     42                            <h4>Version:</h4>
     43                            <p data-ng-show="selectedSchema['sc:schema']['sc:version'] != '[object Object]'" data-ng-bind="selectedSchema['sc:schema']['sc:version']"/>
     44                            <p data-ng-hide="selectedSchema['sc:schema']['sc:version'] != '[object Object]'">--</p>
     45                        </div>
     46                        <div class="span2">
     47                            <h4>Status:</h4>
     48                            <p data-ng-show="selectedSchema['sc:schema']['sc:status'] != '[object Object]'" data-ng-bind="selectedSchema['sc:schema']['sc:status']"/>
     49                            <p data-ng-hide="selectedSchema['sc:schema']['sc:status'] != '[object Object]'">--</p>
     50                        </div>
     51                        <div class="span2">
     52                            <h4>Access:</h4>
     53                            <p data-ng-show="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">public</p>
     54                            <p data-ng-hide="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">private</p>
     55                        </div>
     56                    </div>
     57                    <div class="row-fluid">
     58                        <div class="span2">
     59                            <h5>Group tags:</h5>
     60                        </div>
     61                        <h6 data-ng-show="selectedSchema['sc:schema']['sc:tag']['content']">[{{selectedSchema['sc:schema']['sc:tag']['content']}}]</h6>
     62                    </div>
     63                    <p>
     64                        <a href="" class="btn btn-primary btn-large">Open schema file...</a>
     65                    </p>
     66                </div>
    4167            </div>
    4268        </div>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controlers.js

    r3580 r3586  
    11//SCHEMAcat angular controllers
    22SCHEMAcat.controller('WorkspaceCtrl',
    3     [ '$scope', '$location', '$routeParams', 'SchemasList' ,'Schema' ,'UserService' ,
    4         function($scope, $location, $routeParams, SchemasList, Schema, UserService) {   
     3    [ '$scope', '$location', '$routeParams', '$timeout', 'SchemasList' ,'Schema' ,'UserService' ,
     4        function($scope, $location, $routeParams, $timeout, SchemasList, Schema, UserService) {   
     5            var parentScope = $scope.$parent; 
    56   
    6             $scope.pageSize = 5;
    7             $scope.currentPage = $routeParams.pageNumber;
    8             $scope.selectedSchemaIndex = $routeParams.schemaIndex;
    9            
    10            
     7            parentScope.pageSize = 5;
     8            parentScope.currentPage = $routeParams.pageNumber;
     9            parentScope.selectedSchemaIndex = $routeParams.schemaIndex;
     10            //keep the workspace page hidden until all data is loaded           
     11            parentScope.animatePageChange = 'noDisplay';
     12
     13            //watch for our AJAX data to arrive and fade in workspace afterwards.
     14            var watchListener = $scope.$watch('resultAsArrived', function (newValue, oldValue){
     15                if(newValue == true) {
     16                    //fade in the workspace page
     17                    parentScope.animatePageChange =
     18                        parentScope.toNextPage == true ?
     19                        'animated slideInLeft' : 'animated slideInRight';
     20                   
     21                    $timeout(function () {
     22                        var selectedSchemaRow = $scope.schemasResult['sc:result']['sc:schemas']['sc:schema'][$routeParams.schemaIndex];
     23                        alert("You've clicked the " + selectedSchemaRow['sc:name'] + " schema");
     24                        });
     25                }
     26            });
     27
     28
     29            //load the schemas page (trought a 'SchemasList' AJAX call) and the selected schema metadata.
     30            //if reading the worspace for the first time i.e. not due to page change click
     31            if(!parentScope.workspaceFirstLoaded)
     32                loadSchemasList($scope.currentPage);
     33
     34
    1135            //update the current route when user clicks in another page in the paginator.
    12             //This triggers a $routeChangeSuccess event since we are changing the route path part.
     36            //This triggers a $routeChangeStart event since we are changing the route path part.
    1337            $scope.selectPage = function (page) {
    14                 $location.path('workspace/page/'+ page + '/').search({'schemaIndex': 0});
     38                $location.path('workspace/page/'+ page + '/').search({'schemaIndex': 0});               
    1539            }
     40
    1641
    1742            //update the current route when the uses clicks one schema in the list. This triggers
     
    2146            }
    2247           
    23             //listen for the $routeChangeSuccess event and get the schemas page (trought a 'SchemasList'
    24             //AJAX call) and the selected schema metadata.
    25             $scope.$on("$routeChangeSuccess", function(event, route) {
    26                 $scope.schemasResult = SchemasList.get({userID:UserService.id,
    27                     startPage:$scope.currentPage, pageSize:$scope.pageSize},
    28                         function(result){
    29                             $scope.totalSchemaItems = result['sc:result']['sc:total-schemas'];
    30                             getSchemaMetadata($routeParams.schemaIndex);
    31                         });
     48           
     49            //listen for the $routeChangeStart event. Triggered when route path is changed (page change).
     50            $scope.$on("$routeChangeStart", function(event, next, current) {
     51                if(next.params.pageNumber > current.params.pageNumber)
     52                    parentScope.toNextPage = false;
     53                else
     54                    parentScope.toNextPage = true;
     55                   
     56                //fade out workspace page
     57                parentScope.animatePageChange =
     58                    parentScope.toNextPage == true ?
     59                    'animated slideOutRight' : 'animated slideOutLeft';
     60                //derregister the listener since the controler is going to be reloaded
     61                watchListener();
     62                parentScope.resultAsArrived = false;
     63                loadSchemasList(next.params.pageNumber);
    3264            });
    3365           
     
    3668            //navigating back and forth)
    3769            $scope.$on("$routeUpdate", function(event, route) {
    38                 getSchemaMetadata(route.params.schemaIndex);
     70                parentScope.resultAsArrived = false;
     71                $scope.animateSchemaChange = 'animated slideOutUp';
     72                loadSchemaMetadata(route.params.schemaIndex);
    3973            });         
    40                      
    41             //gets (trought a 'Schema' AJAX call) the schema metadata of the schema placed
     74
     75
     76            function loadSchemasList(page) {
     77                //since we want to keep the server data across controler reloads, we save it in the
     78                //parent scope.
     79                parentScope.schemasResult = SchemasList.get({userID:UserService.id,
     80                    startPage:page, pageSize:$scope.pageSize},
     81                        function(result){
     82                            parentScope.totalSchemaItems = result['sc:result']['sc:total-schemas'];
     83                            loadSchemaMetadata($location.search().schemaIndex);
     84                        });           
     85            }   
     86
     87
     88            //loads (trought a 'Schema' AJAX call) the schema metadata of the schema placed
    4289            //in the 'index' position of the schemas list.
    43             function getSchemaMetadata(index) {             
     90            function loadSchemaMetadata(index) {             
    4491                //update the selected row to the route search part.
    45                 $scope.selectedSchemaIndex = index;
     92                parentScope.selectedSchemaIndex = index;
    4693               
    4794                //make AJAX call to get the schema metadata for the selected row
    4895                var selectedSchemaRow = $scope.schemasResult['sc:result']['sc:schemas']['sc:schema'][index];
    49                 $scope.selectedSchema = Schema.get({schemaID:selectedSchemaRow['xml:id']},
     96                parentScope.selectedSchema = Schema.get({schemaID:selectedSchemaRow['xml:id']},
    5097                    function(result){
    51                         alert("You've clicked the " + selectedSchemaRow['sc:name'] + " schema");
     98                        $scope.animateSchemaChange = 'animated slideInDown';
     99                        parentScope.resultAsArrived = true;
    52100                    });
    53101            }
    54102           
     103            parentScope.workspaceFirstLoaded = true;
     104                     
    55105        }]);
     106       
     107SCHEMAcat.directive('workspaceDirective', [ function(){
     108    return function(scope, element, attrs) {
     109        scope.animatePageChange = 'noDisplay';
     110        scope.toNextPage = false;
     111        scope.workspaceFirstLoaded = false;
     112        scope.resultAsArrived = false;       
     113    }
     114}]);     
     115       
    56116 
    57117SCHEMAcat.controller('TopMenuCtrl',
    58118    [ '$scope', '$modal', 'UserService',
    59119        function($scope, $modal, UserService) {
    60    
    61120            $scope.displayName = UserService.displayName;
    62            
     121
    63122            //Modal window handlers and options
    64123            $scope.loginClick = function () {
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/modules.js

    r3581 r3586  
    1818            */
    1919            reloadOnSearch: false,
    20             resolve: { hash:
    21                         function ($route, $routeParams, $location){
    22                             //we can execute code here before loading the cotr
    23                     }
     20            resolve: {
     21            //this will cause a 0.4 second delay to allow CSS fadeOut animation to
     22            //be displayed
     23                delay: function($q, $timeout) {
     24                var delay = $q.defer();
     25                $timeout(delay.resolve, 350);
     26                return delay.promise;
     27      }
    2428            }
    2529        })
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/styles/SCHEMAcat.css

    r3580 r3586  
    1313}
    1414
     15.noDisplay {
     16    opacity:0;
     17}
     18
     19#workspace, #schema-div {
     20    -webkit-animation-duration: 0.35s;
     21    -moz-animation-duration: 0.35s;
     22        -o-animation-duration: 0.35s;
     23        animation-duration: 0.35s;
     24}
    1525.cursor-pointer{
    1626    cursor:pointer;
Note: See TracChangeset for help on using the changeset viewer.