From 11aee56916c71648d80ee066030f46f172485015 Mon Sep 17 00:00:00 2001 From: Joel Kent Date: Sat, 16 Apr 2016 23:57:52 +0100 Subject: [PATCH 1/6] Sortable tab array --- src/tabarray.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tabarray.html b/src/tabarray.html index e7a5b8a..e6e3c02 100644 --- a/src/tabarray.html +++ b/src/tabarray.html @@ -6,8 +6,9 @@ class="clearfix schema-form-tabarray schema-form-tabarray-{{form.tabType || 'left'}} {{form.htmlClass}}">
- +
From 0a8858615954f242e333bdcdb12e81b919a2a439 Mon Sep 17 00:00:00 2001 From: Joel Kent Date: Mon, 18 Apr 2016 10:20:36 +0100 Subject: [PATCH 2/6] Support for sortOptions The ui-sortable directive is now passed sortOptions. sortOptions.items defaults to ignore the last list item. --- src/bootstrap-decorator.js | 13 ++++++++++++- src/tabarray.html | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bootstrap-decorator.js b/src/bootstrap-decorator.js index 8c20653..1deb784 100644 --- a/src/bootstrap-decorator.js +++ b/src/bootstrap-decorator.js @@ -27,13 +27,24 @@ function(decoratorsProvider, sfBuilderProvider, sfPathProvider) { }); } }; + + // Set tabArray sortOptions.items default. + var tabArray = function(args) { + if(args.form.hasOwnProperty('sortOptions')) { + if(!args.form.sortOptions.hasOwnProperty('items')) { + args.form.sortOptions['items'] = 'li:not(:last-child)'; + } + } else { + args.form['sortOptions'] = {items: 'li:not(:last-child)'}; + } + } var defaults = [sfField, ngModel, ngModelOptions, condition]; decoratorsProvider.defineDecorator('bootstrapDecorator', { textarea: {template: base + 'textarea.html', builder: defaults}, fieldset: {template: base + 'fieldset.html', builder: [sfField, simpleTransclusion, condition]}, array: {template: base + 'array.html', builder: [sfField, ngModelOptions, ngModel, array, condition]}, - tabarray: {template: base + 'tabarray.html', builder: [sfField, ngModelOptions, ngModel, array, condition]}, + tabarray: {template: base + 'tabarray.html', builder: [sfField, ngModelOptions, ngModel, array, condition, tabArray]}, tabs: {template: base + 'tabs.html', builder: [sfField, ngModelOptions, tabs, condition]}, section: {template: base + 'section.html', builder: [sfField, simpleTransclusion, condition]}, conditional: {template: base + 'section.html', builder: [sfField, simpleTransclusion, condition]}, diff --git a/src/tabarray.html b/src/tabarray.html index e6e3c02..45bfbb9 100644 --- a/src/tabarray.html +++ b/src/tabarray.html @@ -8,7 +8,7 @@ ng-class="{'col-xs-3': !form.tabType || form.tabType === 'left'}">