Move addWpRelation directive to components

pull/4471/head
Alex Dik 9 years ago
parent 5a201b4df5
commit 6fed1a7b90
  1. 0
      frontend/app/components/wp-relations/add-wp-relation/add-wp-relation.directive.html
  2. 33
      frontend/app/components/wp-relations/add-wp-relation/add-wp-relation.directive.ts
  3. 2
      frontend/app/components/wp-relations/wp-relations.directive.html
  4. 2
      frontend/app/work_packages/tabs/index.js

@ -26,17 +26,20 @@
// See doc/COPYRIGHT.rdoc for more details.
//++
// TODO move to UI components
module.exports = function($http, PathHelper) {
import {wpTabsModule} from "../../../angular-modules";
declare const URI;
function addWpRelationDirective($http, PathHelper) {
return {
restrict: 'E',
templateUrl: '/templates/work_packages/tabs/_add_work_package_relation.html',
link: function(scope, element, attributes) {
templateUrl: '/components/wp-relations/add-wp-relation/add-wp-relation.directive.html',
link: function (scope) {
scope.relationToAddId = null;
scope.autocompleteWorkPackages = function(term) {
if (!term) {
return;
}
scope.autocompleteWorkPackages = function (term) {
if (!term) return;
var params = {
q: term,
scope: 'relatable',
@ -44,15 +47,17 @@ module.exports = function($http, PathHelper) {
id: scope.handler.workPackage.props.id,
'project_id': scope.handler.workPackage.embedded.project.props.id
};
return $http({
method: 'GET',
url: URI(PathHelper.workPackageJsonAutoCompletePath())
.search(params)
.toString()
}).then(function(response) {
method: 'GET',
url: URI(PathHelper.workPackageJsonAutoCompletePath()).search(params).toString()
}
).then(function (response) {
scope.options = response.data;
});
}
}
};
};
}
wpTabsModule.directive('addWpRelation', addWpRelationDirective);

@ -72,7 +72,7 @@
<!-- Add WP relation -->
<add-work-package-relation ng-switch-default></add-work-package-relation>
<add-wp-relation ng-switch-default></add-wp-relation>
</div>
</div>
</div>

@ -27,8 +27,6 @@
//++
angular.module('openproject.workPackages.tabs')
.directive('addWorkPackageRelation', require(
'./add-work-package-relation-directive'))
.directive('panelExpander', require('./panel-expander-directive'))
.directive('relatedWorkPackageTableRow', [
'I18n',

Loading…
Cancel
Save