Commit 93c6e52e authored by Robert Knight's avatar Robert Knight

Convert <timestamp> to a component

parent 9e362629
...@@ -146,6 +146,7 @@ module.exports = angular.module('h', [ ...@@ -146,6 +146,7 @@ module.exports = angular.module('h', [
.component('loginControl', require('./directive/login-control')) .component('loginControl', require('./directive/login-control'))
.component('loginForm', require('./directive/login-form').component) .component('loginForm', require('./directive/login-form').component)
.component('publishAnnotationBtn', require('./directive/publish-annotation-btn')) .component('publishAnnotationBtn', require('./directive/publish-annotation-btn'))
.component('timestamp', require('./directive/timestamp'))
.directive('excerpt', require('./directive/excerpt').directive) .directive('excerpt', require('./directive/excerpt').directive)
.directive('formInput', require('./directive/form-input')) .directive('formInput', require('./directive/form-input'))
...@@ -166,7 +167,6 @@ module.exports = angular.module('h', [ ...@@ -166,7 +167,6 @@ module.exports = angular.module('h', [
.directive('svgIcon', require('./directive/svg-icon')) .directive('svgIcon', require('./directive/svg-icon'))
.directive('tagEditor', require('./directive/tag-editor')) .directive('tagEditor', require('./directive/tag-editor'))
.directive('threadList', require('./directive/thread-list')) .directive('threadList', require('./directive/thread-list'))
.directive('timestamp', require('./directive/timestamp'))
.directive('topBar', require('./directive/top-bar')) .directive('topBar', require('./directive/top-bar'))
.directive('windowScroll', require('./directive/window-scroll')) .directive('windowScroll', require('./directive/window-scroll'))
......
...@@ -11,7 +11,7 @@ describe('timestamp', function () { ...@@ -11,7 +11,7 @@ describe('timestamp', function () {
before(function () { before(function () {
angular.module('app',[]) angular.module('app',[])
.directive('timestamp', require('../timestamp')); .component('timestamp', require('../timestamp'));
}); });
beforeEach(function () { beforeEach(function () {
......
...@@ -42,19 +42,15 @@ function TimestampController($scope, time) { ...@@ -42,19 +42,15 @@ function TimestampController($scope, time) {
}; };
} }
module.exports = function () { module.exports = {
return { controller: TimestampController,
bindToController: true, controllerAs: 'vm',
controller: TimestampController, bindings: {
controllerAs: 'vm', className: '<',
restrict: 'E', href: '<',
scope: { timestamp: '<',
className: '<', },
href: '<', template: ['<a class="{{vm.className}}" target="_blank" ng-title="vm.absoluteTimestamp"',
timestamp: '<', ' href="{{vm.href}}"',
}, '>{{vm.relativeTimestamp}}</a>'].join(''),
template: ['<a class="{{vm.className}}" target="_blank" ng-title="vm.absoluteTimestamp"',
' href="{{vm.href}}"',
'>{{vm.relativeTimestamp}}</a>'].join(''),
};
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment