Implement work package editing in fullscreen view

pull/3646/head
Alex Dik 9 years ago
parent a976579da3
commit c662325ba8
  1. 9
      frontend/app/work_packages/controllers/work-package-show-controller.js
  2. 2
      frontend/app/work_packages/directives/inplace_editor/custom/editable/inplace-editor-date-directive.js
  3. 2
      frontend/app/work_packages/directives/inplace_editor/custom/editable/inplace-editor-date-range-directive.js
  4. 2
      frontend/app/work_packages/directives/inplace_editor/custom/editable/inplace-editor-dropdown-directive.js
  5. 4
      frontend/app/work_packages/directives/inplace_editor/inplace-editor-display-pane-directive.js
  6. 19
      frontend/app/work_packages/directives/inplace_editor/inplace-editor-edit-pane-directive.js
  7. 15
      frontend/app/work_packages/services/editable-fields-state.js

@ -390,14 +390,7 @@ module.exports = function($scope,
);
$scope.editWorkPackage = function() {
// TODO: Copied from work-package-details-toolbar-directive
// since reusing the directive would break the existing toolbar
// markup.
var editWorkPackagePath = PathHelper.staticEditWorkPackagePath($scope.workPackage.props.id);
var backUrl = '?back_url=' + encodeURIComponent($location.url());
// TODO: Temporarily going to the old edit dialog until we get in-place editing done
window.location = editWorkPackagePath + backUrl;
EditableFieldsState.editAll.toggleState();
};
// Stuff copied from DetailsTabOverviewController

@ -80,7 +80,7 @@ module.exports = function(WorkPackageFieldService, EditableFieldsState,
};
$timeout(function() {
datepicker.focus();
EditableFieldsState.editAll.state || datepicker.focus();
});
angular.element('.work-packages--details-content').on('click', function(e) {

@ -107,7 +107,7 @@ module.exports = function(TimezoneService, ConfigurationService,
};
$timeout(function() {
startDatepicker.focus();
EditableFieldsState.editAll.state || startDatepicker.focus();
});
startDatepicker.textbox.on('click focusin', function() {

@ -86,7 +86,7 @@ module.exports = function(
fieldController.state.isBusy = false;
if (!EditableFieldsState.forcedEditState) {
FocusHelper.focusUiSelect(element);
EditableFieldsState.editAll.state || FocusHelper.focusUiSelect(element);
}
});
}

@ -107,7 +107,7 @@ module.exports = function(
}, true);
scope.$watch('fieldController.isEditing', function(isEditing, oldIsEditing) {
if (!isEditing) {
if (!isEditing && !fieldController.lockFocus) {
$timeout(function() {
if (oldIsEditing) {
// check old value to not trigger focus on the first time
@ -118,6 +118,8 @@ module.exports = function(
});
});
}
fieldController.lockFocus = false;
});
}
};

@ -192,6 +192,16 @@ module.exports = function(
};
showErrors();
}
$scope.$watch('editableFieldsState.editAll.state', function(state) {
var field = $scope.fieldController.field;
$scope.fieldController.isEditing = state;
$scope.fieldController.lockFocus = true;
if (EditableFieldsState.editAll.isFocusField(field)) {
vm.markActive();
}
});
},
link: function(scope, element, attrs, fieldController) {
scope.fieldController = fieldController;
@ -263,8 +273,15 @@ module.exports = function(
});
scope.$watch('fieldController.isEditing', function(isEditing) {
if (isEditing && !EditableFieldsState.forcedEditState) {
var efs = EditableFieldsState, field = fieldController.field;
if (isEditing && !efs.editAll.state && !efs.forcedEditState) {
scope.focusInput();
} else if (efs.editAll.state && efs.editAll.isFocusField(field)) {
$timeout(function () {
element.find('.focus-input').focus()[0].select();
});
}
});
}

@ -33,6 +33,19 @@ module.exports = function() {
isBusy: false,
currentField: null,
submissionPromises: {},
forcedEditState: false
forcedEditState: false,
editAll: {
focusField: 'subject',
state: false,
toggleState: function () {
return this.state = !this.state;
},
isFocusField: function (field) {
return this.focusField === field;
}
}
};
};

Loading…
Cancel
Save