Skip to content
This repository has been archived by the owner on Oct 31, 2018. It is now read-only.

grails-2.3.0 and bootstrap 3.0. #50

Open
ghost opened this issue Oct 4, 2013 · 4 comments
Open

grails-2.3.0 and bootstrap 3.0. #50

ghost opened this issue Oct 4, 2013 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 4, 2013

When the upgrade to grails 2.3.0 and bootstrap 3.0?
Thank you.

@joergrech
Copy link
Owner

Hi,
I just updated to Bootstrap 3.0.2 but the upgrade to Grails 2.3 will take
a while.

Best regards,
Joerg

2013/10/4 Mauro [email protected]

When the upgrade to grails 2.3.0 and bootstrap 3.0?
Thank you.


Reply to this email directly or view it on GitHubhttps://github.com//issues/50
.

Dr. Jörg Rech
Freelancer
Web | Mobile | Cloud | Agile
Kriegsstr. 164
76133 Karlsruhe, Germany

I'm a software engineer from Germany working as a freelancer in the IT
sector and interested in the startup scene, building lean startups,
developing new interesting software, and conducting empirical research. My
expertise focusses on the topics Web, Mobile, Cloud, and Agile. More
information can be found at:

Web: http://www.joerg-rech.com
Twitter: http://twitter.com/joergrech
Xing: http://www.xing.com/profile/Joerg_Rech/
LinkedIn: http://www.linkedin.com/in/joergrech

@zorrme
Copy link

zorrme commented Nov 18, 2013

Joerg,

Please use the inlined _form.gsp, after I update this file views are generated normally.

<%=packageName%>
<% import grails.persistence.Event %>

<% excludedProps = Event.allEvents.toList() << 'version' << 'dateCreated' << 'lastUpdated'
persistentPropNames = domainClass.persistentProperties_.name
boolean hasHibernate = pluginManager?.hasGrailsPlugin('hibernate') || pluginManager?.hasGrailsPlugin('hibernate4')
if (hasHibernate) {
def GrailsDomainBinder = getClass().classLoader.loadClass('org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder')
if (GrailsDomainBinder.newInstance().getMapping(domainClass)?.identity?.generator == 'assigned') {
persistentPropNames << domainClass.identifier.name
}
}
props = domainClass.properties.findAll { persistentPropNames.contains(it.name) && !excludedProps.contains(it.name) }
Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
for (p in props) {
if (p.embedded) {
def embeddedPropNames = p.component.persistentProperties_.name
def embeddedProps = p.component.properties.findAll { embeddedPropNames.contains(it.name) && !excludedProps.contains(it.name) }
Collections.sort(embeddedProps, comparator.constructors[0].newInstance([p.component] as Object[]))
%>

<g:message code="${domainClass.propertyName}.${p.name}.label" default="${p.naturalName}" /><%
for (ep in p.component.properties) {
renderFieldForProperty(ep, p.component, "${p.name}.")
}
%><%
} else {
renderFieldForProperty(p, domainClass)
}
}

private renderFieldForProperty(p, owningClass, prefix = "") {
boolean hasHibernate = pluginManager?.hasGrailsPlugin('hibernate')
boolean display = true
boolean required = false
if (hasHibernate) {
cp = owningClass.constrainedProperties[p.name]
display = (cp ? cp.display : true)
required = (cp ? !(cp.propertyType in [boolean, Boolean]) && !cp.nullable && (cp.propertyType != String || !cp.blank) : false)
}
if (display) { %>


<g:message code="${domainClass.propertyName}.${prefix}${p.name}.label" default="${p.naturalName}" /><% if (required) { %>*<% } %>

${renderEditor(p)}
${hasErrors(bean: ${propertyName}, field: '${p.name}', 'error')}


<% } } %>

@zorrme
Copy link

zorrme commented Nov 18, 2013

Sorry if the previous post is not very clear, this is the diff for _form.gsp

  • boolean hasHibernate = pluginManager?.hasGrailsPlugin('hibernate')
  • if (hasHibernate && org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.getMapping(domainClass)?.identity?.generator == 'assigned') {
  •   persistentPropNames << domainClass.identifier.name
    
  • }
  • boolean hasHibernate = pluginManager?.hasGrailsPlugin('hibernate') || pluginManager?.hasGrailsPlugin('hibernate4')
  •    if (hasHibernate) { 
    
  •            def GrailsDomainBinder = getClass().classLoader.loadClass('org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder') 
    
  •            if (GrailsDomainBinder.newInstance().getMapping(domainClass)?.identity?.generator == 'assigned') { 
    
  •                    persistentPropNames << domainClass.identifier.name 
    
  •            } 
    
  •    } 
    

@joergrech
Copy link
Owner

I just released version 1.1.0 with the scaffolding temples in the plugin's zip file. Scaffolding does work now. I'm not sure about hibernate changes - might these not conflict with project not using hibernate (e.g., using mongodb)? Please test and tell if you still have a problem that requires your fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants