Repository: climate
Updated Branches:
  refs/heads/master 99acc8cc9 -> ee6b1b970


Add timeline directive


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/b39b3ddc
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/b39b3ddc
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/b39b3ddc

Branch: refs/heads/master
Commit: b39b3ddcd7860a3ff6a220c9bc93dc646a11a14c
Parents: e0c0898
Author: Michael Joyce <[email protected]>
Authored: Wed Jul 16 10:19:28 2014 -0700
Committer: Michael Joyce <[email protected]>
Committed: Wed Jul 16 10:19:28 2014 -0700

----------------------------------------------------------------------
 ocw-ui/frontend-new/app/index.html              |  1 +
 .../app/scripts/directives/timeline.js          | 35 ++++++++++++++++++++
 .../test/spec/directives/timeline.js            | 20 +++++++++++
 3 files changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/b39b3ddc/ocw-ui/frontend-new/app/index.html
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend-new/app/index.html 
b/ocw-ui/frontend-new/app/index.html
index 2b5aa63..2b07b4d 100644
--- a/ocw-ui/frontend-new/app/index.html
+++ b/ocw-ui/frontend-new/app/index.html
@@ -103,6 +103,7 @@
     <script src="scripts/directives/onblur.js"></script>
     <script src="scripts/directives/predictivefilebrowserinput.js"></script>
     <script src="scripts/directives/previewmap.js"></script>
+    <script src="scripts/directives/timeline.js"></script>
     <!-- endbuild -->
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/climate/blob/b39b3ddc/ocw-ui/frontend-new/app/scripts/directives/timeline.js
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend-new/app/scripts/directives/timeline.js 
b/ocw-ui/frontend-new/app/scripts/directives/timeline.js
new file mode 100644
index 0000000..2ba5d5e
--- /dev/null
+++ b/ocw-ui/frontend-new/app/scripts/directives/timeline.js
@@ -0,0 +1,35 @@
+'use strict';
+
+/**
+ * @ngdoc directive
+ * @name ocwUiApp.directive:timeline
+ * @description
+ * # timeline
+ */
+angular.module('ocwUiApp')
+.directive('timeline', function($rootScope, $window) {
+       return {
+               restrict: 'C',
+               replace: true,
+               transclude: true,
+               template: '<div id="OCWtimeline"></div>',
+               link: function(scope, element, attrs) {
+                       // Instantiate timeline object.
+                       $rootScope.timeline = new 
links.Timeline(document.getElementById('OCWtimeline'));
+
+                       // Redraw the timeline whenever the window is resized
+                       angular.element($window).bind('resize', function() {
+                               $rootScope.timeline.checkResize();
+                       });
+
+                       var options = {
+                               "width": "100%",
+                               "showCurrentTime": false,
+                               "moveable": false,
+                               "zoomable": false
+                       };
+
+                       $rootScope.timeline.draw([], options);
+               }
+       }
+});

http://git-wip-us.apache.org/repos/asf/climate/blob/b39b3ddc/ocw-ui/frontend-new/test/spec/directives/timeline.js
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend-new/test/spec/directives/timeline.js 
b/ocw-ui/frontend-new/test/spec/directives/timeline.js
new file mode 100644
index 0000000..e326f73
--- /dev/null
+++ b/ocw-ui/frontend-new/test/spec/directives/timeline.js
@@ -0,0 +1,20 @@
+'use strict';
+
+describe('Directive: timeline', function () {
+
+  // load the directive's module
+  beforeEach(module('ocwUiApp'));
+
+  var element,
+    scope;
+
+  beforeEach(inject(function ($rootScope) {
+    scope = $rootScope.$new();
+  }));
+
+  it('should make hidden element visible', inject(function ($compile) {
+    element = angular.element('<timeline></timeline>');
+    element = $compile(element)(scope);
+    expect(element.text()).toBe('this is the timeline directive');
+  }));
+});

Reply via email to