refactor display view resolution

pull/2478/head
Mihail Maxacov 10 years ago
parent 75c6312a84
commit cd9fa7ae53
  1. 2
      frontend/app/services/index.js
  2. 11
      frontend/app/services/overview-tab-inplace-editor-config.js
  3. 6
      frontend/app/ui_components/inplace-editor-directive.js
  4. 4
      frontend/app/work_packages/controllers/details-tab-overview-controller.js
  5. 2
      frontend/app/work_packages/controllers/index.js
  6. 20
      frontend/public/templates/components/inplace_editor.html
  7. 1
      frontend/public/templates/components/inplace_editor/display/default.html
  8. 1
      frontend/public/templates/components/inplace_editor/display/user.html
  9. 8
      frontend/public/templates/components/inplace_editor/display/version.html
  10. 1
      frontend/public/templates/components/inplace_editor/display/wiki_textarea.html
  11. 2
      frontend/public/templates/work_packages/tabs/overview.html

@ -34,7 +34,7 @@ angular.module('openproject.services')
.service('AuthorisationService', require('./authorisation-service'))
.service('GroupService', ['$http', 'PathHelper', require('./group-service')])
.service('HookService', require('./hook-service'))
.service('OverviewService', require('./overview-service'))
.service('OverviewTabInplaceEditorConfig', require('./overview-tab-inplace-editor-config'))
.service('PaginationService', ['DEFAULT_PAGINATION_OPTIONS', require(
'./pagination-service')])
.service('PriorityService', ['$http', 'PathHelper', require(

@ -28,20 +28,22 @@
module.exports = function() {
var OverviewService = {
var OverviewTabInplaceEditorConfig = {
getInplaceProperties: function() {
return {
assignee: {
type: 'select2',
attribute: 'assignee',
embedded: false,
placeholder: '-'
placeholder: '-',
displayStrategy: 'user',
},
responsible: {
type: 'select2',
attribute: 'responsible',
embedded: false,
placeholder: '-'
placeholder: '-',
displayStrategy: 'user'
},
status: {
type: 'select2',
@ -54,11 +56,12 @@ module.exports = function() {
attribute: 'version.name',
embedded: true,
placeholder: '-',
displayStrategy: 'version',
attributeTitle: I18n.t('js.work_packages.properties.version')
}
};
}
};
return OverviewService;
return OverviewTabInplaceEditorConfig;
};

@ -33,6 +33,7 @@ module.exports = function($timeout, FocusHelper, PathHelper, InplaceEditorDispat
templateUrl: '/templates/components/inplace_editor.html',
scope: {
type: '@inedType',
displayStrategy: '@?inedDisplayStrategy',
entity: '=inedEntity',
attribute: '@inedAttribute',
attributeTitle: '@inedAttributeTitle',
@ -95,6 +96,7 @@ module.exports = function($timeout, FocusHelper, PathHelper, InplaceEditorDispat
$scope.onFail = onFail;
$scope.onFinally = onFinally;
$scope.getTemplateUrl = getTemplateUrl;
$scope.getDisplayTemplateUrl = getDisplayTemplateUrl;
$scope.pathHelper = PathHelper;
activate();
@ -189,5 +191,9 @@ module.exports = function($timeout, FocusHelper, PathHelper, InplaceEditorDispat
return '/templates/components/inplace_editor/editable/' + $scope.type + '.html';
}
function getDisplayTemplateUrl() {
return '/templates/components/inplace_editor/display/' + ($scope.displayStrategy || 'default') + '.html';
}
}
};

@ -44,10 +44,10 @@ module.exports = function($scope,
UserService,
VersionService,
HookService,
OverviewService,
OverviewTabInplaceEditorConfig,
$q) {
$scope.inplaceProperties = OverviewService.getInplaceProperties();
$scope.inplaceProperties = OverviewTabInplaceEditorConfig.getInplaceProperties();
$scope.userPath = PathHelper.staticUserPath;
AuthorisationService.initModelAuth('work_package' + $scope.workPackage.id,

@ -54,7 +54,7 @@ angular.module('openproject.workPackages.controllers')
'UserService',
'VersionService',
'HookService',
'OverviewService',
'OverviewTabInplaceEditorConfig',
'$q',
require('./details-tab-overview-controller')
])

@ -1,22 +1,6 @@
<div class="inplace-editor type-{{type}} attribute-{{attribute}}" ng-class="{busy: isBusy, preview: isPreview, editable: isEditable}">
<div class="ined-read-value" ng-class="{ default: placeholderSet, editable: isEditable }" ng-hide="isEditing" ng-switch="type">
<span class="read-value-wrapper" ng-switch-when="wiki_textarea" ng-bind-html="readValue"></span>
<span class="read-value-wrapper" ng-switch-default>
<span ng-if="!isUserLink">
<span ng-if="attribute == 'version.name'">
<span ng-if="entity.links.version">
<a href="{{pathHelper.versionPath(entity.embedded.version.props.id)}}">
{{entity.links.version.props.title}}
</a>
</span>
<span ng-if="!entity.links.version">
{{readValue}}
</span>
</span>
<span ng-if="attribute != 'version.name'" ng-bind="readValue"></span>
</span>
<user-field ng-if="isUserLink" user="readValue"></user-field>
</span>
<div class="ined-read-value" ng-class="{ default: placeholderSet, editable: isEditable }" ng-hide="isEditing">
<span class="read-value-wrapper" ng-include src="getDisplayTemplateUrl()"></span>
<span ng-if="isEditable" class="editing-link-wrapper">
<accessible-by-keyboard execute="startEditing()">
<icon-wrapper icon-name="edit" icon-title="{{ editTitle }}">

@ -0,0 +1 @@
<user-field user="readValue"></user-field>

@ -0,0 +1,8 @@
<span ng-if="entity.links.version">
<a href="{{pathHelper.versionPath(entity.embedded.version.props.id)}}">
{{entity.links.version.props.title}}
</a>
</span>
<span ng-if="!entity.links.version">
{{readValue}}
</span>

@ -11,6 +11,7 @@
<div class="single-attribute wiki">
<span inplace-editor
ined-type="wiki_textarea"
ined-display-strategy="wiki_textarea"
ined-entity="workPackage"
ined-attribute="description"
ined-attribute-title="{{ I18n.t('js.work_packages.properties.description') }}"
@ -49,6 +50,7 @@
ng-class="['attributes-key-value--value', '-' + propertyData.format]">
<div inplace-editor
ined-type="{{inplaceProperties[propertyData.property].type}}"
ined-display-strategy="{{inplaceProperties[propertyData.property].displayStrategy}}"
ined-entity="workPackage"
ined-attribute="{{inplaceProperties[propertyData.property].attribute}}"
ined-attribute-embedded="inplaceProperties[propertyData.property].embedded"

Loading…
Cancel
Save