Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a new configuration option called closeaftersave in the editFeatu… #4810

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion contribs/gmf/src/editing/editFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ exports.run(/* @ngInject */ ($templateCache) => {
* gmf-editfeature-state="efsCtrl.state"
* gmf-editfeature-tolerance="::ctrl.tolerance"
* gmf-editfeature-vector="::ctrl.vectorLayer">
* gmf-editfeature-closeaftersave="::ctrl.closeaftersave">
* </gmf-editfeature>
*
* @htmlAttribute {boolean} gmf-editfeature-dirty Flag that is toggled as soon
Expand All @@ -115,6 +116,8 @@ exports.run(/* @ngInject */ ($templateCache) => {
* buffer in pixels to use when making queries to get the features.
* @htmlAttribute {ol.layer.Vector} gmf-editfeature-vector The vector layer in
* which to draw the vector features.
* @htmlAttribute {boolean} gmf-editfeatureselector-closeaftersave If true,
* immediately return to the main edit panel after save. Default is false.
* @return {angular.Directive} The directive specs.
* @ngdoc directive
* @ngname gmfEditfeature
Expand All @@ -128,7 +131,8 @@ exports.component_ = function() {
'map': '<gmfEditfeatureMap',
'state': '=gmfEditfeatureState',
'tolerance': '<?gmfEditfeatureTolerance',
'vectorLayer': '<gmfEditfeatureVector'
'vectorLayer': '<gmfEditfeatureVector',
'closeAfterSave': '=?gmfEditfeatureCloseaftersave'
},
bindToController: true,
templateUrl: 'gmf/editing/editFeatureComponent'
Expand Down Expand Up @@ -207,6 +211,11 @@ exports.Controller_ = function($element, $q, $scope, $timeout,
*/
this.vectorLayer;

/**
* @type {boolean}
* @export
*/
this.closeAfterSave = false;

// === Injected properties ===

Expand Down Expand Up @@ -654,6 +663,9 @@ exports.Controller_.prototype.save = function() {
this.pending = false;
this.handleEditFeature_(response);
this.gmfSnapping_.refresh();
if (this.closeAfterSave) {
this.cancel();
}
},
(response) => {
this.showServerError = true;
Expand Down
3 changes: 2 additions & 1 deletion contribs/gmf/src/editing/editFeatureSelectorComponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
gmf-editfeature-map="::efsCtrl.map"
gmf-editfeature-state="efsCtrl.state"
gmf-editfeature-tolerance="::efsCtrl.tolerance"
gmf-editfeature-vector="::efsCtrl.vectorLayer">
gmf-editfeature-vector="::efsCtrl.vectorLayer"
gmf-editfeature-closeaftersave="::efsCtrl.closeAfterSave">
</gmf-editfeature>

</div>
Expand Down
14 changes: 12 additions & 2 deletions contribs/gmf/src/editing/editFeatureSelectorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ exports.run(/* @ngInject */ ($templateCache) => {
* gmf-editfeatureselector-active="ctrl.editFeatureSelectorActive"
* gmf-editfeatureselector-map="::ctrl.map"
* gmf-editfeatureselector-tolerance="::ctrl.tolerance"
* gmf-editfeatureselector-vector="::ctrl.vectorLayer">
* gmf-editfeatureselector-vector="::ctrl.vectorLayer"
* gmf-editfeatureselector-tree="ctrl.selectedEditableTreeCtrl"
* gmf-editfeatureselector-closeaftersave="::true">
* </gmf-editfeatureselector>
*
* @htmlAttribute {boolean} gmf-editfeatureselector-active Whether the
Expand All @@ -48,6 +50,8 @@ exports.run(/* @ngInject */ ($templateCache) => {
* layer where the selected or created features are drawn.
* @htmlAttribute {ngeo.layertree.Controller} gmf-editfeatureselector-tree The
* layertree controller handling the selectable editable layers list.
* @htmlAttribute {boolean} gmf-editfeatureselector-closeaftersave If true,
* immediately return to the main edit panel after save. Default is false.
* @return {angular.Directive} The directive specs.
* @ngdoc directive
* @ngname gmfEditfeatureselector
Expand All @@ -60,7 +64,8 @@ exports.component_ = function() {
'map': '<gmfEditfeatureselectorMap',
'tolerance': '<?gmfEditfeatureselectorTolerance',
'vectorLayer': '<gmfEditfeatureselectorVector',
'selectedEditableTreeCtrl': '=?gmfEditfeatureselectorTree'
'selectedEditableTreeCtrl': '=?gmfEditfeatureselectorTree',
'closeAfterSave': '=?gmfEditfeatureselectorCloseaftersave'
},
bindToController: true,
templateUrl: 'gmf/editing/editFeatureSelectorComponent'
Expand Down Expand Up @@ -115,6 +120,11 @@ exports.Controller_ = function($scope, $timeout, gmfThemes, gmfTreeManager) {
*/
this.vectorLayer;

/**
* @type {boolean}
* @export
*/
this.closeAfterSave;

// === Injected services ===

Expand Down