ullCms drag'n'drop sortable of menu items
JS library: http://johnny.github.com/jquery-sortable/
Migrate to sortable
- Convert sequence field for sortable
- php symfony ull_cms:migrate-for-sortable
- Add doctrine behaviour
- config/doctrine/schema.yml
-
UllCmsItem: actAs: Sortable: name: sequence uniqueBy: [parent_ull_cms_item_id]
-
- Rebuild model
- php symfony doctrine:build-model
- config/doctrine/schema.yml
- Hide sequence form field
- apps/frontend/lib/generator/columnConfigCollection/UllCmsItemColumnConfigCollection.class.php
-
$this['sequence'] ->markAsAdvancedField(true) ;
-
- apps/frontend/lib/generator/columnConfigCollection/UllCmsItemColumnConfigCollection.class.php
- Use new helpers:
- apps/frontend/templates/layout.php
-
<?php echo ullCmsHelper::renderMenuCompleteSortable('main-menu', 1) ?>
-
- apps/frontend/modules/ullCms/templates/showSuccess.php
-
<?php slot('sidebar') ?> <?php //echo $sidebar_menu ?> <?php echo ullCmsHelper::renderSubMenuCompleteSortable(3) ?> <?php end_slot() ?>
-
- apps/frontend/templates/layout.php
Touch Problem
The current master does allow dragging, but prevents click on links
The following merge request allows clicking, and dragging, but after releasing the drag it clicks the element and the drag position change is not saved.
https://github.com/johnny/jquery-sortable/pull/169