Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

[WIP] Improve TreeBrowserBundle experience #340

Closed
wants to merge 3 commits into from

Conversation

wouterj
Copy link
Contributor

@wouterj wouterj commented May 10, 2015

This is probably one of the last big PRs regarding the TreeBrowserbundle 2.0. It changes the way the tree is used to something that's familair to all computer users.

When opening the form, the tree view is hidden and only the input box is shown:
cmf-tree-minimal

When the admin want to select a node, they can do 2 things:

  • Type into the input field. The TreeBrowserBundle provides auto completion for the admin:
    cmf-tree-autocompletion
  • Click the "select" button. This opens a tooltip with the tree:
    cmf-tree-tooltip

Both the tree view and the input field are keep in sync: Changing the input value changes the selected node in the tree and selecting a node in the tree changes the input value.

I'm not sure yet if it's very obvious what to do here for the admin, but I believe it is a step in the good direction as it'll hide those very long trees on a page.

This PR doesn't change admin for the manager (or admin) trees.

Fixes symfony-cmf/tree-browser-bundle#76

@wouterj wouterj changed the title Improve TreeBrowserBundle experience [WIP] Improve TreeBrowserBundle experience May 10, 2015

<div class="form-inline">
<input class="form-control" name="{{ full_name }}" id="{{ id }}-tree-selector-output" value="{{ value ?: (select_root_node ? root_node : '') }}">
<span class="btn btn-default btn-mini" data-toggle="dropdown">Select</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

"Select" should be a translation. i suggest we could label this "Pick" instead wdyt?

@dbu
Copy link
Contributor

dbu commented May 11, 2015

this is really cool! great work again @wouterj , thanks a lot!

in what regard is this PR still WIP? or could we merge it already?

one thing i wonder is whether we should (in addition?) show the string representation of the selected tree node in addition to the path. we might also do that in the tree, show the nodename very small and the title bigger. but this would mean that the ResourceBundle would expose a technical id as well as the human id... anyways, we should not block this PR by that idea.

@wouterj
Copy link
Contributor Author

wouterj commented May 11, 2015

in what regard is this PR still WIP? or could we merge it already?

I need to do some more testing, it's not bug free at the moment.

one thing i wonder is whether we should (in addition?) show the string representation of the selected tree node in addition to the path. we might also do that in the tree, show the nodename very small and the title bigger.

As for the tree, it already shows the string representation (by default, using PathUtil::getNodeName() and using Admin#toString() when the sonata_admin enhancer is enabled).
For the input field, it only shows the path and not the string representation. I think we should not change this. (it's also the behaviour on Windows)

@aitboudad
Copy link

👍 , is there a way to only allow sub-tree of content only for example showing the whole tree when edition content doesn't make sense IMO.

@wouterj
Copy link
Contributor Author

wouterj commented May 11, 2015

Yes, there is a root_node option for the cmfTree plugin that allows you to specify the root node.

@hason
Copy link
Contributor

hason commented Sep 10, 2015

👍 Awesome!

@dbu
Copy link
Contributor

dbu commented Sep 18, 2015

does the new browser also allow to say whether the root node should be selectable or not? lets say i want to select a route. i currently need to specify /cms so that /cms/routes (the root route) is selectable. i would want to specify /cms/routes and have an option to control whether the root is selectable or not.

}

jQuery.ajax({
url: '{{ path('_cmf_resource', {
Copy link
Contributor

Choose a reason for hiding this comment

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

_cmf_resource -> _cmf_get_resource

Copy link
Member

Choose a reason for hiding this comment

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

ping @wouterj

@wouterj
Copy link
Contributor Author

wouterj commented Aug 13, 2016

Closing as the form type is moved to the TreeBrowserBundle: symfony-cmf/tree-browser-bundle#116

@wouterj wouterj closed this Aug 13, 2016
@wouterj wouterj deleted the autocompletion branch August 13, 2016 12:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants