From 865837da383e064187d0283a54e05ab165591a0c Mon Sep 17 00:00:00 2001 From: Tim Buckley Date: Mon, 5 Oct 2015 15:50:47 -0600 Subject: [PATCH] Added initial homepage using the new dataset service. This homepage implements a sample layout that uses real example data, but is still a WIP and has a number of empty stub UI elements. Change-Id: Icf5afdfd1d078e250bec29af828ea63f78ee0a9e --- app/js/controllers/home.js | 19 ++++++++++++++ app/js/directives/tempest-summary.js | 24 ++++++++++++++++++ app/js/on_config.js | 7 +++-- app/views/directives/tempest-summary.html | 18 +++++++++++++ app/views/home.html | 31 ++++++++++++++++++----- 5 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 app/js/controllers/home.js create mode 100644 app/js/directives/tempest-summary.js create mode 100644 app/views/directives/tempest-summary.html diff --git a/app/js/controllers/home.js b/app/js/controllers/home.js new file mode 100644 index 0000000..2368de1 --- /dev/null +++ b/app/js/controllers/home.js @@ -0,0 +1,19 @@ +'use strict'; + +var controllersModule = require('./_index'); + +/** + * @ngInject + */ +function HomeCtrl(datasetService) { + + // ViewModel + var vm = this; + + datasetService.list().then(function(response) { + vm.tempest = response.data.tempest; + }); + +} + +controllersModule.controller('HomeCtrl', HomeCtrl); diff --git a/app/js/directives/tempest-summary.js b/app/js/directives/tempest-summary.js new file mode 100644 index 0000000..68809cb --- /dev/null +++ b/app/js/directives/tempest-summary.js @@ -0,0 +1,24 @@ +'use strict'; + +var directivesModule = require('./_index.js'); + +/** + * @ngInject + */ +function tempestSummary() { + var controller = function($scope, $attrs, datasetService) { + // TODO get extra data here + // (may require raw details, or extra metadata inside config.json) + }; + + return { + restrict: 'EA', + scope: { + 'dataset': '=' + }, + controller: controller, + templateUrl: 'directives/tempest-summary.html' + }; +} + +directivesModule.directive('tempestSummary', tempestSummary); diff --git a/app/js/on_config.js b/app/js/on_config.js index b2adcb3..b5068fa 100644 --- a/app/js/on_config.js +++ b/app/js/on_config.js @@ -7,10 +7,9 @@ function OnConfig($stateProvider, $locationProvider, $urlRouterProvider) { $locationProvider.html5Mode(true); - $stateProvider - .state('Home', { + $stateProvider.state('home', { url: '/', - controller: 'ExampleCtrl as home', + controller: 'HomeCtrl as home', templateUrl: 'home.html', title: 'Home' }); @@ -19,4 +18,4 @@ function OnConfig($stateProvider, $locationProvider, $urlRouterProvider) { } -module.exports = OnConfig; \ No newline at end of file +module.exports = OnConfig; diff --git a/app/views/directives/tempest-summary.html b/app/views/directives/tempest-summary.html new file mode 100644 index 0000000..7afb4a7 --- /dev/null +++ b/app/views/directives/tempest-summary.html @@ -0,0 +1,18 @@ +
+
+

{{ dataset.name }}

+
+
+ More details go here +
+ +
diff --git a/app/views/home.html b/app/views/home.html index 81c4d9e..8899451 100644 --- a/app/views/home.html +++ b/app/views/home.html @@ -1,18 +1,37 @@
-

{{ home.title }}

+

Datasets

-
+
-

Here is a fancy number served up courtesy of Angular: {{ home.number }}

+
+ No tempest datasets could be loaded! +
+
+
+
+
+ +
+
+
+
+

Additional Datasets

+
- - - + +