Closed (fixed)
Project:
Paddle Menu Manager
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
7 Mar 2013 at 14:58 UTC
Updated:
27 Mar 2013 at 18:40 UTC
A form to create or edit a menu will be shown in a modal dialog. (This may be output in the DOM and be hidden, instead of retrieving it via ajax). The form probably will need to be submit using ajax so that the validation errors will be shown above the form fields in the dialog.
Fields:
* Title
* Description
+ Save button
This is dependent on the Menu translations (see other issue).
The functionality to remove existing menus will be done in another issue.
Comments
Comment #1
pfrenssenComment #2
pfrenssenThis had been committed to the main branch (7.x-1.x). We use feature branches, and the code needs to have tests and be reviewed before it gets merged into 7.x-1.x. This is roughly the procedure:
I will move the code to a feature branch and revert the commit in 7.x-1.x for now.
3dfe022 Menu create functionality added. Visit /paddle_menu_manager/js/main_menu_overview to testComment #3
cyberwolf commentedFrom a first quick look I see this still needs work on the coding standards-side.
Comment #4
cyberwolf commentedThe dependency on ctools is missing in the .info file.
A PHP parse error occurs on line 159 of paddle_menu_manager.module.
Tests are still missing. At least a test is required which submits the form with some random values, then checks if the menu was created correctly.
'manu_name' needs to be 'menu_name".
When using the ctools nojs fallback directly by navigating to the path 'paddle_create_menu/nojs/add' a PHP notice shows up:
When submitting that same form, there is no feedback displayed, just the form again, which could make users think the menu wasn't saved. The user should also be redirected back to the overview page.
Preferably everything related to menu items should be removed again from this branch, so we can safely ignore that part for now and first get in the forms for menus themselves.
Comment #5
cyberwolf commentedI've done a lot more cleanup of the code, merged in 7.x-1.x to use the menu translation sets feature.
Paths you can use already for testing manually:
admin/structure/menu_manager/nojs/add
admin/structure/menu_manager/nojs/[menu_name]/edit
Now updating the tests.
Comment #6
cyberwolf commentedAdded tests for checking functionality without JS.
Writing tests for the JS part actually appears to be very difficult, without having an underlaying test infrastructure for ctools modal itself. DrupalWebTestCase::drupalPostAJAX() does not support the JS commands added by ctools, it even doesn't have full support for Drupal core JS commands. I'm afraid we're crossing the boundaries of SimpleTest here.
So for now I added a test module which can be used for manual testing. Enable paddle_menu_manager_test (it's hidden, so use Drush) and navigate to paddle_menu_manager_test/menu_form.
Comment #7
cyberwolf commentedComment #8
cyberwolf commentedComment #9
cyberwolf commentedAfter looking at #1937100: Use TSID for menu calling, I think there is still a menu_rebuild() missing in the menu create/edit form.
Comment #10
pfrenssenReviewing.
Comment #11
pfrenssenReview:
Code duplication
This is also used when menus are cloned. We can factor this out in a function
paddle_menu_manager_uuid_generate().Form redirection
Discussed this with Cyberwolf, in the case that there is no javascript we can redirect to the menu overview form of the created / edited menu. In case of ajax dialogs, the dialog closes and the same page should be refreshed.
Test module
A test module has been added that provides some clickable links. This should be removed in the future when these links are included in the module. I created a followup issue for this: #1941776: Remove test module.
Comment #12
pfrenssenWhile implementing the redirect I noticed that indeed the call to
menu_rebuild()is missing from the form submit as noted in #9.Comment #13
pfrenssenI addressed the remarks from #11 and #12.
Here are the commits I made, if these can get a quick review this is ready for merging into 7.x-1.x:
Comment #14
cyberwolf commentedJust one small remark:
Should be: "A UUID, ..."
I fixed that and merged to 7.x-1.x, finally! :)