Commit 9e362629 authored by Robert Knight's avatar Robert Knight

Convert <loggedout-message>, <login-control> and <login-form> to components

parent 85217178
...@@ -142,6 +142,9 @@ module.exports = angular.module('h', [ ...@@ -142,6 +142,9 @@ module.exports = angular.module('h', [
.component('dropdownMenuBtn', require('./directive/dropdown-menu-btn')) .component('dropdownMenuBtn', require('./directive/dropdown-menu-btn'))
.component('helpLink', require('./directive/help-link')) .component('helpLink', require('./directive/help-link'))
.component('helpPanel', require('./directive/help-panel')) .component('helpPanel', require('./directive/help-panel'))
.component('loggedoutMessage', require('./directive/loggedout-message'))
.component('loginControl', require('./directive/login-control'))
.component('loginForm', require('./directive/login-form').component)
.component('publishAnnotationBtn', require('./directive/publish-annotation-btn')) .component('publishAnnotationBtn', require('./directive/publish-annotation-btn'))
.directive('excerpt', require('./directive/excerpt').directive) .directive('excerpt', require('./directive/excerpt').directive)
...@@ -151,9 +154,6 @@ module.exports = angular.module('h', [ ...@@ -151,9 +154,6 @@ module.exports = angular.module('h', [
.directive('hAutofocus', require('./directive/h-autofocus')) .directive('hAutofocus', require('./directive/h-autofocus'))
.directive('hOnTouch', require('./directive/h-on-touch')) .directive('hOnTouch', require('./directive/h-on-touch'))
.directive('hTooltip', require('./directive/h-tooltip')) .directive('hTooltip', require('./directive/h-tooltip'))
.directive('loggedoutMessage', require('./directive/loggedout-message'))
.directive('loginControl', require('./directive/login-control'))
.directive('loginForm', require('./directive/login-form').directive)
.directive('markdown', require('./directive/markdown')) .directive('markdown', require('./directive/markdown'))
.directive('searchStatusBar', require('./directive/search-status-bar')) .directive('searchStatusBar', require('./directive/search-status-bar'))
.directive('shareDialog', require('./directive/share-dialog')) .directive('shareDialog', require('./directive/share-dialog'))
......
'use strict'; 'use strict';
module.exports = function () { module.exports = {
return {
bindToController: true,
controllerAs: 'vm', controllerAs: 'vm',
//@ngInject //@ngInject
controller: function (serviceUrl) { controller: function (serviceUrl) {
this.serviceUrl = serviceUrl; this.serviceUrl = serviceUrl;
}, },
restrict: 'E',
scope: { scope: {
/** /**
* Called when the user clicks on the "Log in" text. * Called when the user clicks on the "Log in" text.
...@@ -16,5 +13,4 @@ module.exports = function () { ...@@ -16,5 +13,4 @@ module.exports = function () {
onLogin: '&', onLogin: '&',
}, },
template: require('../templates/loggedout_message.html'), template: require('../templates/loggedout_message.html'),
};
}; };
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
var persona = require('../filter/persona'); var persona = require('../filter/persona');
module.exports = function () { module.exports = {
return {
bindToController: true,
controllerAs: 'vm', controllerAs: 'vm',
//@ngInject //@ngInject
controller: function (serviceUrl, settings) { controller: function (serviceUrl, settings) {
...@@ -13,8 +11,7 @@ module.exports = function () { ...@@ -13,8 +11,7 @@ module.exports = function () {
return persona.isThirdPartyUser(this.auth.userid, settings.authDomain); return persona.isThirdPartyUser(this.auth.userid, settings.authDomain);
}; };
}, },
restrict: 'E', bindings: {
scope: {
/** /**
* An object representing the current authentication status. * An object representing the current authentication status.
*/ */
...@@ -39,5 +36,4 @@ module.exports = function () { ...@@ -39,5 +36,4 @@ module.exports = function () {
newStyle: '<', newStyle: '<',
}, },
template: require('../templates/login_control.html'), template: require('../templates/login_control.html'),
};
}; };
...@@ -93,18 +93,16 @@ function Controller($scope, $timeout, flash, session, formRespond, serviceUrl) { ...@@ -93,18 +93,16 @@ function Controller($scope, $timeout, flash, session, formRespond, serviceUrl) {
}); });
} }
module.exports = { var component = {
directive: function () {
return {
bindToController: true,
controller: Controller, controller: Controller,
controllerAs: 'vm', controllerAs: 'vm',
restrict: 'E', bindings: {
scope: {
onClose: '&', onClose: '&',
}, },
template: require('../templates/login_form.html'), template: require('../templates/login_form.html'),
}; };
},
module.exports = {
component: component,
Controller: Controller, Controller: Controller,
}; };
...@@ -28,7 +28,7 @@ function PageObject(element) { ...@@ -28,7 +28,7 @@ function PageObject(element) {
describe('loginControl', function () { describe('loginControl', function () {
before(function () { before(function () {
angular.module('app', []) angular.module('app', [])
.directive('loginControl', require('../login-control')); .component('loginControl', require('../login-control'));
}); });
beforeEach(function () { beforeEach(function () {
......
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