From db36df145a4cbf434f31e26f2071cc542688166c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=BCndig?= Date: Tue, 6 Oct 2020 15:30:06 +0200 Subject: [PATCH 01/21] Added ReorderRelationController --- .../behaviors/ReorderRelationController.php | 261 ++++++++++++++++++ .../partials/_button_reorder.htm | 13 + .../assets/js/october.reorder.js | 10 +- .../partials/_container.htm | 30 ++ .../partials/_records.htm | 13 + .../partials/_relation_modal.htm | 25 ++ modules/backend/lang/de/lang.php | 3 +- modules/backend/lang/en/lang.php | 1 + 8 files changed, 352 insertions(+), 4 deletions(-) create mode 100644 modules/backend/behaviors/ReorderRelationController.php create mode 100644 modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm create mode 100644 modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm create mode 100644 modules/backend/behaviors/reorderrelationcontroller/partials/_records.htm create mode 100644 modules/backend/behaviors/reorderrelationcontroller/partials/_relation_modal.htm diff --git a/modules/backend/behaviors/ReorderRelationController.php b/modules/backend/behaviors/ReorderRelationController.php new file mode 100644 index 0000000000..a0950f54b0 --- /dev/null +++ b/modules/backend/behaviors/ReorderRelationController.php @@ -0,0 +1,261 @@ +config = $this->makeConfig($controller->reorderRelationConfig, []); + } + + // + // AJAX + // + + /** + * Updates the relation order. + * @throws \Exception + */ + public function onReorderRelation() + { + $this->reorderGetModel(); + $this->validateModel(); + + if ( + (!$ids = post('record_ids')) || + (!$orders = post('sort_orders')) + ) { + return; + } + + /** @var SortableRelation $instance */ + $instance = $this->parentModel->newQuery()->find(post('_reorder_parent_id')); + $instance->setRelationOrder($this->relation, $ids, $orders); + } + + /** + * Returns the modal contents. + * @return string + */ + public function onRelationButtonReorder() + { + $this->addJs('../../reordercontroller/assets/js/october.reorder.js', 'core'); + + $this->reorderGetModel(); + $this->validateModel(); + $this->prepareVars(); + + $params = [ + 'reorderRelation' => $this->relation, + 'reorderModel' => get_class($this->parentModel), + 'reorderParentId' => post('_reorder_parent_id'), + 'reorderSortColumn' => $this->parentModel->getRelationSortOrderColumn($this->relation), + ]; + + return $this->reorderRelationMakePartial( + 'relation_modal', + $params + [ + 'container' => $this->reorderRelationMakePartial('container', $params) + ] + ); + } + + /** + * Update the relation widget once the model gets closed. + * @return array + */ + public function onRelationModalClose() + { + $this->reorderGetModel(); + + $this->controller->initRelation( + $this->parentModel->newQuery()->findOrFail(post('_reorder_parent_id')), + $this->relation + ); + + return [ + '#' . $this->controller->relationGetId('view') => $this->controller->relationRenderView($this->relation), + ]; + } + + // + // Reordering + // + + /** + * Sets all required model properties. + */ + public function reorderGetModel() + { + $this->parentModel = $this->reorderGetParentModel(); + $this->relation = post('_reorder_relation'); + + $relationModelClass = array_get($this->parentModel->getRelationDefinition($this->relation), 0); + if (!$relationModelClass) { + throw new ApplicationException( + sprintf('Could not determine model class for relation "%s"', $this->relation) + ); + } + + return $this->model = new $relationModelClass; + } + + /** + * Returns all the records from the supplied model. + * @return Collection + */ + protected function getRecords() + { + $query = $this->parentModel->newQuery(); + + $this->controller->reorderExtendRelationQuery($query); + + return $query + ->with([$this->relation => function($q) { + $q->orderBy($this->parentModel->getRelationSortOrderColumn($this->relation), 'ASC'); + }]) + ->findOrFail(post('_reorder_parent_id')) + ->{$this->relation}; + } + + /** + * Extend the relation query used for finding reorder records. Extra conditions + * can be applied to the query, for example, $query->withTrashed(); + * @param October\Rain\Database\Builder $query + * @return void + */ + public function reorderExtendRelationQuery($query) + { + } + + // + // Helpers + // + + /** + * Prepares common partial variables. + */ + protected function prepareVars() + { + $this->vars['reorderRecords'] = $this->getRecords(); + $this->vars['reorderModel'] = $this->model; + } + + /** + * Return a model instance based on the _reorder_model post value. + * @return Model + */ + public function reorderGetParentModel() + { + $model = post('_reorder_model'); + + if (!class_exists($model)) { + throw new ApplicationException( + sprintf('Model class "%s" does not exist', $model) + ); + } + + return new $model; + } + + /** + * Validate the supplied form model. + * @return void + */ + protected function validateModel() + { + $modelTraits = class_uses($this->parentModel); + + if (!isset($modelTraits[\October\Rain\Database\Traits\SortableRelation::class])) { + throw new ApplicationException( + sprintf('The "%s" model must implement the SortableRelation trait.', get_class($this->parentModel)) + ); + } + } + + /** + * Returns the name attribute for a given $record. The attribute + * defined in the behaviour config is used here. + * + * @param Model $record + * @param $relation + * + * @return string + */ + public function reorderRelationGetRecordName(Model $record, $relation) + { + $attribute = array_get((array)$this->config, "$relation.nameFrom"); + if ($attribute) { + return (string)$record->$attribute; + } + + // Take a guess if no "nameFrom" config is set. + return (string)($record->name ?: $record->title); + } + + /** + * Controller accessor for making partials within this behavior. + * @param string $partial + * @param array $params + * @return string Partial contents + */ + public function reorderRelationMakePartial($partial, $params = []) + { + $contents = $this->controller->makePartial( + 'reorder_' . $partial, + $params + $this->vars, + false + ); + + if (!$contents) { + $contents = $this->makePartial($partial, $params); + } + + return $contents; + } +} diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm b/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm new file mode 100644 index 0000000000..3e68e20f7e --- /dev/null +++ b/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm @@ -0,0 +1,13 @@ + + + diff --git a/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js b/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js index 5ce4957481..3b07500044 100644 --- a/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js +++ b/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js @@ -10,11 +10,13 @@ var ReorderBehavior = function() { this.sortMode = null + this.context = 'default' this.simpleSortOrders = [] - this.initSorting = function (mode) { + this.initSorting = function (mode, context) { this.sortMode = mode + this.context = context if (mode == 'simple') { this.initSortingSimple() @@ -34,7 +36,9 @@ postData = this.getNestedMoveData(sortData) } - $('#reorderTreeList').request('onReorder', { + var handler = this.context === 'relation' ? 'onReorderRelation' : 'onReorder' + + $('#reorderTreeList').request(handler, { data: postData }) } @@ -79,4 +83,4 @@ } $.oc.reorderBehavior = new ReorderBehavior; -}(window.jQuery); \ No newline at end of file +}(window.jQuery); diff --git a/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm b/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm new file mode 100644 index 0000000000..e7db31ab86 --- /dev/null +++ b/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm @@ -0,0 +1,30 @@ + + + + + + + +
+ +
    + reorderRelationMakePartial('records', [ + 'records' => $reorderRecords, + 'sortColumn' => $reorderSortColumn, + 'relation' => $reorderRelation + ]) ?> +
+ +

+ +
+ + + diff --git a/modules/backend/behaviors/reorderrelationcontroller/partials/_records.htm b/modules/backend/behaviors/reorderrelationcontroller/partials/_records.htm new file mode 100644 index 0000000000..11aeb2611c --- /dev/null +++ b/modules/backend/behaviors/reorderrelationcontroller/partials/_records.htm @@ -0,0 +1,13 @@ + + +
  • +
    + + reorderRelationGetRecordName($record, $relation)) ?> + +
    +
  • + + diff --git a/modules/backend/behaviors/reorderrelationcontroller/partials/_relation_modal.htm b/modules/backend/behaviors/reorderrelationcontroller/partials/_relation_modal.htm new file mode 100644 index 0000000000..37a569cd2c --- /dev/null +++ b/modules/backend/behaviors/reorderrelationcontroller/partials/_relation_modal.htm @@ -0,0 +1,25 @@ + + + + + diff --git a/modules/backend/lang/de/lang.php b/modules/backend/lang/de/lang.php index 5118bb7f5e..4693aa1169 100644 --- a/modules/backend/lang/de/lang.php +++ b/modules/backend/lang/de/lang.php @@ -295,7 +295,8 @@ ], 'reorder' => [ 'default_title' => 'Einträge sortieren', - 'no_records' => 'Es gibt keine Einträge zum sortieren.' + 'no_records' => 'Es gibt keine Einträge zum sortieren.', + 'relation' => 'Sortiere verwandte Einträge', ], 'model' => [ 'name' => "Model", diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 230e744a47..41afa40cab 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -351,6 +351,7 @@ 'reorder' => [ 'default_title' => 'Reorder records', 'no_records' => 'There are no records available to sort.', + 'relation' => 'Sort related entries', ], 'model' => [ 'name' => 'Model', From c40f5e2290916f3a2ad08dc546c5afb0b72706e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=BCndig?= Date: Tue, 6 Oct 2020 18:25:44 +0200 Subject: [PATCH 02/21] Set the config only if a reorderRelationConfig is available --- modules/backend/behaviors/ReorderRelationController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/backend/behaviors/ReorderRelationController.php b/modules/backend/behaviors/ReorderRelationController.php index a0950f54b0..d04f875810 100644 --- a/modules/backend/behaviors/ReorderRelationController.php +++ b/modules/backend/behaviors/ReorderRelationController.php @@ -50,7 +50,10 @@ public function __construct($controller) parent::__construct($controller); // The configuration is optional for this behavior. - $this->config = $this->makeConfig($controller->reorderRelationConfig, []); + $this->config = []; + if ($controller->reorderRelationConfig) { + $this->config = $this->makeConfig($controller->reorderRelationConfig, []); + } } // From 07535b2fe832e5458cd2cb7eb1ab84b50667dc7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=BCndig?= Date: Tue, 6 Oct 2020 18:45:45 +0200 Subject: [PATCH 03/21] Fixed code style --- modules/backend/behaviors/ReorderRelationController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/backend/behaviors/ReorderRelationController.php b/modules/backend/behaviors/ReorderRelationController.php index d04f875810..f17150725d 100644 --- a/modules/backend/behaviors/ReorderRelationController.php +++ b/modules/backend/behaviors/ReorderRelationController.php @@ -102,9 +102,9 @@ public function onRelationButtonReorder() return $this->reorderRelationMakePartial( 'relation_modal', - $params + [ - 'container' => $this->reorderRelationMakePartial('container', $params) - ] + $params + [ + 'container' => $this->reorderRelationMakePartial('container', $params), + ] ); } @@ -159,7 +159,7 @@ protected function getRecords() $this->controller->reorderExtendRelationQuery($query); return $query - ->with([$this->relation => function($q) { + ->with([$this->relation => function ($q) { $q->orderBy($this->parentModel->getRelationSortOrderColumn($this->relation), 'ASC'); }]) ->findOrFail(post('_reorder_parent_id')) From 7c8e0f38d9016deb7119734755f75affa7999237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=BCndig?= Date: Thu, 15 Oct 2020 10:03:53 +0200 Subject: [PATCH 04/21] First version of sortable Lists --- modules/backend/behaviors/ListController.php | 13 ++++ .../backend/behaviors/RelationController.php | 4 ++ .../behaviors/ReorderRelationController.php | 26 ++++++-- .../partials/_button_reorder.htm | 8 ++- .../assets/js/october.reorder.js | 1 - .../partials/_container.htm | 7 ++- modules/backend/widgets/Lists.php | 60 +++++++++++++++++++ .../widgets/lists/assets/js/october.list.js | 23 ++++++- .../backend/widgets/lists/partials/_list.htm | 14 ++++- .../widgets/lists/partials/_list_body_row.htm | 2 +- .../lists/partials/_list_sort_handle.htm | 4 ++ modules/system/assets/ui/js/list.sortable.js | 54 +++++++++-------- modules/system/assets/ui/less/list.base.less | 16 +++++ modules/system/assets/ui/storm.css | 2 + 14 files changed, 192 insertions(+), 42 deletions(-) create mode 100644 modules/backend/widgets/lists/partials/_list_sort_handle.htm diff --git a/modules/backend/behaviors/ListController.php b/modules/backend/behaviors/ListController.php index d885f1625a..d91804a387 100644 --- a/modules/backend/behaviors/ListController.php +++ b/modules/backend/behaviors/ListController.php @@ -5,6 +5,7 @@ use Flash; use ApplicationException; use Backend\Classes\ControllerBehavior; +use October\Rain\Database\Traits\SortableRelation; /** * Adds features for working with backend lists. @@ -424,6 +425,18 @@ public function listRefresh($definition = null) return $this->listWidgets[$definition]->onRefresh(); } + /** + * Returns the sort order value for a specific record. + */ + public function getRecordSortOrder($record, $relation) + { + /** @var SortableRelation $modelInstance */ + $modelInstance = new $this->config->modelClass; + $reorderColumn = $modelInstance->getRelationSortOrderColumn($relation); + + return $record->pivot->{$reorderColumn}; + } + /** * Returns the widget used by this behavior. * @return \Backend\Classes\WidgetBase diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 5102425973..d0d8b04875 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -667,6 +667,10 @@ protected function makeViewWidget() $config->alias = $this->alias . 'ViewList'; $config->showSorting = $this->getConfig('view[showSorting]', true); $config->defaultSort = $this->getConfig('view[defaultSort]'); + $config->sortable = $this->getConfig('view[sortable]', false); + $config->reorderRelation = $this->relationName; + $config->reorderModel = get_class($this->model); + $config->reorderParentId = $this->model->getKey(); $config->recordsPerPage = $this->getConfig('view[recordsPerPage]'); $config->showCheckboxes = $this->getConfig('view[showCheckboxes]', !$this->readOnly); $config->recordUrl = $this->getConfig('view[recordUrl]', null); diff --git a/modules/backend/behaviors/ReorderRelationController.php b/modules/backend/behaviors/ReorderRelationController.php index f17150725d..b35685ceb8 100644 --- a/modules/backend/behaviors/ReorderRelationController.php +++ b/modules/backend/behaviors/ReorderRelationController.php @@ -77,7 +77,7 @@ public function onReorderRelation() } /** @var SortableRelation $instance */ - $instance = $this->parentModel->newQuery()->find(post('_reorder_parent_id')); + $instance = $this->parentModel->newQuery()->find($this->postValue('_reorder_parent_id')); $instance->setRelationOrder($this->relation, $ids, $orders); } @@ -96,7 +96,7 @@ public function onRelationButtonReorder() $params = [ 'reorderRelation' => $this->relation, 'reorderModel' => get_class($this->parentModel), - 'reorderParentId' => post('_reorder_parent_id'), + 'reorderParentId' => $this->postValue('_reorder_parent_id'), 'reorderSortColumn' => $this->parentModel->getRelationSortOrderColumn($this->relation), ]; @@ -117,7 +117,7 @@ public function onRelationModalClose() $this->reorderGetModel(); $this->controller->initRelation( - $this->parentModel->newQuery()->findOrFail(post('_reorder_parent_id')), + $this->parentModel->newQuery()->findOrFail($this->postValue('_reorder_parent_id')), $this->relation ); @@ -136,7 +136,7 @@ public function onRelationModalClose() public function reorderGetModel() { $this->parentModel = $this->reorderGetParentModel(); - $this->relation = post('_reorder_relation'); + $this->relation = $this->postValue('_reorder_relation'); $relationModelClass = array_get($this->parentModel->getRelationDefinition($this->relation), 0); if (!$relationModelClass) { @@ -162,7 +162,7 @@ protected function getRecords() ->with([$this->relation => function ($q) { $q->orderBy($this->parentModel->getRelationSortOrderColumn($this->relation), 'ASC'); }]) - ->findOrFail(post('_reorder_parent_id')) + ->findOrFail($this->postValue('_reorder_parent_id')) ->{$this->relation}; } @@ -195,7 +195,7 @@ protected function prepareVars() */ public function reorderGetParentModel() { - $model = post('_reorder_model'); + $model = $this->postValue('_reorder_model'); if (!class_exists($model)) { throw new ApplicationException( @@ -261,4 +261,18 @@ public function reorderRelationMakePartial($partial, $params = []) return $contents; } + + /** + * Fetch a post value for the current relation. + * + * @param string $key + * + * @return mixed + */ + private function postValue(string $key) + { + $relation = post('_reorder_relation_name'); + + return post($key. '.' . $relation); + } } diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm b/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm index 3e68e20f7e..656c911e71 100644 --- a/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm +++ b/modules/backend/behaviors/relationcontroller/partials/_button_reorder.htm @@ -1,11 +1,13 @@ +vars['relationField']; ?> diff --git a/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js b/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js index 3b07500044..c6728c151c 100644 --- a/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js +++ b/modules/backend/behaviors/reordercontroller/assets/js/october.reorder.js @@ -6,7 +6,6 @@ * - Nested sorting: Post back source and target nodes IDs and the move positioning. */ +function ($) { "use strict"; - var ReorderBehavior = function() { this.sortMode = null diff --git a/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm b/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm index e7db31ab86..2aaeeb1b5e 100644 --- a/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm +++ b/modules/backend/behaviors/reorderrelationcontroller/partials/_container.htm @@ -1,9 +1,10 @@ - - - + + + +
    validateModel(); $this->validateTree(); + + if ($this->sortable) { + $this->addJs('/modules/system/assets/ui/js/list.sortable.js', 'core'); + $this->showSorting = false; + + /** @var SortableRelation $modelInstance */ + $modelInstance = new $this->reorderModel; + $this->reorderColumn = $modelInstance->getRelationSortOrderColumn($this->reorderRelation); + } } /** @@ -260,6 +299,10 @@ public function prepareVars() $this->vars['showPagination'] = $this->showPagination; $this->vars['showPageNumbers'] = $this->showPageNumbers; $this->vars['showSorting'] = $this->showSorting; + $this->vars['sortable'] = $this->sortable; + $this->vars['reorderModel'] = $this->reorderModel; + $this->vars['reorderRelation'] = $this->reorderRelation; + $this->vars['reorderParentId'] = $this->reorderParentId; $this->vars['sortColumn'] = $this->getSortColumn(); $this->vars['sortDirection'] = $this->sortDirection; $this->vars['showTree'] = $this->showTree; @@ -536,6 +579,12 @@ public function prepareQuery() $sortColumn = $column->relation . '_count'; } + // Fix the sort order if this list has sortable set to true. + if ($this->sortable) { + $sortColumn = $this->reorderColumn; + $this->sortDirection = 'ASC'; + } + $query->orderBy($sortColumn, $this->sortDirection); } @@ -775,6 +824,17 @@ protected function defineListColumns() throw new ApplicationException(Lang::get('backend::lang.list.missing_columns', compact('class'))); } + if ($this->sortable) { + $this->allColumns['sort_handle'] = $this->makeListColumn('sort_handle', [ + 'label' => '', + 'path' => '~/modules/backend/widgets/lists/partials/_list_sort_handle.htm', + 'type' => 'partial', + 'width' => '20px', + 'sortable' => false, + 'clickable' => false, + ]); + } + $this->addColumns($this->columns); /** diff --git a/modules/backend/widgets/lists/assets/js/october.list.js b/modules/backend/widgets/lists/assets/js/october.list.js index ad30498ec2..9cce1d6684 100644 --- a/modules/backend/widgets/lists/assets/js/october.list.js +++ b/modules/backend/widgets/lists/assets/js/october.list.js @@ -11,6 +11,7 @@ var $el = this.$el = $(element); this.options = options || {}; + this.sortOrders = [] var scrollClassContainer = options.scrollClassContainer !== undefined ? options.scrollClassContainer @@ -22,6 +23,17 @@ dragSelector: 'thead' }) + if (element.dataset.hasOwnProperty('sortable')) { + this.$el.find('.control-list-tbody').listSortable({ + handle: '.drag-handle' + }) + this.$el.on('dragged.list.sorted', $.proxy(this.processReorder, this)) + + this.$el.find('[data-record-sort-order]').each(function (index, el) { + this.sortOrders.push(el.dataset.recordSortOrder) + }.bind(this)) + } + this.update() } @@ -86,6 +98,15 @@ $checkbox.prop('checked', !$checkbox.is(':checked')).trigger('change') } + ListWidget.prototype.processReorder = function() { + var relation = this.$el.data('sortableRelation') + var handler = relation ? 'onReorderRelation' : 'onReorder' + + this.$el.request(handler, { + data: { sort_orders: this.sortOrders, _reorder_relation_name: relation } + }) + } + // LIST WIDGET PLUGIN DEFINITION // ============================ @@ -141,4 +162,4 @@ $('[data-control="listwidget"]').listWidget(); }) -}(window.jQuery); \ No newline at end of file +}(window.jQuery); diff --git a/modules/backend/widgets/lists/partials/_list.htm b/modules/backend/widgets/lists/partials/_list.htm index 5b3e50e656..0a542c22da 100644 --- a/modules/backend/widgets/lists/partials/_list.htm +++ b/modules/backend/widgets/lists/partials/_list.htm @@ -1,9 +1,19 @@ -
    + + + + + + +
    + +> makePartial('list_head_row') ?> - + makePartial('list_body_rows') ?> diff --git a/modules/backend/widgets/lists/partials/_list_body_row.htm b/modules/backend/widgets/lists/partials/_list_body_row.htm index 55111e08ab..2b2a43043a 100644 --- a/modules/backend/widgets/lists/partials/_list_body_row.htm +++ b/modules/backend/widgets/lists/partials/_list_body_row.htm @@ -3,7 +3,7 @@ $childRecords = $showTree ? $record->getChildren() : null; $treeLevelClass = $showTree ? 'list-tree-level-'.$treeLevel : ''; ?> - +> makePartial('list_body_checkbox', ['record' => $record]) ?> diff --git a/modules/backend/widgets/lists/partials/_list_sort_handle.htm b/modules/backend/widgets/lists/partials/_list_sort_handle.htm new file mode 100644 index 0000000000..80989de4ef --- /dev/null +++ b/modules/backend/widgets/lists/partials/_list_sort_handle.htm @@ -0,0 +1,4 @@ +
    + + ☰ +
    diff --git a/modules/system/assets/ui/js/list.sortable.js b/modules/system/assets/ui/js/list.sortable.js index 534115f3d2..e121bde4cf 100644 --- a/modules/system/assets/ui/js/list.sortable.js +++ b/modules/system/assets/ui/js/list.sortable.js @@ -1,6 +1,6 @@ /* * Sortable plugin. - * + * * Status: experimental. The behavior is not perfect, but it's OK in terms of memory * usage and disposing. * @@ -8,7 +8,7 @@ * functionality. The plugin uses only HTML5 Drag&Drop feature and completely * disposable. * - * During the dragging the plugin creates a placeholder element, which should be + * During the dragging the plugin creates a placeholder element, which should be * styled separately. * * Draggable elements should be marked with "draggable" HTML5 attribute. @@ -18,7 +18,7 @@ * [x] Sorting a single list. * [ ] Dragging items between multiple lists. * [ ] Sorting nested lists. - + * JAVASCRIPT API * * $('#list').listSortable({}) @@ -29,7 +29,7 @@ *