Search Menu is a very lightweight module which provides functionality to search for menu items very quickly.
Most of times, it becomes very difficult to find specific menu item if you have lots of modules installed on your system. This module helps you to quickly search for menu items and jump to them.
This works in two ways,
1) You can use keyboard shortcut (ctrl+m) to open a Search Menu form window and then you can search for a menu item and jump to it. This is the most convenient way to use this module to search and jump to specific menu item.
2) Alternatively, you can also enable the block "Search Menu form" and place it as required. This block provides a Form to search for menu item and jump to it.
I have also setup permissions to access this functionality using keyboard shortcut. So by default this will work for admin users and permissions can be set to give access to other roles/users.
Related modules,
navigate - I believe there is only one module, navigate, which provides menu search. But it's quite heavy module because it contains 5 modules and provides lot of other features. Whereas Search Menu is very simple and lightweight module and can be accessed using keyboard shortcut.
Project Page - http://drupal.org/sandbox/suhani.jain/1773372
Git Repository - git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/suhani.jain/1773372.git search_menu
Drupal Version - Drupal 7
Note
I have tested my module using http://ventral.org/pareview and here are the results - http://ventral.org/pareview/httpgitdrupalorgsandboxsuhanijain1773372git. Please note that all the errors are related to shortcut.js which is third party javascript library and downloaded from http://www.openjs.com/scripts/events/keyboard_shortcuts/. So please ignore shortcut.js related coding standard issues.
Comments
Comment #1
fabioknoedt commentedHi,
I have tested your module and I found minor issues. Feel free to accept or not:
1. the textfield in the Search Menu Block has a fixed size. It would be great to have a relative size.
<input type="text" id="edit-menu-text" name="menu_text" value="" <strong>size="40"</strong> maxlength="128" class="form-text form-autocomplete" autocomplete="OFF" aria-autocomplete="list" title="Enter the menu name you wish to search for.">2. Still in the "Search Menu Block": if the website is slow and the Ajax search function doesn't work fast enough, the user will press ENTER and he will get a "Page not found". I recommend to show a page with the results of the Ajax query. Also if the user has JS disabled... please think in that option.
3. Still in the "Search Menu Block": it would be better to have a "contains" search type, e.g., if you search for "services" you don't find the item called "Web services".
4. If I use the "ctrl+m" I get the search box but If I don't search for anything and press "ctrl+m" again I get a "The requested page "/admin/structure/types/manage/%25/fields/%25" could not be found."
5. I have created a new menu called "Test" with 2 subitems and assign this new menu to the Footer area. I was not able to find the subitems.
6. Last and not least, fix the warnings and errors found by the automated script: http://ventral.org/pareview/httpgitdrupalorgsandboxsuhanijain1773372git
Any question let me know. Thanks for the contribution!
Comment #2
suhani.jain commentedHi fabioknoedt ,
Thanks for your quick review,
1)I am not implementing first suggestion as the design is ok with me.
2)Yes it's my mistake that i haven't implemented it earlier but now whenever user enter any menu item that is not available then the result will show a message 'No results found for your query.' instead of 'Page not found'
3)Yes now the search will have a "contains" search type
4)As i am not getting this error but still have put the check in js file to handle this
5)My module is searching for menu items that are admin links and also that are defined with hook_menu and not the navigation menu.
6)For this i have already written a note in issue summary above that "shortcut.js is a third party javascript library and downloaded from http://www.openjs.com/scripts/events/keyboard_shortcuts/. So please ignore shortcut.js related coding standard issues"
Please correct me, if anything is wrong
Comment #3
suhani.jain commentedReviewed 3 projects
Keyword Highlighter: http://drupal.org/node/1773526#comment-6436688
Views JQFX Supersized: http://drupal.org/node/1765872#comment-6437310
Send Coupons to best Customers: http://drupal.org/node/1753688#comment-6437652
Applying for PAReview: review bonus
Comment #4
klausiThis module looks like a duplicate of coffee: http://drupal.org/project/coffee
Module duplication and fragmentation is a huge problem on drupal.org and we always prefer collaboration over competition. Please open an issue in the coffee issue queue to discuss this and get in contact with the maintainer(s). I'm sure you can incorporate any additions into that project.
If that fails for whatever reasons please get back to us and set this back to "needs review".
Comment #5
dharam1987 commentedHello,
I have the code using the automated project review and have found few errors which you already stated that are related to the 3rd party module, I hope this is okay for admins to approve, else you may instruct users to upload shortcut.js in the library folder and may use it, just my suggestion.
Code looks great, and this module can be a life saver for and 2nd developer who is taking on an existing project.
Thanks
Comment #6
AmbikaFR commentedhi suhani, i ve made a manual review of your code. Here are my little suggestions/remarks :
- Even non authorised paths are exposed in the autocomplete results suggestions. For example, as an admin user (user 1), if i type "garland", the module redirect to "admin/appearance/settings/garland" wich is an "access refused" page if i ve not enable this theme.
You should get each menu item with menu_get_item, given the path of the menu item. After that, you should check access with $item['access'] boolean value.
http://drupal.org/node/300595
http://api.drupal.org/api/drupal/includes!menu.inc/function/menu_get_item/7
- In search_menu.js, you should use Drupal behaviors syntax for "Jquery(document).ready(function()). You can find complete documentation about that here : http://drupal.org/node/756722.
- Also in search_menu.js, you should add a @file comment, and comments for each of your custom functions.
- In the hook_menu, for the autocomplete path (search_menu/multiple_autocomplete), you have specified an always "TRUE" access callback. I suggest to add a special permission to use this functionnality (It should be only useful for administrators for example?).
- In your hook_page_alter, i suggest to put the HTML $markup code into a theme function. I think there is too much HTML code for a "normal" function.
- I think it's also good to make a separation between drupal code and ressources (Javascript, CSS...). You should create a "css" directory and a "js" directory.
Regards,
AmbikaFR.
Comment #7
klausi@AmbikaFR: please do not review applications in the "needs work" state. Review those in the "needs review" instead. See http://drupal.org/node/532400 . Thanks.
Comment #8
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.