Create unambiguous timeline paper element

pull/2258/head
Hagen Schink 10 years ago
parent c157459456
commit 5f4f6b6ab6
  1. 2
      app/assets/javascripts/angular/timelines/models/mixins/ui.js
  2. 10
      app/assets/javascripts/angular/timelines/models/timeline.js

@ -296,7 +296,7 @@ angular.module('openproject.timelines.models')
},
registerDrawPaper: function() {
// store the paper element for later use.
this.paperElement = jQuery('.tl-chart')[0];
this.paperElement = jQuery('#timeline-container-' + this.id + ' .tl-chart')[0];
},
getMeasuredHeight: function() {
return this.getUiRoot().find('.tl-left-main').height();

@ -58,11 +58,13 @@ angular.module('openproject.timelines.models')
//startup
angular.extend(Timeline, {
instances: [],
create: function(options) {
create: function(id, options) {
if (!id) {
throw new Error('No timelines id given');
}
if (!options) {
throw new Error('No configuration options given');
}
this.options = options;
this.extendOptions();
this.instances = [];
@ -70,6 +72,8 @@ angular.module('openproject.timelines.models')
var timeline = Object.create(Timeline);
// some private fields.
timeline.id = id;
timeline.options = options;
timeline.listeners = [];
timeline.data = {};
@ -723,7 +727,5 @@ angular.module('openproject.timelines.models')
};
}
return Timeline;
}]);

Loading…
Cancel
Save