From 94051b8f86956992769a634bb48a865675bdf94d Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Wed, 4 Sep 2024 22:34:17 -0700 Subject: [PATCH 1/2] Support order and except attributes simultaneously --- .../taglib/grails/plugin/formfields/FormFieldsTagLib.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy b/grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy index 5dd70440..fa2f13d3 100644 --- a/grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy +++ b/grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy @@ -564,10 +564,10 @@ class FormFieldsTagLib { List properties if (attrs.order) { + def orderBy = getList(attrs.order) if (attrs.except) { - throwTagError('The [except] and [order] attributes may not be used together.') + orderBy = orderBy - getList(attrs.except) } - def orderBy = getList(attrs.order) properties = orderBy.collect { propertyName -> fieldsDomainPropertyFactory.build(domainClass.getPropertyByName(propertyName)) } From 29ceb588326716acc327c007336c67e8693d5f07 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Wed, 4 Sep 2024 23:09:36 -0700 Subject: [PATCH 2/2] Update unit test --- .../grails/plugin/formfields/taglib/AllTagSpec.groovy | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/test/groovy/grails/plugin/formfields/taglib/AllTagSpec.groovy b/src/test/groovy/grails/plugin/formfields/taglib/AllTagSpec.groovy index 93b147b7..bed7a921 100644 --- a/src/test/groovy/grails/plugin/formfields/taglib/AllTagSpec.groovy +++ b/src/test/groovy/grails/plugin/formfields/taglib/AllTagSpec.groovy @@ -86,18 +86,17 @@ class AllTagSpec extends AbstractFormFieldsTagLibSpec implements TagLibUnitTest< } - @Issue('https://github.com/grails3-plugins/fields/issues/9') - void 'order attribute and except attribute are mutually exclusive'() { + @Issue('https://github.com/gpc/fields/issues/347') + void 'allow order and except attributes'() { given: views["/_fields/default/_field.gsp"] = '|${property}|' views["/_fields/default/_wrapper.gsp"] = '${widget}' when: - applyTemplate('', [personInstance: personInstance]) + def output = applyTemplate('', [personInstance: personInstance]) then: - GrailsTagException e = thrown() - e.message.contains 'The [except] and [order] attributes may not be used together.' + output == '|name||gender|' } void "f:all tag supports theme"() {