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

Use 'editable' theme node property as configuration #1640

Merged
merged 2 commits into from
Aug 3, 2016

Conversation

adube
Copy link
Contributor

@adube adube commented Jul 28, 2016

This PR uses the editable theme node property as configuration for the gmf-editfeatureselector directive to determine which layers are editable. Adjust the other examples as well.

In order to see it in action, we need the layer tree. This requires #1636 to be merged first.

Todo

Live example

@adube adube changed the title WIP - Use 'editable' theme node property as configuration Use 'editable' theme node property as configuration Jul 29, 2016
@adube
Copy link
Contributor Author

adube commented Jul 29, 2016

Rebased onto master, live demo updated and ready for review.

@adube
Copy link
Contributor Author

adube commented Aug 1, 2016

@pgiraud: This is ready for review.

@adube adube force-pushed the gmf-editfeature-editable branch 2 times, most recently from 03bc176 to d6d6fc0 Compare August 1, 2016 17:19
* @return {Array.<number|string>} Layer names.
*/
gmf.LayertreeController.getLayerNodeIds = function(node) {
gmf.LayertreeController.getLayerNodeIds = function(node, opt_editable) {
var editable = opt_editable === true;
var ids = [];
var children = node.children || node;
if (children && children.length) {
children.forEach(function(childNode) {
ids = ids.concat(gmf.LayertreeController.getLayerNodeIds(childNode));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you want to use opt_editable for the children as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Isn't that already the case ? If a child node has no children, then we go in else if below and they are managed, right ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When opt_editable is true, you want to get the ids of the node which are editable and only them. Calling getLayerNodeIds for each child of the current node without the "editable" argument will retrieve the ids of the children even if they're not editable.
I may be wrong but you'll get the editable nodes for the first level but all the nodes for level greater than 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right. I get it now. I'll fix this right away.

@adube
Copy link
Contributor Author

adube commented Aug 2, 2016

Fixed, rebased onto master, live example updated and ready for merge.

@pgiraud pgiraud merged commit 9680b62 into camptocamp:master Aug 3, 2016
@adube adube deleted the gmf-editfeature-editable branch August 3, 2016 12:02
@sbrunner sbrunner added this to the Older milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants