diff --git a/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.html b/frontend/app/components/inplace-edit/display-pane/display-pane.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.html rename to frontend/app/components/inplace-edit/display-pane/display-pane.directive.html diff --git a/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.js b/frontend/app/components/inplace-edit/display-pane/display-pane.directive.ts similarity index 89% rename from frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.js rename to frontend/app/components/inplace-edit/display-pane/display-pane.directive.ts index 2174144d90..11263f75f6 100644 --- a/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.js +++ b/frontend/app/components/inplace-edit/display-pane/display-pane.directive.ts @@ -26,16 +26,40 @@ // See doc/COPYRIGHT.rdoc for more details. // ++ -angular - .module('openproject.inplace-edit') - .directive('inplaceEditorDisplayPane', inplaceEditorDisplayPane); +function InplaceEditorDisplayPaneController($scope, HookService, I18n:op.I18n) { + var field = $scope.field; + + this.getAriaLabel = function() { + return I18n.t('js.work_packages.edit_attribute', { attribute: field.getKeyValue() }); + }; + + this.placeholder = field.placeholder; + + this.startEditing = function() { + if (!field.isEditable()) { + throw 'Trying to edit the non editable field "' + field.name + '"'; + } + var fieldController = $scope.fieldController; + fieldController.isEditing = true; + }; + + // for dynamic type that is set by plugins + // refactor to a service method the whole extraction + this.getDynamicDirectiveName = function() { + return HookService.call('workPackageOverviewAttributes', { + type: field.getSchema(field.resource).props[field.name].type, + field: field.name, + workPackage: field.resource + })[0]; + }; +} function inplaceEditorDisplayPane(EditableFieldsState, $timeout) { return { replace: true, transclude: true, - require: '^workPackageField', - templateUrl: '/components/inplace-edit/directives/display-pane/display-pane.directive.html', + require: '^wpField', + templateUrl: '/components/inplace-edit/display-pane/display-pane.directive.html', controller: InplaceEditorDisplayPaneController, controllerAs: 'displayPaneController', @@ -50,7 +74,8 @@ function inplaceEditorDisplayPane(EditableFieldsState, $timeout) { if (strategy !== scope.displayStrategy) { scope.displayStrategy = strategy; - scope.templateUrl = '/templates/inplace-edit/display/fields/' + strategy +'.html'; + scope.templateUrl = + '/components/inplace-edit/field-templates/display/' + strategy + '.html'; } }); @@ -78,34 +103,7 @@ function inplaceEditorDisplayPane(EditableFieldsState, $timeout) { } }; } -inplaceEditorDisplayPane.$inject = ['EditableFieldsState', '$timeout']; - -function InplaceEditorDisplayPaneController($scope, HookService) { - var field = $scope.field; - - this.getAriaLabel = function() { - return I18n.t('js.work_packages.edit_attribute', { attribute: field.getKeyValue() }); - }; - - this.placeholder = field.placeholder; - - this.startEditing = function() { - if (!field.isEditable()) { - throw 'Trying to edit the non editable field "' + field.name + '"'; - } - var fieldController = $scope.fieldController; - fieldController.isEditing = true; - }; - - // for dynamic type that is set by plugins - // refactor to a service method the whole extraction - this.getDynamicDirectiveName = function() { - return HookService.call('workPackageOverviewAttributes', { - type: field.getSchema(field.resource).props[field.name].type, - field: field.name, - workPackage: field.resource - })[0]; - }; -} -InplaceEditorDisplayPaneController.$inject = ['$scope', 'HookService']; +angular + .module('openproject.inplace-edit') + .directive('inplaceEditorDisplayPane', inplaceEditorDisplayPane); diff --git a/frontend/app/components/inplace-edit/directives/edit-actions-bar/edit-actions-bar.directive.html b/frontend/app/components/inplace-edit/edit-actions-bar/edit-actions-bar.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/edit-actions-bar/edit-actions-bar.directive.html rename to frontend/app/components/inplace-edit/edit-actions-bar/edit-actions-bar.directive.html diff --git a/frontend/app/components/inplace-edit/directives/edit-actions-bar/edit-actions-bar.directive.js b/frontend/app/components/inplace-edit/edit-actions-bar/edit-actions-bar.directive.ts similarity index 66% rename from frontend/app/components/inplace-edit/directives/edit-actions-bar/edit-actions-bar.directive.js rename to frontend/app/components/inplace-edit/edit-actions-bar/edit-actions-bar.directive.ts index adafcf47af..f46701faef 100644 --- a/frontend/app/components/inplace-edit/directives/edit-actions-bar/edit-actions-bar.directive.js +++ b/frontend/app/components/inplace-edit/edit-actions-bar/edit-actions-bar.directive.ts @@ -26,16 +26,41 @@ // See doc/COPYRIGHT.rdoc for more details. // ++ -angular - .module('openproject.inplace-edit') - .directive('editActionsBar', editActionsBar); +class EditActionsBarController { + public onSave; + public onCancel; + public text; + + constructor(protected EditableFieldsState, + protected inplaceEditMultiStorage, + protected inplaceEditAll, + I18n:op.I18n) { + + this.text = { + save: I18n.t('js.button_save'), + cancel: I18n.t('js.button_cancel') + } + } + + public visible() { + return this.inplaceEditAll.state && this.EditableFieldsState.canEdit; + } + + public save() { + this.inplaceEditMultiStorage.save().then(this.onSave); + } + + public cancel() { + this.onCancel(); + this.inplaceEditAll.cancel(); + } +} function editActionsBar() { return { restrict: 'E', replace: true, - templateUrl: '/components/inplace-edit/directives/edit-actions-bar/' + - 'edit-actions-bar.directive.html', + templateUrl: '/components/inplace-edit/edit-actions-bar/edit-actions-bar.directive.html', scope: { onCancel: '&', @@ -43,31 +68,11 @@ function editActionsBar() { }, bindToController: true, - controllerAs: 'vm', - - controller: function ($scope, I18n, EditableFieldsState, inplaceEditMultiStorage, - inplaceEditAll) { - var vm = this; - - angular.extend(vm, { - visible: function () { - return inplaceEditAll.state && EditableFieldsState.canEdit; - }, - - save: function () { - inplaceEditMultiStorage.save().then(vm.onSave); - }, - - cancel: function () { - vm.onCancel(); - inplaceEditAll.cancel(); - }, - - text: { - save: I18n.t('js.button_save'), - cancel: I18n.t('js.button_cancel') - } - }); - } + controller: EditActionsBarController, + controllerAs: 'vm' }; } + +angular + .module('openproject.inplace-edit') + .directive('editActionsBar', editActionsBar); diff --git a/frontend/app/components/inplace-edit/directives/edit-pane/edit-pane.directive.html b/frontend/app/components/inplace-edit/edit-pane/edit-pane.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/edit-pane/edit-pane.directive.html rename to frontend/app/components/inplace-edit/edit-pane/edit-pane.directive.html diff --git a/frontend/app/components/inplace-edit/directives/edit-pane/edit-pane.directive.js b/frontend/app/components/inplace-edit/edit-pane/edit-pane.directive.ts similarity index 87% rename from frontend/app/components/inplace-edit/directives/edit-pane/edit-pane.directive.js rename to frontend/app/components/inplace-edit/edit-pane/edit-pane.directive.ts index 1e95c6a970..0eadf64560 100644 --- a/frontend/app/components/inplace-edit/directives/edit-pane/edit-pane.directive.js +++ b/frontend/app/components/inplace-edit/edit-pane/edit-pane.directive.ts @@ -26,15 +26,11 @@ // See doc/COPYRIGHT.rdoc for more details. // ++ -angular - .module('openproject.inplace-edit') - .directive('inplaceEditorEditPane', inplaceEditorEditPane); - function inplaceEditorEditPane($timeout, EditableFieldsState, FocusHelper, inplaceEditAll) { return { transclude: true, - require: '^workPackageField', - templateUrl: '/components/inplace-edit/directives/edit-pane/edit-pane.directive.html', + require: '^wpField', + templateUrl: '/components/inplace-edit/edit-pane/edit-pane.directive.html', controllerAs: 'editPaneController', controller: InplaceEditorEditPaneController, @@ -85,9 +81,16 @@ function inplaceEditorEditPane($timeout, EditableFieldsState, FocusHelper, inpla }; } -function InplaceEditorEditPaneController($scope, $element, $location, $timeout, - EditableFieldsState, inplaceEditStorage, inplaceEditMultiStorage, inplaceEditErrors, - inplaceEditAll) { +function InplaceEditorEditPaneController($scope, + $element, + $location, + $timeout, + EditableFieldsState, + inplaceEditStorage, + inplaceEditMultiStorage, + inplaceEditErrors, + I18n, + inplaceEditAll) { var vm = this; var field = $scope.field; @@ -163,6 +166,7 @@ function InplaceEditorEditPaneController($scope, $element, $location, $timeout, var strategy = field.getInplaceEditStrategy(); if (field.name === 'date' && strategy === 'date') { + //noinspection TypeScriptUnresolvedVariable form.pendingChanges = EditableFieldsState.getPendingFormChanges(); form.pendingChanges['startDate'] = form.pendingChanges['dueDate'] = @@ -171,7 +175,7 @@ function InplaceEditorEditPaneController($scope, $element, $location, $timeout, if (strategy !== $scope.strategy) { $scope.strategy = strategy; - $scope.templateUrl = '/templates/inplace-edit/edit/fields/' + strategy + '.html'; + $scope.templateUrl = '/components/inplace-edit/field-templates/edit/' + strategy + '.html'; } }); @@ -183,3 +187,7 @@ function InplaceEditorEditPaneController($scope, $element, $location, $timeout, vm.discardEditing(); }); } + +angular + .module('openproject.inplace-edit') + .directive('inplaceEditorEditPane', inplaceEditorEditPane); diff --git a/frontend/app/components/inplace-edit/services/editable-fields-state.service.js b/frontend/app/components/inplace-edit/editable-fields-state/editable-fields-state.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/editable-fields-state.service.js rename to frontend/app/components/inplace-edit/editable-fields-state/editable-fields-state.service.js diff --git a/frontend/app/components/inplace-edit/services/editable-fields-state.service.test.js b/frontend/app/components/inplace-edit/editable-fields-state/editable-fields-state.service.test.js similarity index 100% rename from frontend/app/components/inplace-edit/services/editable-fields-state.service.test.js rename to frontend/app/components/inplace-edit/editable-fields-state/editable-fields-state.service.test.js diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html b/frontend/app/components/inplace-edit/field-directives/display-spent-time/display-spent-time.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html rename to frontend/app/components/inplace-edit/field-directives/display-spent-time/display-spent-time.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.js b/frontend/app/components/inplace-edit/field-directives/display-spent-time/display-spent-time.directive.js similarity index 95% rename from frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.js rename to frontend/app/components/inplace-edit/field-directives/display-spent-time/display-spent-time.directive.js index 90101d4494..9f4bfb903f 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/display-spent-time/display-spent-time.directive.js @@ -35,7 +35,7 @@ function inplaceDisplaySpentTime() { restrict: 'E', transclude: true, replace: true, - templateUrl: '/components/inplace-edit/directives/field-display/display-spent-time/' + + templateUrl: '/components/inplace-edit/field-directives/display-spent-time/' + 'display-spent-time.directive.html', controller: InplaceDisplaySpentTimeController, diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.html b/frontend/app/components/inplace-edit/field-directives/display-user/display-user.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.html rename to frontend/app/components/inplace-edit/field-directives/display-user/display-user.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.js b/frontend/app/components/inplace-edit/field-directives/display-user/display-user.directive.js similarity index 97% rename from frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.js rename to frontend/app/components/inplace-edit/field-directives/display-user/display-user.directive.js index 76eeafa13b..71b22467f9 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/display-user/display-user.directive.js @@ -36,7 +36,7 @@ function inplaceDisplayUser() { transclude: true, replace: true, require: '^inplaceEditorDisplayPane', - templateUrl: '/components/inplace-edit/directives/field-display/display-user/' + + templateUrl: '/components/inplace-edit/field-directives/display-user/' + 'display-user.directive.html', controller: InplaceDisplayUserController, diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html b/frontend/app/components/inplace-edit/field-directives/display-version/display-version.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html rename to frontend/app/components/inplace-edit/field-directives/display-version/display-version.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.js b/frontend/app/components/inplace-edit/field-directives/display-version/display-version.directive.js similarity index 95% rename from frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.js rename to frontend/app/components/inplace-edit/field-directives/display-version/display-version.directive.js index f818f52a2a..968d89406e 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/display-version/display-version.directive.js @@ -35,7 +35,7 @@ function inplaceDisplayVersion() { restrict: 'E', transclude: true, replace: true, - templateUrl: '/components/inplace-edit/directives/field-display/display-version/' + + templateUrl: '/components/inplace-edit/field-directives/display-version/' + 'display-version.directive.html', controller: InplaceDisplayVersionController, diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-date-range/edit-date-range.directive.html b/frontend/app/components/inplace-edit/field-directives/edit-date-range/edit-date-range.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-date-range/edit-date-range.directive.html rename to frontend/app/components/inplace-edit/field-directives/edit-date-range/edit-date-range.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-date-range/edit-date-range.directive.js b/frontend/app/components/inplace-edit/field-directives/edit-date-range/edit-date-range.directive.js similarity index 98% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-date-range/edit-date-range.directive.js rename to frontend/app/components/inplace-edit/field-directives/edit-date-range/edit-date-range.directive.js index 4dd72d0470..88a40f0436 100644 --- a/frontend/app/components/inplace-edit/directives/field-edit/edit-date-range/edit-date-range.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/edit-date-range/edit-date-range.directive.js @@ -37,7 +37,7 @@ function inplaceEditorDateRange($timeout, TimezoneService, WorkPackageFieldServi restrict: 'E', transclude: true, replace: true, - templateUrl: '/components/inplace-edit/directives/field-edit/edit-date-range/' + + templateUrl: '/components/inplace-edit/field-directives/edit-date-range/' + 'edit-date-range.directive.html', controller: angular.noop, diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-date/edit-date.directive.html b/frontend/app/components/inplace-edit/field-directives/edit-date/edit-date.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-date/edit-date.directive.html rename to frontend/app/components/inplace-edit/field-directives/edit-date/edit-date.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-date/edit-date.directive.js b/frontend/app/components/inplace-edit/field-directives/edit-date/edit-date.directive.js similarity index 97% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-date/edit-date.directive.js rename to frontend/app/components/inplace-edit/field-directives/edit-date/edit-date.directive.js index 660253bdf3..39db9e5b33 100644 --- a/frontend/app/components/inplace-edit/directives/field-edit/edit-date/edit-date.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/edit-date/edit-date.directive.js @@ -42,8 +42,8 @@ function inplaceEditorDate($timeout, inplaceEditAll, TimezoneService, restrict: 'E', transclude: true, replace: true, - require: '^workPackageField', - templateUrl: '/components/inplace-edit/directives/field-edit/edit-date/' + + require: '^wpField', + templateUrl: '/components/inplace-edit/field-directives/edit-date/' + 'edit-date.directive.html', controller: angular.noop, diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-drop-down/edit-drop-down.directive.html b/frontend/app/components/inplace-edit/field-directives/edit-drop-down/edit-drop-down.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-drop-down/edit-drop-down.directive.html rename to frontend/app/components/inplace-edit/field-directives/edit-drop-down/edit-drop-down.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-drop-down/edit-drop-down.directive.js b/frontend/app/components/inplace-edit/field-directives/edit-drop-down/edit-drop-down.directive.js similarity index 97% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-drop-down/edit-drop-down.directive.js rename to frontend/app/components/inplace-edit/field-directives/edit-drop-down/edit-drop-down.directive.js index 4bb9138142..9eec9d0c6f 100644 --- a/frontend/app/components/inplace-edit/directives/field-edit/edit-drop-down/edit-drop-down.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/edit-drop-down/edit-drop-down.directive.js @@ -35,8 +35,8 @@ function inplaceEditorDropDown(EditableFieldsState, FocusHelper, inplaceEditAll) restrict: 'E', transclude: true, replace: true, - require: '^workPackageField', - templateUrl: '/components/inplace-edit/directives/field-edit/edit-drop-down/' + + require: '^wpField', + templateUrl: '/components/inplace-edit/field-directives/edit-drop-down/' + 'edit-drop-down.directive.html', controller: InplaceEditorDropDownController, diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-duration/edit-duration.directive.html b/frontend/app/components/inplace-edit/field-directives/edit-duration/edit-duration.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-duration/edit-duration.directive.html rename to frontend/app/components/inplace-edit/field-directives/edit-duration/edit-duration.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-duration/edit-duration.directive.js b/frontend/app/components/inplace-edit/field-directives/edit-duration/edit-duration.directive.js similarity index 96% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-duration/edit-duration.directive.js rename to frontend/app/components/inplace-edit/field-directives/edit-duration/edit-duration.directive.js index 9f9cd43c5f..500d8c7296 100644 --- a/frontend/app/components/inplace-edit/directives/field-edit/edit-duration/edit-duration.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/edit-duration/edit-duration.directive.js @@ -35,7 +35,7 @@ function inplaceEditorDuration() { restrict: 'E', transclude: true, replace: true, - templateUrl: '/components/inplace-edit/directives/field-edit/edit-duration/' + + templateUrl: '/components/inplace-edit/field-directives/edit-duration/' + 'edit-duration.directive.html', controllerAs: 'customEditorController', diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-type/edit-type.directive.html b/frontend/app/components/inplace-edit/field-directives/edit-type/edit-type.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-type/edit-type.directive.html rename to frontend/app/components/inplace-edit/field-directives/edit-type/edit-type.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-type/edit-type.directive.js b/frontend/app/components/inplace-edit/field-directives/edit-type/edit-type.directive.js similarity index 91% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-type/edit-type.directive.js rename to frontend/app/components/inplace-edit/field-directives/edit-type/edit-type.directive.js index ab946903f5..d901dcce07 100644 --- a/frontend/app/components/inplace-edit/directives/field-edit/edit-type/edit-type.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/edit-type/edit-type.directive.js @@ -35,9 +35,8 @@ function inplaceEditorType() { restrict: 'E', transclude: true, replace: true, - require: '^workPackageField', - templateUrl: '/components/inplace-edit/directives/field-edit/edit-type/' + - 'edit-type.directive.html', + require: '^wpField', + templateUrl: '/components/inplace-edit/field-directives/edit-type/edit-type.directive.html', link: function(scope) { scope.$watch('field.value.props', function(newValue, oldValue) { diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-wiki-textarea/edit-wiki-textarea.directive.html b/frontend/app/components/inplace-edit/field-directives/edit-wiki-textarea/edit-wiki-textarea.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-wiki-textarea/edit-wiki-textarea.directive.html rename to frontend/app/components/inplace-edit/field-directives/edit-wiki-textarea/edit-wiki-textarea.directive.html diff --git a/frontend/app/components/inplace-edit/directives/field-edit/edit-wiki-textarea/edit-wiki-textarea.directive.js b/frontend/app/components/inplace-edit/field-directives/edit-wiki-textarea/edit-wiki-textarea.directive.js similarity index 97% rename from frontend/app/components/inplace-edit/directives/field-edit/edit-wiki-textarea/edit-wiki-textarea.directive.js rename to frontend/app/components/inplace-edit/field-directives/edit-wiki-textarea/edit-wiki-textarea.directive.js index 8bb1e6a482..25239a4f1a 100644 --- a/frontend/app/components/inplace-edit/directives/field-edit/edit-wiki-textarea/edit-wiki-textarea.directive.js +++ b/frontend/app/components/inplace-edit/field-directives/edit-wiki-textarea/edit-wiki-textarea.directive.js @@ -35,7 +35,7 @@ function inplaceEditorWikiTextarea(AutoCompleteHelper, $timeout) { restrict: 'E', transclude: true, replace: true, - templateUrl: '/components/inplace-edit/directives/field-edit/edit-wiki-textarea/' + + templateUrl: '/components/inplace-edit/field-directives/edit-wiki-textarea/' + 'edit-wiki-textarea.directive.html', controller: InplaceEditorWikiTextareaController, diff --git a/frontend/app/templates/inplace-edit/display/fields/boolean.html b/frontend/app/components/inplace-edit/field-templates/display/boolean.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/boolean.html rename to frontend/app/components/inplace-edit/field-templates/display/boolean.html diff --git a/frontend/app/templates/inplace-edit/display/fields/date-range.html b/frontend/app/components/inplace-edit/field-templates/display/date-range.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/date-range.html rename to frontend/app/components/inplace-edit/field-templates/display/date-range.html diff --git a/frontend/app/templates/inplace-edit/display/fields/date.html b/frontend/app/components/inplace-edit/field-templates/display/date.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/date.html rename to frontend/app/components/inplace-edit/field-templates/display/date.html diff --git a/frontend/app/templates/inplace-edit/display/fields/dynamic.html b/frontend/app/components/inplace-edit/field-templates/display/dynamic.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/dynamic.html rename to frontend/app/components/inplace-edit/field-templates/display/dynamic.html diff --git a/frontend/app/templates/inplace-edit/display/fields/embedded.html b/frontend/app/components/inplace-edit/field-templates/display/embedded.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/embedded.html rename to frontend/app/components/inplace-edit/field-templates/display/embedded.html diff --git a/frontend/app/templates/inplace-edit/display/fields/spent-time.html b/frontend/app/components/inplace-edit/field-templates/display/spent-time.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/spent-time.html rename to frontend/app/components/inplace-edit/field-templates/display/spent-time.html diff --git a/frontend/app/templates/inplace-edit/display/fields/text.html b/frontend/app/components/inplace-edit/field-templates/display/text.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/text.html rename to frontend/app/components/inplace-edit/field-templates/display/text.html diff --git a/frontend/app/templates/inplace-edit/display/fields/user.html b/frontend/app/components/inplace-edit/field-templates/display/user.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/user.html rename to frontend/app/components/inplace-edit/field-templates/display/user.html diff --git a/frontend/app/templates/inplace-edit/display/fields/version.html b/frontend/app/components/inplace-edit/field-templates/display/version.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/version.html rename to frontend/app/components/inplace-edit/field-templates/display/version.html diff --git a/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html b/frontend/app/components/inplace-edit/field-templates/display/wiki-textarea.html similarity index 100% rename from frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html rename to frontend/app/components/inplace-edit/field-templates/display/wiki-textarea.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/boolean.html b/frontend/app/components/inplace-edit/field-templates/edit/boolean.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/boolean.html rename to frontend/app/components/inplace-edit/field-templates/edit/boolean.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/date-range.html b/frontend/app/components/inplace-edit/field-templates/edit/date-range.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/date-range.html rename to frontend/app/components/inplace-edit/field-templates/edit/date-range.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/date.html b/frontend/app/components/inplace-edit/field-templates/edit/date.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/date.html rename to frontend/app/components/inplace-edit/field-templates/edit/date.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/drop-down.html b/frontend/app/components/inplace-edit/field-templates/edit/drop-down.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/drop-down.html rename to frontend/app/components/inplace-edit/field-templates/edit/drop-down.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/duration.html b/frontend/app/components/inplace-edit/field-templates/edit/duration.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/duration.html rename to frontend/app/components/inplace-edit/field-templates/edit/duration.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/float.html b/frontend/app/components/inplace-edit/field-templates/edit/float.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/float.html rename to frontend/app/components/inplace-edit/field-templates/edit/float.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/integer.html b/frontend/app/components/inplace-edit/field-templates/edit/integer.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/integer.html rename to frontend/app/components/inplace-edit/field-templates/edit/integer.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/text.html b/frontend/app/components/inplace-edit/field-templates/edit/text.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/text.html rename to frontend/app/components/inplace-edit/field-templates/edit/text.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/textarea.html b/frontend/app/components/inplace-edit/field-templates/edit/textarea.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/textarea.html rename to frontend/app/components/inplace-edit/field-templates/edit/textarea.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/type.html b/frontend/app/components/inplace-edit/field-templates/edit/type.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/type.html rename to frontend/app/components/inplace-edit/field-templates/edit/type.html diff --git a/frontend/app/templates/inplace-edit/edit/fields/wiki-textarea.html b/frontend/app/components/inplace-edit/field-templates/edit/wiki-textarea.html similarity index 100% rename from frontend/app/templates/inplace-edit/edit/fields/wiki-textarea.html rename to frontend/app/components/inplace-edit/field-templates/edit/wiki-textarea.html diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-all.service.js b/frontend/app/components/inplace-edit/inplace-edit-all/inplace-edit-all.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-all.service.js rename to frontend/app/components/inplace-edit/inplace-edit-all/inplace-edit-all.service.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-all.service.test.js b/frontend/app/components/inplace-edit/inplace-edit-all/inplace-edit-all.service.test.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-all.service.test.js rename to frontend/app/components/inplace-edit/inplace-edit-all/inplace-edit-all.service.test.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-errors.service.js b/frontend/app/components/inplace-edit/inplace-edit-errors/inplace-edit-errors.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-errors.service.js rename to frontend/app/components/inplace-edit/inplace-edit-errors/inplace-edit-errors.service.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-form.service.js b/frontend/app/components/inplace-edit/inplace-edit-form/inplace-edit-form.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-form.service.js rename to frontend/app/components/inplace-edit/inplace-edit-form/inplace-edit-form.service.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-form.service.test.js b/frontend/app/components/inplace-edit/inplace-edit-form/inplace-edit-form.service.test.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-form.service.test.js rename to frontend/app/components/inplace-edit/inplace-edit-form/inplace-edit-form.service.test.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-multi-storage.service.js b/frontend/app/components/inplace-edit/inplace-edit-multi-storage/inplace-edit-multi-storage.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-multi-storage.service.js rename to frontend/app/components/inplace-edit/inplace-edit-multi-storage/inplace-edit-multi-storage.service.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit-storage.service.js b/frontend/app/components/inplace-edit/inplace-edit-storage/inplace-edit-storage.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit-storage.service.js rename to frontend/app/components/inplace-edit/inplace-edit-storage/inplace-edit-storage.service.js diff --git a/frontend/app/components/inplace-edit/services/inplace-edit.service.js b/frontend/app/components/inplace-edit/inplace-edit.service.js similarity index 100% rename from frontend/app/components/inplace-edit/services/inplace-edit.service.js rename to frontend/app/components/inplace-edit/inplace-edit.service.js diff --git a/frontend/app/components/inplace-edit/directives/main-pane/main-pane.directive.html b/frontend/app/components/inplace-edit/main-pane/main-pane.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/main-pane/main-pane.directive.html rename to frontend/app/components/inplace-edit/main-pane/main-pane.directive.html diff --git a/frontend/app/components/inplace-edit/directives/main-pane/main-pane.directive.js b/frontend/app/components/inplace-edit/main-pane/main-pane.directive.ts similarity index 94% rename from frontend/app/components/inplace-edit/directives/main-pane/main-pane.directive.js rename to frontend/app/components/inplace-edit/main-pane/main-pane.directive.ts index fe562ae973..7f64c34a90 100644 --- a/frontend/app/components/inplace-edit/directives/main-pane/main-pane.directive.js +++ b/frontend/app/components/inplace-edit/main-pane/main-pane.directive.ts @@ -26,14 +26,14 @@ // See doc/COPYRIGHT.rdoc for more details. // ++ -angular - .module('openproject.inplace-edit') - .directive('inplaceEditorMainPane', inplaceEditorMainPane); - function inplaceEditorMainPane() { return { transclude: true, replace: true, - templateUrl: '/components/inplace-edit/directives/main-pane/main-pane.directive.html' + templateUrl: '/components/inplace-edit/main-pane/main-pane.directive.html' }; } + +angular + .module('openproject.inplace-edit') + .directive('inplaceEditorMainPane', inplaceEditorMainPane); diff --git a/frontend/app/components/inplace-edit/directives/work-package-field/work-package-field.directive.html b/frontend/app/components/inplace-edit/wp-field/wp-field.directive.html similarity index 100% rename from frontend/app/components/inplace-edit/directives/work-package-field/work-package-field.directive.html rename to frontend/app/components/inplace-edit/wp-field/wp-field.directive.html diff --git a/frontend/app/components/inplace-edit/directives/work-package-field/work-package-field.directive.js b/frontend/app/components/inplace-edit/wp-field/wp-field.directive.ts similarity index 66% rename from frontend/app/components/inplace-edit/directives/work-package-field/work-package-field.directive.js rename to frontend/app/components/inplace-edit/wp-field/wp-field.directive.ts index 4c4d82665c..6d50eb99c2 100644 --- a/frontend/app/components/inplace-edit/directives/work-package-field/work-package-field.directive.js +++ b/frontend/app/components/inplace-edit/wp-field/wp-field.directive.ts @@ -26,16 +26,32 @@ // See doc/COPYRIGHT.rdoc for more details. //++ -angular - .module('openproject.inplace-edit') - .directive('workPackageField', workPackageField); +class WorkPackageFieldController { + public fieldName:string; + public state; + public isEditing; + public editTitle:string; + + constructor($scope, EditableFieldsState, inplaceEditForm, inplaceEditAll, I18n) { + var workPackage = EditableFieldsState.workPackage; + this.state = EditableFieldsState; + $scope.field = inplaceEditForm.getForm(workPackage.props.id, workPackage).field(this.fieldName); + + var field = $scope.field; + + if (field.isEditable()) { + this.state.isBusy = false; + this.isEditing = inplaceEditAll.state; + this.editTitle = I18n.t('js.inplace.button_edit', {attribute: field.getLabel()}); + } + } +} function workPackageField() { return { restrict: 'E', replace: true, - templateUrl: '/components/inplace-edit/directives/work-package-field/' + - 'work-package-field.directive.html', + templateUrl: '/components/inplace-edit/wp-field/wp-field.directive.html', scope: { fieldName: '=' }, @@ -46,17 +62,7 @@ function workPackageField() { }; } -function WorkPackageFieldController($scope, EditableFieldsState, inplaceEditForm, inplaceEditAll) { - var workPackage = EditableFieldsState.workPackage; - this.state = EditableFieldsState; - $scope.field = inplaceEditForm.getForm(workPackage.props.id, workPackage).field(this.fieldName); - - var field = $scope.field; - - if (field.isEditable()) { - this.state.isBusy = false; - this.isEditing = inplaceEditAll.state; - this.editTitle = I18n.t('js.inplace.button_edit', { attribute: field.getLabel() }); - } -} +angular + .module('openproject.inplace-edit') + .directive('wpField', workPackageField); diff --git a/frontend/app/components/inplace-edit/services/work-package-field.service.js b/frontend/app/components/inplace-edit/wp-field/wp-field.service.js similarity index 99% rename from frontend/app/components/inplace-edit/services/work-package-field.service.js rename to frontend/app/components/inplace-edit/wp-field/wp-field.service.js index 482c48ab68..a7e0b48486 100644 --- a/frontend/app/components/inplace-edit/services/work-package-field.service.js +++ b/frontend/app/components/inplace-edit/wp-field/wp-field.service.js @@ -1,4 +1,4 @@ -//-- copyright +// -- copyright // OpenProject is a project management system. // Copyright (C) 2012-2015 the OpenProject Foundation (OPF) // @@ -24,7 +24,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // See doc/COPYRIGHT.rdoc for more details. -//++ +// ++ angular .module('openproject.services') diff --git a/frontend/app/components/routing/wp-details/wp.list.details.html b/frontend/app/components/routing/wp-details/wp.list.details.html index 07cee8a837..3094d7d092 100644 --- a/frontend/app/components/routing/wp-details/wp.list.details.html +++ b/frontend/app/components/routing/wp-details/wp.list.details.html @@ -27,7 +27,7 @@