Permalink
Browse files

Ready for 0.1 release.

  • Loading branch information...
1 parent e2489a3 commit 20031ecbbdcb9b2d00f6d94bb4eba2797d559d00 @limcheekin committed Dec 14, 2010
Showing with 111 additions and 634 deletions.
  1. 0 {grails-app/domain/org/grails/jquery/validation/ui → bak}/DummyDomain.groovy
  2. 0 {grails-app/controllers/org/grails/jquery/validation/ui → bak}/DummyDomainController.groovy
  3. 0 {grails-app/controllers/org/grails/jquery/validation/ui → bak}/ProcessElementCommand.groovy
  4. 0 {grails-app/controllers/org/grails/jquery/validation/ui → bak}/UserController.groovy
  5. 0 {grails-app/views → bak}/dummyDomain/create.gsp
  6. 0 {grails-app/views → bak}/dummyDomain/edit.gsp
  7. 0 {grails-app/views → bak}/dummyDomain/list.gsp
  8. 0 {grails-app/views → bak}/dummyDomain/show.gsp
  9. 0 {grails-app/views → bak}/index.gsp
  10. +0 −58 grails-app/i18n/messages.properties
  11. +8 −7 grails-app/taglib/org/grails/jquery/validation/ui/JQueryValidationUiTagLib.groovy
  12. +62 −0 scripts/InstallSampleapp.groovy
  13. 0 { → src/sample-app}/grails-app/controllers/org/grails/jquery/validation/ui/PersonController.groovy
  14. 0 { → src/sample-app}/grails-app/domain/org/grails/jquery/validation/ui/Address.groovy
  15. +1 −1 { → src/sample-app}/grails-app/domain/org/grails/jquery/validation/ui/Person.groovy
  16. +7 −0 src/sample-app/grails-app/i18n/messages.properties
  17. +10 −10 { → src/sample-app}/grails-app/views/person/_createAndEdit.gsp
  18. +1 −1 { → src/sample-app}/grails-app/views/person/create.gsp
  19. +5 −34 { → src/sample-app}/grails-app/views/person/edit.gsp
  20. 0 { → src/sample-app}/grails-app/views/person/list.gsp
  21. 0 { → src/sample-app}/grails-app/views/person/show.gsp
  22. +0 −98 src/templates/scaffolding/Controller.groovy
  23. +0 −65 src/templates/scaffolding/create.gsp
  24. +0 −64 src/templates/scaffolding/edit.gsp
  25. +0 −61 src/templates/scaffolding/list.gsp
  26. +0 −171 src/templates/scaffolding/renderEditor.template
  27. +0 −64 src/templates/scaffolding/show.gsp
  28. +17 −0 test/integration/org/grails/jquery/validation/ui/ConstraintsRetrieveTests.groovy
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,58 +0,0 @@
-default.doesnt.match.message=Property [{0}] of class [{1}] with value [{2}] does not match the required pattern [{3}]
-default.invalid.url.message=Property [{0}] of class [{1}] with value [{2}] is not a valid URL
-default.invalid.creditCard.message=Property [{0}] of class [{1}] with value [{2}] is not a valid credit card number
-default.invalid.email.message=Property [{0}] of class [{1}] with value [{2}] is not a valid e-mail address
-default.invalid.range.message=Property [{0}] of class [{1}] with value [{2}] does not fall within the valid range from [{3}] to [{4}]
-default.invalid.size.message=Property [{0}] of class [{1}] with value [{2}] does not fall within the valid size range from [{3}] to [{4}]
-default.invalid.max.message=Property [{0}] of class [{1}] with value [{2}] exceeds maximum value [{3}]
-default.invalid.min.message=Property [{0}] of class [{1}] with value [{2}] is less than minimum value [{3}]
-default.invalid.max.size.message=Property [{0}] of class [{1}] with value [{2}] exceeds the maximum size of [{3}]
-default.invalid.min.size.message=Property [{0}] of class [{1}] with value [{2}] is less than the minimum size of [{3}]
-default.invalid.validator.message=Property [{0}] of class [{1}] with value [{2}] does not pass custom validation
-default.not.inlist.message=Property [{0}] of class [{1}] with value [{2}] is not contained within the list [{3}]
-default.blank.message=Property [{0}] of class [{1}] cannot be blank
-default.not.equal.message=Property [{0}] of class [{1}] with value [{2}] cannot equal [{3}]
-default.null.message=Property [{0}] of class [{1}] cannot be null
-default.not.unique.message=Property [{0}] of class [{1}] with value [{2}] must be unique
-
-default.paginate.prev=Previous
-default.paginate.next=Next
-default.boolean.true=True
-default.boolean.false=False
-default.date.format=yyyy-MM-dd HH:mm:ss z
-default.number.format=0
-
-default.created.message={0} {1} created
-default.updated.message={0} {1} updated
-default.deleted.message={0} {1} deleted
-default.not.deleted.message={0} {1} could not be deleted
-default.not.found.message={0} not found with id {1}
-default.optimistic.locking.failure=Another user has updated this {0} while you were editing
-
-default.home.label=Home
-default.list.label={0} List
-default.add.label=Add {0}
-default.new.label=New {0}
-default.create.label=Create {0}
-default.show.label=Show {0}
-default.edit.label=Edit {0}
-
-default.button.create.label=Create
-default.button.edit.label=Edit
-default.button.update.label=Update
-default.button.delete.label=Delete
-default.button.delete.confirm.message=Are you sure?
-
-# Data binding errors. Use "typeMismatch.$className.$propertyName to customize (eg typeMismatch.Book.author)
-typeMismatch.java.net.URL=Property {0} must be a valid URL
-typeMismatch.java.net.URI=Property {0} must be a valid URI
-typeMismatch.java.util.Date=Property {0} must be a valid Date
-typeMismatch.java.lang.Double=Property {0} must be a valid number
-typeMismatch.java.lang.Integer=Property {0} must be a valid number
-typeMismatch.java.lang.Long=Property {0} must be a valid number
-typeMismatch.java.lang.Short=Property {0} must be a valid number
-typeMismatch.java.math.BigDecimal=Property {0} must be a valid number
-typeMismatch.java.math.BigInteger=Property {0} must be a valid number
-
-#vacationRequest.VacationRequest.employeeName.blank=Custom Blank 1
-#vacationRequest.employeeName.blank=Custom Blank 2
@@ -84,7 +84,7 @@ class JQueryValidationUiTagLib {
}
def renderErrors = { attrs, body ->
- def renderErrorsOnTop = grailsApplication.config.jqueryValidationUi.get("renderErrorsOnTop", true)
+ def renderErrorsOnTop = attrs.render ? Boolean.valueOf(attrs.render) : grailsApplication.config.jqueryValidationUi.get("renderErrorsOnTop", true)
if (renderErrorsOnTop) {
String qTipClasses = grailsApplication.config.jqueryValidationUi.qTip.classes?:""
String style = attrs.remove("style")?:''
@@ -148,12 +148,13 @@ out << """
def alsoProperties = attrs.remove("also")
def notProperties = attrs.remove("not")
String form = attrs.remove("form")
- def jQueryUiStyle = grailsApplication.config.jqueryValidationUi.qTip.get("jQueryUiStyle", false)
- String qTipClasses = grailsApplication.config.jqueryValidationUi.qTip.classes?:""
- String errorClass = grailsApplication.config.jqueryValidationUi.errorClass?:"error"
- String validClass = grailsApplication.config.jqueryValidationUi.validClass?:"valid"
- def onsubmit = grailsApplication.config.jqueryValidationUi.get("onsubmit", true)
- def renderErrorsOnTop = grailsApplication.config.jqueryValidationUi.get("renderErrorsOnTop", true)
+ def config = grailsApplication.config.jqueryValidationUi
+ def jQueryUiStyle = config.qTip.get("jQueryUiStyle", false)
+ String qTipClasses = config.qTip.classes?:""
+ String errorClass = attrs.errorClass?:config.errorClass?:"error"
+ String validClass = attrs.validClass?:config.validClass?:"valid"
+ def onsubmit = attrs.onsubmit ? Boolean.valueOf(attrs.onsubmit) : config.get("onsubmit", true)
+ def renderErrorsOnTop = attrs.renderErrorsOnTop ? Boolean.valueOf(attrs.renderErrorsOnTop) : config.get("renderErrorsOnTop", true)
String renderErrorsOptions
if (!forClass) {
throwTagError("${TAG_ERROR_PREFIX}Tag missing required attribute [for]")
@@ -0,0 +1,62 @@
+/* Copyright 2010 the original author or authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/**
+*
+*
+* @author <a href='mailto:limcheekin@vobject.com'>Lim Chee Kin</a>
+*
+* @since 0.1
+*
+*/
+
+includeTargets << grailsScript("Init")
+
+target(main: "Install person sample application") {
+ ant.copy (todir:"${basedir}/grails-app/views", overwrite: true) {
+ fileset dir:"${jqueryValidationUiPluginDir}/src/sample-app/grails-app/views"
+ }
+
+ ant.copy (todir:"${basedir}/grails-app/controllers", overwrite: true) {
+ fileset dir:"${jqueryValidationUiPluginDir}/src/sample-app/grails-app/controllers"
+ }
+
+ ant.copy (todir:"${basedir}/grails-app/domain", overwrite: true) {
+ fileset dir:"${jqueryValidationUiPluginDir}/src/sample-app/grails-app/domain"
+ }
+
+ updateMessages(jqueryValidationUiPluginDir)
+}
+
+setDefaultTarget(main)
+
+private void updateMessages(def pluginBasedir) {
+ def messagesFile = new File(basedir, 'grails-app/i18n/messages.properties')
+ if (messagesFile.exists() && messagesFile.text.indexOf("person") == -1) {
+ messagesFile.withWriterAppend { messagesFileWriter ->
+ messagesFileWriter.writeLine('')
+ new File("${pluginBasedir}/src/sample-app/grails-app/i18n/messages.properties").eachLine { line ->
+ messagesFileWriter.writeLine(line)
+ }
+ }
+ ant.echo '''
+******************************************************************
+* Your grails-app/i18n/messages.properties has been updated with *
+* default messages of the Person Sample Application; *
+* please verify that the values are correct. *
+******************************************************************
+ '''
+ }
+}
@@ -7,6 +7,6 @@ class Person {
static embedded = ['homeAddress', 'workAddress']
static constraints = {
- name blank:false, nullable:false
+ name blank:false
}
}
@@ -0,0 +1,7 @@
+#Added by the JQuery Validation UI plugin: Customized messages for the person sample app
+person.name.blank=Person Name cannot be blank.
+address.code.nullable=Address Code cannot be blank.
+address.number.nullable=Address Number cannot be blank.
+# For server side validation
+person.workAddress.nullable=Work Address cannot be blank.
+person.homeAddress.nullable=Home Address cannot be blank.
@@ -3,14 +3,14 @@
<tbody>
<tr class="prop">
<td valign="top" class="name">
- <label for="name"><g:message code="person.name.label" default="Name" /></label>
+ <label for="name"><g:message code="person.name.label" default="Person Name" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: personInstance, field: 'name', 'errors')}">
<g:textField name="name" value="${personInstance?.name}" />
</td>
<td>
<g:if test="${hasErrors(bean: personInstance, field: 'name', 'errors')}">
- <jqvalui:renderError for="name" style="margin-left: 5px; margin-top: -21px">
+ <jqvalui:renderError for="name" style="margin-top: -5px">
<g:eachError bean="${personInstance}" field="name"><g:message error="${it}" /></g:eachError>
</jqvalui:renderError>
</g:if>
@@ -19,14 +19,14 @@
<tr class="prop">
<td valign="top" class="name">
- <label for="workAddress.code"><g:message code="address.code.label" default="Code" /></label>
+ <label for="workAddress.code"><g:message code="workAddress.code.label" default="Work Address Code" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: personInstance?.workAddress, field: 'code', 'errors')}">
<g:textField name="workAddress.code" value="${personInstance?.workAddress?.code}" />
</td>
<td>
<g:if test="${hasErrors(bean: personInstance, field: 'workAddress.code', 'errors')}">
- <jqvalui:renderError for="workAddress.code" style="margin-left: 5px; margin-top: -21px">
+ <jqvalui:renderError for="workAddress.code" style="margin-top: -5px">
<g:eachError bean="${personInstance}" field="workAddress.code"><g:message error="${it}" /></g:eachError>
</jqvalui:renderError>
</g:if>
@@ -35,29 +35,29 @@
<tr class="prop">
<td valign="top" class="name">
- <label for="workAddress.number"><g:message code="address.number.label" default="Number" /></label>
+ <label for="workAddress.number"><g:message code="workAddress.number.label" default="Work Address Number" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: personInstance?.workAddress, field: 'number', 'errors')}">
<g:textField name="workAddress.number" value="${fieldValue(bean: personInstance?.workAddress, field: 'number')}" />
</td>
<td>
<g:if test="${hasErrors(bean: personInstance, field: 'workAddress.number', 'errors')}">
- <jqvalui:renderError for="workAddress.number" style="margin-left: 5px; margin-top: -21px">
+ <jqvalui:renderError for="workAddress.number" style="margin-top: -5px">
<g:eachError bean="${personInstance}" field="workAddress.number"><g:message error="${it}" /></g:eachError>
</jqvalui:renderError>
</g:if>
</td>
</tr>
<tr class="prop">
<td valign="top" class="name">
- <label for="homeAddress.code"><g:message code="address.code.label" default="Code" /></label>
+ <label for="homeAddress.code"><g:message code="homeAddress.code.label" default="Home Address Code" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: personInstance?.homeAddress, field: 'code', 'errors')}">
<g:textField name="homeAddress.code" value="${personInstance?.homeAddress?.code}" />
</td>
<td>
<g:if test="${hasErrors(bean: personInstance, field: 'homeAddress.code', 'errors')}">
- <jqvalui:renderError for="homeAddress.code" style="margin-left: 5px; margin-top: -21px">
+ <jqvalui:renderError for="homeAddress.code" style="margin-top: -5px">
<g:eachError bean="${personInstance}" field="homeAddress.code"><g:message error="${it}" /></g:eachError>
</jqvalui:renderError>
</g:if>
@@ -66,14 +66,14 @@
<tr class="prop">
<td valign="top" class="name">
- <label for="homeAddress.number"><g:message code="address.number.label" default="Number" /></label>
+ <label for="homeAddress.number"><g:message code="homeAddress.number.label" default="Home Address Number" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: personInstance?.homeAddress, field: 'number', 'errors')}">
<g:textField name="homeAddress.number" value="${fieldValue(bean: personInstance?.homeAddress, field: 'number')}" />
</td>
<td>
<g:if test="${hasErrors(bean: personInstance, field: 'homeAddress.number', 'errors')}">
- <jqvalui:renderError for="homeAddress.number" style="margin-left: 5px; margin-top: -21px">
+ <jqvalui:renderError for="homeAddress.number" style="margin-top: -5px">
<g:eachError bean="${personInstance}" field="homeAddress.number"><g:message error="${it}" /></g:eachError>
</jqvalui:renderError>
</g:if>
@@ -8,7 +8,7 @@
<g:javascript library="jquery" plugin="jquery"/>
<jqval:resources />
<jqvalui:resources />
- <jqvalui:renderValidationScript for="org.grails.jquery.validation.ui.Person" also="homeAddress, workAddress" form="personForm"/>
+ <jqvalui:renderValidationScript for="org.grails.jquery.validation.ui.Person" also="homeAddress, workAddress" />
</head>
<body>
<div class="nav">
@@ -7,6 +7,10 @@
<meta name="layout" content="main" />
<g:set var="entityName" value="${message(code: 'person.label', default: 'Person')}" />
<title><g:message code="default.edit.label" args="[entityName]" /></title>
+ <g:javascript library="jquery" plugin="jquery"/>
+ <jqval:resources />
+ <jqvalui:resources />
+ <jqvalui:renderValidationScript for="org.grails.jquery.validation.ui.Person" also="homeAddress, workAddress" />
</head>
<body>
<div class="nav">
@@ -27,40 +31,7 @@
<g:form method="post" >
<g:hiddenField name="id" value="${personInstance?.id}" />
<g:hiddenField name="version" value="${personInstance?.version}" />
- <div class="dialog">
- <table>
- <tbody>
-
- <tr class="prop">
- <td valign="top" class="name">
- <label for="homeAddress"><g:message code="person.homeAddress.label" default="Home Address" /></label>
- </td>
- <td valign="top" class="value ${hasErrors(bean: personInstance, field: 'homeAddress', 'errors')}">
-
- </td>
- </tr>
-
- <tr class="prop">
- <td valign="top" class="name">
- <label for="name"><g:message code="person.name.label" default="Name" /></label>
- </td>
- <td valign="top" class="value ${hasErrors(bean: personInstance, field: 'name', 'errors')}">
- <g:textField name="name" value="${personInstance?.name}" />
- </td>
- </tr>
-
- <tr class="prop">
- <td valign="top" class="name">
- <label for="workAddress"><g:message code="person.workAddress.label" default="Work Address" /></label>
- </td>
- <td valign="top" class="value ${hasErrors(bean: personInstance, field: 'workAddress', 'errors')}">
-
- </td>
- </tr>
-
- </tbody>
- </table>
- </div>
+ <g:render template="createAndEdit" />
<div class="buttons">
<span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
<span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
Oops, something went wrong.

0 comments on commit 20031ec

Please sign in to comment.