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

Initial KnpMenuBundle integration #99

Merged
merged 3 commits into from Jul 30, 2014
Merged

Initial KnpMenuBundle integration #99

merged 3 commits into from Jul 30, 2014

Conversation

bdunogier
Copy link
Member

Story: EZP-22601
Status: merged

Integrates a totally non-configurable two level navigation menu, similar to that of ezdemo, to the DemoBundle. Clearly needs to be rewritten, but it has the basics.

knpmenu1 pnhg

TODO

  • Before merging, remove the commit that changes the branch in .travis.yml

$menu = $this->factory->createItem( 'root' );
$this->addLocationsToMenu(
$menu,
$this->getSearchResults(
Copy link
Contributor

Choose a reason for hiding this comment

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

getSearchResults? well, we're searching but as this is a menu i was thinking in something like getItems instead. nothing important anyway.

@crevillo
Copy link
Contributor

About the whole approach, i would vote for going to a tree menú instead of two differents menús for the first and second level. To get a result like

<ul>
    <li>Item 1
          <ul>
                   <li>subitem 1.1<li>
                    <li>subitem 1.2</li>
          </ul>
     </li>
    <li>item 2</li>
</ul>

More semantic imho and will let the user more possibilites about playing will rollovers and things like that.
Could also be an starting point for building three levels or more menus.

Thoughs on this?

@crevillo
Copy link
Contributor

Bonus track

As said in 1 on 1 with @bdunogier and surely in a future step, i think the selection of this bundle for building menus could benefit the new backend interface.

The idea could be have a visual meu builder. Yeah, you may say this is a wordpress or drupal thing, but they're good things imho.

From that builder a user could chosee nodes from the trees, adding urls to custom modules/controler or even set external links.

This way, devs and editor shouldn't be worried about adding new folders as root child and developments could avoid adding those "show in menu" fields...

Just an idea, but i think knpmenu bundle really give us a more solid base for this than legacy code :)

ping @dpobel @bdunogier

<li id="nav-location-{{ location.id }}"><a href="{{ path( location ) }}">{{ ez_content_name( location.contentInfo ) }}</a></li>
{% endfor %}
</ul>
{{ knp_menu_render(menu, {'depth': 1, 'firstClass': 'firstli', 'lastClass': 'lastli', 'branchClass': 'nav'}) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it needs to be "branch_class" instead of branchClass. in fact that's what we got for the submenu

@rolandbenedetti
Copy link

I agree with @crevillo on the fact that it is better as a tree. It is, from the end user standpoint a hierarchy.
A first step is indeed to have this minimum configuration of the menu in the demo bundle thanks to KnpMenuBundle. Then for the bonus track from @crevillo, I am totally for it, +1, but from an eZ standpoint, I don't think I would prioritize right now. Carlos, if you want to explore, feel free! And I would be happy to chat!

@crevillo
Copy link
Contributor

yep. it was a suggestion. just an idea. still we need more work in the KnpMenuBundle integration and in the admin interface before working on that i think.
Cheers.

@rolandbenedetti
Copy link

agreed :-) unsure if this should be in the pure admin part or in the editorial part I must say. I lean for more the Admin role.

@bdunogier
Copy link
Member Author

I'd lean towards admin as well.

@bdunogier
Copy link
Member Author

Well, yes, it'd maybe be better as tree. On the other hand, we need to design it first, then :-)

The one that is implemented by this PR is the double_top one that was originally there. Can we go with this version first, and then, even if it is in a few days, move to tree with a new PR ?

@crevillo
Copy link
Contributor

Yep, no problem on my side. What you mean for "design" though? Can't we Just show the tree as the Two levels are shown now?

@crevillo
Copy link
Contributor

Anyway, this is a valid starting point for the Knpmenu integration imho, so i think it could be merged. The tree thing can be added after. Doing it here would probably add too much noise.
+1

- export TRAVIS_BUILD_DIR="$HOME/build/ezpublish-community"
- cd "$HOME/build"
- git clone --depth 1 https://github.com/ezsystems/ezpublish-community.git
- sh $PULL_REQUEST_TRAVIS_BUILD_DIR/bin/travis/clone_ezpublish-community.sh $PR_BRANCH
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we just have the following here:

# Change branch name ("master") or repository if you need something else to test your PR:
- git clone --depth 1 --single-branch --branch master https://github.com/ezsystems/ezpublish-community.git
- cd ezpublish-community
# If you just need to pull in a different version of one of the dependecies
#- composer require --no-update ezsystems/ezpublish-kernel:dev-my_branch_name

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good, I'll integrate that. Should go with a documentation page.

@andrerom
Copy link
Contributor

+1 with simplifications to the travis / composer changes.

before_install:
- export OLD_TRAVIS_BUILD_DIR="$TRAVIS_BUILD_DIR"
- echo $TRAVIS_BUILD_DIR
- export PR_TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR
Copy link
Contributor

Choose a reason for hiding this comment

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

whats wrong with OLD_TRAVIS_BUILD_DIR? this is executed on branches as well, not just PR's ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

What was wrong was "old". It's the evil brother of "bak" and "manager". I'll change it to BRANCH_BUILD_DIR then :-)

@bdunogier
Copy link
Member Author

Rebased and cleaned up, should be ready for merge. Are you fine with the .travis.yml changes, @andrerom ?

before_script:
- ./bin/.travis/prepare_ezpublish.sh
- rm -fR vendor/ezsystems/demobundle/EzSystems/DemoBundle
- mv "$OLD_TRAVIS_BUILD_DIR" vendor/ezsystems/demobundle/EzSystems

Copy link
Contributor

Choose a reason for hiding this comment

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

This new line looks strange on a list of before_script commands, same above. or?

Copy link
Member Author

Choose a reason for hiding this comment

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

Gotta say I didn't wanna touch those too much...

Copy link
Member Author

Choose a reason for hiding this comment

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

The fact is though that this needs to go after ./bin/.travis/prepare_ezpublish.sh, since it is what runs composer install.

Maybe this line, and therefore the rm & mv one as well, could go to before_install, but I didn't try yet.

Bertrand Dunogier added 3 commits July 28, 2014 16:16
Visible locations below the root one with a content class listed in
legacy's menu.ini[MenuContentSettings.TopIdentifierList] are returned.
The ezpublish-community branch can now easily be changed in the git clone command line.
bdunogier added a commit that referenced this pull request Jul 30, 2014
Initial KnpMenuBundle integration
@bdunogier bdunogier merged commit 3450092 into master Jul 30, 2014
@bdunogier bdunogier deleted the EZP-22601-KnpMenu branch July 30, 2014 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants