Any thoughts on how to achieve placing local menu tasks into a jump menu?

Comments

doublejosh’s picture

Hmm, the effect could be pretty nice; like getting node tabs into an edit drop down. Hot!

I know that admin menu (at least in D6) has a setting to move local tasks to the admin menu. Not sure if that temporarily placed those items in the menu or just make it appear so. Mind investigating?

pixelsweatshop’s picture

I have been looking into this for a while now. Node tabs can get out of hand, especially when doing responsive design. Jump menus work very nicely to clean this up.

Investigated this further. Admin menu does still have this setting, however, once enabled, it doesn't add it to the menu. Just makes it appear so.

doublejosh’s picture

Assuming then it just places the tabs styled the same way at the end of the menu. Bummer.

Questions now become what's the desired effect (that still maintains some flexibility for other uses), what kind of admin choices should be there and how this should be done. Could have an option to place ALL local menu items in a jump menu block. Perhaps a content type setting, if that's the goal.

Implementation...
Will need to add to the hook_block to create one to house local menu tasks.
Then remove them from the normal location.
Not sure how to pull in all the tasks within the block display code.

Some resources...
menu_primary_local_tasks() menu_secondary_local_tasks() http://drupal.org/node/199067
hook_menu_alter() http://drupal.org/node/483324

pixelsweatshop’s picture

We can look to see how it was achieved in http://drupal.org/project/dropdown_tabs

doublejosh’s picture

Awesome find!!!

I'll just reach out to them and see if I can borrow their functionality and integrate it here.

doublejosh’s picture

Status: Active » Needs work
doublejosh’s picture

Version: 7.x-1.3 » 7.x-1.2

They didn't get back so I'll go for it.

Planning to create a block that will display whatever local menu tabs are present within a select drop down and remove the current tabs.
Actually, it's more like I'm hoping that's possible from the code I'm going to borrow plus a little more effort.

doublejosh’s picture

Version: 7.x-1.2 » 7.x-1.3
pixelsweatshop’s picture

Sounds great. However the thought of automatically removing the current tabs, once the block is enabled, might be making the assumption that one wants to replace them. For example, in a responsive design, one might want to keep the regular tab UI for a wide layout, but only display a jump menu when in a mobile layout. I think just providing a block (just like this module does with any other menu group- e.g. main menu) is sufficient. Thoughts?

doublejosh’s picture

Version: 7.x-1.2 » 7.x-1.3

Right. Reduce assumptions. Guess that's why I posting here about what I should do. Any other thoughts before coding? Similar uses?

doublejosh’s picture

Status: Needs work » Fixed

Committed: be6c54fb98819c55f69a7b18764f3cc27aa7d4b9

The code from dropdown_tabs was pretty much useless, 112 lines rather than 23.

Please test (not released).
A useful screenshot for the project page might be nice.

pixelsweatshop’s picture

Status: Fixed » Reviewed & tested by the community

It works like a charm. Well done!

I opened up a few other issues for review after reviewing. Sorry about posting them separately, but it's probably better to deal with them individually. Feel free to close them as 'won't fix' as they are just minor and really this module is great the way it is currently.

#1504514: Utilize block title instead of --Select desitation--
#1504520: Retain previous choice as "selected" menu item
#1504524: Update .info file to reflect new name
#1504528: Hide blocks when permissions causes empty list

doublejosh’s picture

Totally fine. Thanks for partitioning the concerns.

There may still be an issue about secondary local tasks. Do you have time to test that and think about use cases?

pixelsweatshop’s picture

Absolutely. I would love to see this module mature. I have already implemented this module in several sites and plan on adding to all of my projects. Jump menus are a perfect and simple solution to the responsive design dilemma about large navigation in smaller screen sizes.

There may still be an issue about secondary local tasks.

What issues do you foresee?

pixelsweatshop’s picture

Just discovered an issue with local menu tasks. There isn't support for secondary level tabs, only primary.

To test this, just install a module like simplenews. This will automatically add a secondary level to your user account (See it by clicking on edit on your account). This will affect modules like profile2, messaging/notifications framework, commerce etc. Might need some code to display child items much like other menus.

doublejosh’s picture

You've brought up exactly why I was getting at :)
Was looking to hear your suggestion so I could have another voice before coding anything.

doublejosh’s picture

Remove blocks when permission reduces list to zero. #1504528: Hide blocks when permissions causes empty list

pixelsweatshop’s picture

If it is possible to just list the menu items like the other menus (i.e. parent-child) then I think that would make more sense than having a separate jump menu for each.

As a sidenote, I find it very interesting discovering the numerous pitfalls in implementing something that seems so trivial on the surface, as adding jump menus to local tasks :)

doublejosh’s picture

That was my thought was to try and fetch all the lineage.
But I thought since secondary menus are normally so small, one might want to keep them as a normal menu after entering the specific task area.
No?

doublejosh’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)
doublejosh’s picture

Priority: Normal » Major
doublejosh’s picture

Yeah, those items are not present unless you're actually within the appropriate primary tab (tested using webform for webform nodes).

doublejosh’s picture

Posted on Drupal Stack Exchange looking for extra help to gather these items.

doublejosh’s picture

Status: Needs work » Postponed

Added in secondary menus at least when you're in the context and they are available.
67d3cbd2766a276c444ac4118c500464582395e6

doublejosh’s picture

Status: Postponed (maintainer needs more info) » Needs work
doublejosh’s picture

Status: Postponed » Needs work

@nicoz, worth a release with just in-context secondary local tasks?

pixelsweatshop’s picture

I think so. :)

(Great work BTW)

doublejosh’s picture

Willing to test the update?
(not on production)

pixelsweatshop’s picture

Status: Needs work » Reviewed & tested by the community

Just tested. Works well.

doublejosh’s picture

Status: Reviewed & tested by the community » Closed (fixed)