Only set watchers on custom fields for custom field columns

pull/1021/head
Till Breuer 11 years ago
parent b4e47cd173
commit 11ee346cb4
  1. 12
      app/assets/javascripts/angular/directives/timelines/timeline-column-name-directive.js

@ -9,16 +9,16 @@ angular.module('openproject.timelines.directives')
localePrefix: '@' localePrefix: '@'
}, },
link: function(scope, element) { link: function(scope, element) {
scope.$watch('customFields', function(){ if (CustomFieldHelper.isCustomFieldKey(scope.columnName)) {
if (CustomFieldHelper.isCustomFieldKey(scope.columnName)) { scope.$watch('customFields', function(){
var customFieldId = CustomFieldHelper.getCustomFieldId(scope.columnName); var customFieldId = CustomFieldHelper.getCustomFieldId(scope.columnName);
if (scope.customFields && scope.customFields[customFieldId]) { if (scope.customFields && scope.customFields[customFieldId]) {
element.html(scope.customFields[customFieldId].name); element.html(scope.customFields[customFieldId].name);
} }
} else { });
element.html(I18n.t(scope.localePrefix + '.' + scope.columnName)); } else {
} element.html(I18n.t(scope.localePrefix + '.' + scope.columnName));
}); }
} }
}; };

Loading…
Cancel
Save