Show plugin attributes in WP overview

pull/1683/head
Hagen Schink 10 years ago
parent 50519eccdc
commit f11738ad67
  1. 17
      app/assets/javascripts/angular/config/configuration-service.js
  2. 11
      app/assets/javascripts/angular/work_packages/controllers/details-tab-overview-controller.js
  3. 10
      app/controllers/work_packages_controller.rb

@ -28,9 +28,16 @@
angular.module('openproject.config')
.constant('DEFAULT_WORK_PACKAGE_PROPERTIES', [
'status', 'assignee', 'responsible',
'date', 'percentageDone', 'priority',
'estimatedTime', 'versionName'
])
.service('ConfigurationService', [
'$log',
function($log) {
'DEFAULT_WORK_PACKAGE_PROPERTIES',
function($log, DEFAULT_WORK_PACKAGE_PROPERTIES) {
return {
settingsPresent: function() {
@ -80,6 +87,14 @@ angular.module('openproject.config')
},
timeFormat: function() {
return gon.settings.display.time_format;
},
workPackageAttributeSettingsPresent: function() {
return this.settingsPresent() && gon.settings.hasOwnProperty('work_package_attributes');
},
workPackageAttributes: function() {
var attributes = (this.workPackageAttributeSettingsPresent()) ? gon.settings.work_package_attributes : [];
return DEFAULT_WORK_PACKAGE_PROPERTIES.concat(attributes);
}
};
}]);

@ -28,23 +28,18 @@
angular.module('openproject.workPackages.controllers')
.constant('DEFAULT_WORK_PACKAGE_PROPERTIES', [
'status', 'assignee', 'responsible',
'date', 'percentageDone', 'priority',
'estimatedTime', 'versionName'
])
.constant('USER_TYPE', 'user')
.controller('DetailsTabOverviewController', [
'$scope',
'I18n',
'DEFAULT_WORK_PACKAGE_PROPERTIES',
'ConfigurationService',
'USER_TYPE',
'CustomFieldHelper',
'WorkPackagesHelper',
'UserService',
'$q',
function($scope, I18n, DEFAULT_WORK_PACKAGE_PROPERTIES, USER_TYPE, CustomFieldHelper, WorkPackagesHelper, UserService, $q) {
function($scope, I18n, ConfigurationService, USER_TYPE, CustomFieldHelper, WorkPackagesHelper, UserService, $q) {
// work package properties
@ -52,7 +47,7 @@ angular.module('openproject.workPackages.controllers')
$scope.emptyWorkPackageProperties = [];
$scope.userPath = PathHelper.staticUserPath;
var workPackageProperties = DEFAULT_WORK_PACKAGE_PROPERTIES;
var workPackageProperties = ConfigurationService.workPackageAttributes();
function getPropertyValue(property, format) {
if (format === USER_TYPE) {

@ -206,6 +206,7 @@ class WorkPackagesController < ApplicationController
respond_to do |format|
format.html do
gon.settings = client_preferences
gon.settings[:work_package_attributes] = hook_overview_attributes
render :index, :locals => { :query => @query,
:project => @project },
@ -454,4 +455,13 @@ class WorkPackagesController < ApplicationController
def parse_preview_data
parse_preview_data_helper :work_package, [:notes, :description]
end
def hook_overview_attributes
attributes = []
call_hook(:work_packages_overview_attributes,
work_package: work_package,
project: project,
attributes: attributes)
attributes
end
end

Loading…
Cancel
Save