Changeset 3586
- Timestamp:
- 09/16/13 16:23:01 (11 years ago)
- 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 12 12 <link href="./lib/bootstrap-2.3.2/css/bootstrap.css" rel="stylesheet" /> 13 13 <link href="./lib/bootstrap-2.3.2/css/bootstrap-responsive.css" rel="stylesheet" /> 14 <link href="./lib/animate.css" rel="stylesheet" /> 14 15 <link href="./styles/SCHEMAcat.css" rel="stylesheet" /> 15 16 … … 53 54 </div> 54 55 <div id="pushh"></div> 55 <div data-ng-view=""/> 56 <div data-workspace-directive=""> 57 <div data-ng-view=""/> 58 </div> 56 59 <div id="pushf"></div> 57 60 </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"> 2 2 <div class="row-fluid"> 3 3 <div class="span3"> … … 19 19 <tbody> 20 20 <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> 22 22 <td data-ng-show="schema['sc:version'] != '[object Object]'" data-ng-bind="schema['sc:version']"/> 23 23 <td data-ng-hide="schema['sc:version'] != '[object Object]'"/> … … 34 34 <div class="span9"> 35 35 <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> 41 67 </div> 42 68 </div> -
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controlers.js
r3580 r3586 1 1 //SCHEMAcat angular controllers 2 2 SCHEMAcat.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; 5 6 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 11 35 //update the current route when user clicks in another page in the paginator. 12 //This triggers a $routeChangeS uccessevent since we are changing the route path part.36 //This triggers a $routeChangeStart event since we are changing the route path part. 13 37 $scope.selectPage = function (page) { 14 $location.path('workspace/page/'+ page + '/').search({'schemaIndex': 0}); 38 $location.path('workspace/page/'+ page + '/').search({'schemaIndex': 0}); 15 39 } 40 16 41 17 42 //update the current route when the uses clicks one schema in the list. This triggers … … 21 46 } 22 47 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); 32 64 }); 33 65 … … 36 68 //navigating back and forth) 37 69 $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); 39 73 }); 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 42 89 //in the 'index' position of the schemas list. 43 function getSchemaMetadata(index) {90 function loadSchemaMetadata(index) { 44 91 //update the selected row to the route search part. 45 $scope.selectedSchemaIndex = index;92 parentScope.selectedSchemaIndex = index; 46 93 47 94 //make AJAX call to get the schema metadata for the selected row 48 95 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']}, 50 97 function(result){ 51 alert("You've clicked the " + selectedSchemaRow['sc:name'] + " schema"); 98 $scope.animateSchemaChange = 'animated slideInDown'; 99 parentScope.resultAsArrived = true; 52 100 }); 53 101 } 54 102 103 parentScope.workspaceFirstLoaded = true; 104 55 105 }]); 106 107 SCHEMAcat.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 56 116 57 117 SCHEMAcat.controller('TopMenuCtrl', 58 118 [ '$scope', '$modal', 'UserService', 59 119 function($scope, $modal, UserService) { 60 61 120 $scope.displayName = UserService.displayName; 62 121 63 122 //Modal window handlers and options 64 123 $scope.loginClick = function () { -
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/modules.js
r3581 r3586 18 18 */ 19 19 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 } 24 28 } 25 29 }) -
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/styles/SCHEMAcat.css
r3580 r3586 13 13 } 14 14 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 } 15 25 .cursor-pointer{ 16 26 cursor:pointer;
Note: See TracChangeset
for help on using the changeset viewer.