diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index d4a481dc5..cced46f55 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -1,19 +1,13 @@ import ngModule from '../module'; +import Section from 'salix/components/section'; -class Controller { - constructor($scope, vnApp, $translate) { - this.$ = $scope; - this.vnApp = vnApp; - this.$translate = $translate; - } - +class Controller extends Section { onSubmit() { - this.$.watcher.submit().then(() => { - this.card.reload(); - }); + this.$.watcher.submit().then(() => + this.card.reload() + ); } } -Controller.$inject = ['$scope', 'vnApp', '$translate']; ngModule.component('vnRouteBasicData', { template: require('./index.html'), diff --git a/modules/route/front/create/index.js b/modules/route/front/create/index.js index 03fe574fc..703ecb49a 100644 --- a/modules/route/front/create/index.js +++ b/modules/route/front/create/index.js @@ -1,18 +1,13 @@ import ngModule from '../module'; +import Section from 'salix/components/section'; -export default class Controller { - constructor($scope, $state) { - this.$scope = $scope; - this.$state = $state; - } - +export default class Controller extends Section { onSubmit() { - this.$scope.watcher.submit().then( + this.$.watcher.submit().then( res => this.$state.go('route.card.summary', {id: res.data.id}) ); } } -Controller.$inject = ['$scope', '$state']; ngModule.component('vnRouteCreate', { template: require('./index.html'), diff --git a/modules/route/front/descriptor-popover/index.js b/modules/route/front/descriptor-popover/index.js index 7d5cd3d91..a0363839f 100644 --- a/modules/route/front/descriptor-popover/index.js +++ b/modules/route/front/descriptor-popover/index.js @@ -3,11 +3,8 @@ import Component from 'core/lib/component'; import './style.scss'; class Controller extends Component { - constructor($element, $scope, $http, $timeout, $q) { - super($element, $scope); - this.$timeout = $timeout; - this.$http = $http; - this.$q = $q; + constructor($element, $) { + super($element, $); this.route = null; this._quicklinks = {}; } @@ -118,7 +115,6 @@ class Controller extends Component { }); } } -Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q']; ngModule.component('vnRouteDescriptorPopover', { template: require('./index.html'), diff --git a/modules/route/front/descriptor/index.js b/modules/route/front/descriptor/index.js index e28654b99..df2cd21a1 100644 --- a/modules/route/front/descriptor/index.js +++ b/modules/route/front/descriptor/index.js @@ -2,8 +2,8 @@ import ngModule from '../module'; import Component from 'core/lib/component'; class Controller extends Component { - constructor($element, $scope, $httpParamSerializer) { - super($element, $scope); + constructor($element, $, $httpParamSerializer) { + super($element, $); this.$httpParamSerializer = $httpParamSerializer; this.moreOptions = [ diff --git a/modules/route/front/index/index.js b/modules/route/front/index/index.js index 8fdde810c..9c6962f8f 100644 --- a/modules/route/front/index/index.js +++ b/modules/route/front/index/index.js @@ -1,11 +1,7 @@ import ngModule from '../module'; +import Section from 'salix/components/section'; -export default class Controller { - constructor($scope, vnToken) { - this.$ = $scope; - this.accessToken = vnToken.token; - } - +export default class Controller extends Section { showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; event.preventDefault(); @@ -32,7 +28,6 @@ export default class Controller { this.$.model.clear(); } } -Controller.$inject = ['$scope', 'vnToken']; ngModule.component('vnRouteIndex', { template: require('./index.html'), diff --git a/modules/route/front/log/index.js b/modules/route/front/log/index.js index ff0a2a9d1..b7d456b23 100644 --- a/modules/route/front/log/index.js +++ b/modules/route/front/log/index.js @@ -1,15 +1,7 @@ import ngModule from '../module'; - -class Controller { - constructor($scope, $stateParams) { - this.$scope = $scope; - this.$stateParams = $stateParams; - } -} - -Controller.$inject = ['$scope', '$stateParams']; +import Section from 'salix/components/section'; ngModule.component('vnRouteLog', { template: require('./index.html'), - controller: Controller, + controller: Section, }); diff --git a/modules/route/front/summary/index.js b/modules/route/front/summary/index.js index b1d42e6f1..a922ad008 100644 --- a/modules/route/front/summary/index.js +++ b/modules/route/front/summary/index.js @@ -1,12 +1,8 @@ import ngModule from '../module'; +import Section from 'salix/components/section'; import './style.scss'; -class Controller { - constructor($scope, $http) { - this.$http = $http; - this.$ = $scope; - } - +class Controller extends Section { set route(value) { this._route = value; if (value && value.id) @@ -47,8 +43,6 @@ class Controller { } } -Controller.$inject = ['$scope', '$http']; - ngModule.component('vnRouteSummary', { template: require('./index.html'), controller: Controller, diff --git a/modules/route/front/summary/index.spec.js b/modules/route/front/summary/index.spec.js index 0dfc016b4..99c029394 100644 --- a/modules/route/front/summary/index.spec.js +++ b/modules/route/front/summary/index.spec.js @@ -9,7 +9,8 @@ describe('Route', () => { beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; - controller = $componentController('vnRouteSummary'); + const $element = angular.element(''); + controller = $componentController('vnRouteSummary', {$element}); controller.route = {id: 1}; })); diff --git a/modules/route/front/tickets/index.js b/modules/route/front/tickets/index.js index f36330235..556ad0b6c 100644 --- a/modules/route/front/tickets/index.js +++ b/modules/route/front/tickets/index.js @@ -3,12 +3,6 @@ import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { - constructor($element, $scope, $filter) { - super($element, $scope); - - this.$filter = $filter; - } - get route() { return this._route; } @@ -200,8 +194,6 @@ class Controller extends Section { } } -Controller.$inject = ['$element', '$scope', '$filter']; - ngModule.component('vnRouteTickets', { template: require('./index.html'), controller: Controller,