OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/assets/javascripts/angular/controllers/timelines_controller.js

32 lines
1.1 KiB

timelinesApp.controller('TimelinesController', ['$scope', '$window', 'TimelineService', function($scope, $window, TimelineService){
$scope.switchTimeline = function() {
$window.location.href = $scope.timelines[$scope.currentTimelineId].path;
};
$scope.timelineContainerNo = 1; // formerly rand(10**75), TODO increment after each timeline startup
$scope.timelines = gon.timelines;
$scope.currentTimelineId = gon.current_timeline_id;
$scope.getTimelineContainerElementId = function() {
return 'timeline-container-' + $scope.timelineContainerNo;
};
$scope.getTimelineContainer = function() {
return angular.element(document.querySelector('#' + $scope.getTimelineContainerElementId()));
};
angular.element(document).ready(function () {
// aggregate timeline options
$scope.timelineTranslations = gon.timeline_translations;
$scope.timelineOptions = angular.extend(gon.timeline_options, {
ui_root: $scope.getTimelineContainer(),
i18n: $scope.timelineTranslations
});
// load timeline
$scope.timeline = TimelineService.loadTimeline($scope.timelineOptions);
});
}]);