Merge pull request #2244 from opf/hotfix/17485_relation_autocomplete_broken_with_relative_url

17485 Relation auto-completion broken with relative URL
pull/2266/head
Alex Coles 10 years ago
commit 8bcff3a8d2
  1. 4
      app/assets/javascripts/angular/helpers/path-helper.js
  2. 12
      app/assets/javascripts/angular/work_packages/view_models/relations-handler.js

@ -278,6 +278,10 @@ angular.module('openproject.helpers')
staticWorkPackagesPath: function() { staticWorkPackagesPath: function() {
return PathHelper.staticBase + PathHelper.workPackagesPath(); return PathHelper.staticBase + PathHelper.workPackagesPath();
}, },
staticWorkPackageAutoCompletePath: function(projectId, workPackageId) {
return PathHelper.staticBase
+ PathHelper.workPackageAutoCompletePath(projectId, workPackageId);
},
}; };
return PathHelper; return PathHelper;

@ -34,8 +34,13 @@ angular.module('openproject.viewModels')
'$timeout', '$timeout',
'WorkPackageService', 'WorkPackageService',
'ApiHelper', 'ApiHelper',
'PathHelper',
'MAX_AUTOCOMPLETER_ADDITION_ITERATIONS', 'MAX_AUTOCOMPLETER_ADDITION_ITERATIONS',
function($timeout, WorkPackageService, ApiHelper, MAX_AUTOCOMPLETER_ADDITION_ITERATIONS) { function($timeout,
WorkPackageService,
ApiHelper,
PathHelper,
MAX_AUTOCOMPLETER_ADDITION_ITERATIONS) {
function CommonRelationsHandler(workPackage, function CommonRelationsHandler(workPackage,
relations, relations,
relationsId) { relationsId) {
@ -97,9 +102,12 @@ angular.module('openproject.viewModels')
}, },
addAutocompleter: function(retries, workPackage, relationsId) { addAutocompleter: function(retries, workPackage, relationsId) {
var projectId = workPackage.props.projectId;
var workPackageId = workPackage.props.id;
if (angular.element('#relation_to_id-' + relationsId).size() === 1) { if (angular.element('#relation_to_id-' + relationsId).size() === 1) {
// Massive hack alert - Using old prototype autocomplete /////////// // Massive hack alert - Using old prototype autocomplete ///////////
var url = PathHelper.workPackageAutoCompletePath(workPackage.props.projectId, workPackage.props.id); var url = PathHelper.staticWorkPackageAutoCompletePath(projectId, workPackageId);
new Ajax.Autocompleter('relation_to_id-' + relationsId, new Ajax.Autocompleter('relation_to_id-' + relationsId,
'related_issue_candidates-' + relationsId, 'related_issue_candidates-' + relationsId,
url, url,

Loading…
Cancel
Save