From 06b38547f63beb1f78f3b5d4ca012f6cb246c1c8 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Mon, 9 Nov 2015 12:34:43 +0100 Subject: [PATCH] Move details route files to components directory --- .../work-package-details.controller.js} | 38 +++++++------------ .../work-package-details.route.html} | 0 frontend/app/routing.js | 2 +- .../app/work_packages/controllers/index.js | 23 ----------- 4 files changed, 14 insertions(+), 49 deletions(-) rename frontend/app/{work_packages/controllers/work-package-details-controller.js => components/routes/controllers/work-package-details.controller.js} (92%) rename frontend/app/{templates/work_packages.list.details.html => components/routes/templates/work-package-details.route.html} (100%) diff --git a/frontend/app/work_packages/controllers/work-package-details-controller.js b/frontend/app/components/routes/controllers/work-package-details.controller.js similarity index 92% rename from frontend/app/work_packages/controllers/work-package-details-controller.js rename to frontend/app/components/routes/controllers/work-package-details.controller.js index 042d2b8a3c..6630cef16b 100644 --- a/frontend/app/work_packages/controllers/work-package-details-controller.js +++ b/frontend/app/components/routes/controllers/work-package-details.controller.js @@ -1,4 +1,4 @@ -//-- copyright +// -- copyright // OpenProject is a project management system. // Copyright (C) 2012-2015 the OpenProject Foundation (OPF) // @@ -24,29 +24,17 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // See doc/COPYRIGHT.rdoc for more details. -//++ - -module.exports = function($scope, - $state, - latestTab, - workPackage, - I18n, - RELATION_TYPES, - RELATION_IDENTIFIERS, - $q, - $rootScope, - $filter, - WorkPackagesHelper, - PathHelper, - UsersHelper, - ConfigurationService, - WorkPackageService, - ActivityService, - CommonRelationsHandler, - ChildrenRelationsHandler, - ParentRelationsHandler, - NotificationsService - ) { +// ++ + +angular + .module('openproject.workPackages.controllers') + .controller('WorkPackageDetailsController', WorkPackageDetailsController); + +function WorkPackageDetailsController($scope, $state, latestTab, workPackage, I18n, RELATION_TYPES, + RELATION_IDENTIFIERS, $q, $rootScope, $filter, WorkPackagesHelper, PathHelper, UsersHelper, + ConfigurationService, WorkPackageService, ActivityService, CommonRelationsHandler, + ChildrenRelationsHandler, ParentRelationsHandler, NotificationsService) { + $scope.$on('$stateChangeSuccess', function(event, toState){ latestTab.registerState(toState.name); }); @@ -224,4 +212,4 @@ module.exports = function($scope, $state.current.url.replace(/\//, ''), $scope.workPackage ); -}; +} diff --git a/frontend/app/templates/work_packages.list.details.html b/frontend/app/components/routes/templates/work-package-details.route.html similarity index 100% rename from frontend/app/templates/work_packages.list.details.html rename to frontend/app/components/routes/templates/work-package-details.route.html diff --git a/frontend/app/routing.js b/frontend/app/routing.js index 00cd4ea783..7384ac7b96 100644 --- a/frontend/app/routing.js +++ b/frontend/app/routing.js @@ -162,7 +162,7 @@ angular.module('openproject') }) .state('work-packages.list.details', { url: '/details/{workPackageId:[0-9]+}', - templateUrl: '/templates/work_packages.list.details.html', + templateUrl: '/components/routes/templates/work-package-details.route.html', controller: 'WorkPackageDetailsController', reloadOnSearch: false, resolve: { diff --git a/frontend/app/work_packages/controllers/index.js b/frontend/app/work_packages/controllers/index.js index b1d59a1c73..682749ef68 100644 --- a/frontend/app/work_packages/controllers/index.js +++ b/frontend/app/work_packages/controllers/index.js @@ -72,29 +72,6 @@ angular.module('openproject.workPackages.controllers') precedes: 'precedes', follows: 'follows' }) - .controller('WorkPackageDetailsController', [ - '$scope', - '$state', - 'latestTab', - 'workPackage', - 'I18n', - 'RELATION_TYPES', - 'RELATION_IDENTIFIERS', - '$q', - '$rootScope', - '$filter', - 'WorkPackagesHelper', - 'PathHelper', - 'UsersHelper', - 'ConfigurationService', - 'WorkPackageService', - 'ActivityService', - 'CommonRelationsHandler', - 'ChildrenRelationsHandler', - 'ParentRelationsHandler', - 'NotificationsService', - require('./work-package-details-controller') - ]) .controller('WorkPackageShowController', [ '$scope', '$rootScope',