Skip to content

Commit

Permalink
Use Bootstrap layout for scaffolding default templates (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan authored Feb 24, 2022
1 parent 1aa7290 commit da617c6
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 92 deletions.
62 changes: 35 additions & 27 deletions src/main/templates/scaffolding/create.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,41 @@
<title><g:message code="default.create.label" args="[entityName]" /></title>
</head>
<body>
<a href="#create-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
</ul>
</div>
<div id="create-${propertyName}" class="content scaffold-create" role="main">
<h1><g:message code="default.create.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<g:hasErrors bean="\${this.${propertyName}}">
<ul class="errors" role="alert">
<g:eachError bean="\${this.${propertyName}}" var="error">
<li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>><g:message error="\${error}"/></li>
</g:eachError>
</ul>
</g:hasErrors>
<g:form resource="\${this.${propertyName}}" method="POST">
<fieldset class="form">
<f:all bean="${propertyName}"/>
</fieldset>
<fieldset class="buttons">
<g:submitButton name="create" class="save" value="\${message(code: 'default.button.create.label', default: 'Create')}" />
</fieldset>
</g:form>
<div id="content" role="main">
<div class="container">
<section class="row">
<a href="#create-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
</ul>
</div>
</section>
<section class="row">
<div id="create-${propertyName}" class="col-12 content scaffold-create" role="main">
<h1><g:message code="default.create.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<g:hasErrors bean="\${this.${propertyName}}">
<ul class="errors" role="alert">
<g:eachError bean="\${this.${propertyName}}" var="error">
<li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>><g:message error="\${error}"/></li>
</g:eachError>
</ul>
</g:hasErrors>
<g:form resource="\${this.${propertyName}}" method="POST">
<fieldset class="form">
<f:all bean="${propertyName}"/>
</fieldset>
<fieldset class="buttons">
<g:submitButton name="create" class="save" value="\${message(code: 'default.button.create.label', default: 'Create')}" />
</fieldset>
</g:form>
</div>
</section>
</div>
</div>
</body>
</html>
66 changes: 37 additions & 29 deletions src/main/templates/scaffolding/edit.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,43 @@
<title><g:message code="default.edit.label" args="[entityName]" /></title>
</head>
<body>
<a href="#edit-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
<div id="edit-${propertyName}" class="content scaffold-edit" role="main">
<h1><g:message code="default.edit.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<g:hasErrors bean="\${this.${propertyName}}">
<ul class="errors" role="alert">
<g:eachError bean="\${this.${propertyName}}" var="error">
<li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>><g:message error="\${error}"/></li>
</g:eachError>
</ul>
</g:hasErrors>
<g:form resource="\${this.${propertyName}}" method="PUT">
<g:hiddenField name="version" value="\${this.${propertyName}?.version}" />
<fieldset class="form">
<f:all bean="${propertyName}"/>
</fieldset>
<fieldset class="buttons">
<input class="save" type="submit" value="\${message(code: 'default.button.update.label', default: 'Update')}" />
</fieldset>
</g:form>
<div id="content" role="main">
<div class="container">
<section class="row">
<a href="#edit-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
</section>
<section class="row">
<div id="edit-${propertyName}" class="col-12 content scaffold-edit" role="main">
<h1><g:message code="default.edit.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<g:hasErrors bean="\${this.${propertyName}}">
<ul class="errors" role="alert">
<g:eachError bean="\${this.${propertyName}}" var="error">
<li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>><g:message error="\${error}"/></li>
</g:eachError>
</ul>
</g:hasErrors>
<g:form resource="\${this.${propertyName}}" method="PUT">
<g:hiddenField name="version" value="\${this.${propertyName}?.version}" />
<fieldset class="form">
<f:all bean="${propertyName}"/>
</fieldset>
<fieldset class="buttons">
<input class="save" type="submit" value="\${message(code: 'default.button.update.label', default: 'Update')}" />
</fieldset>
</g:form>
</div>
</section>
</div>
</div>
</body>
</html>
42 changes: 26 additions & 16 deletions src/main/templates/scaffolding/index.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,33 @@
<title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
<a href="#list-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
<div id="list-${propertyName}" class="content scaffold-list" role="main">
<h1><g:message code="default.list.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<f:table collection="\${${propertyName}List}" />
<div id="content" role="main">
<div class="container">
<section class="row">
<a href="#list-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
</section>
<section class="row">
<div id="list-${propertyName}" class="col-12 content scaffold-list" role="main">
<h1><g:message code="default.list.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<f:table collection="\${${propertyName}List}" />

<div class="pagination">
<g:paginate total="\${${propertyName}Count ?: 0}" />
</div>
<g:if test="\${${propertyName}Count > params.int('max')}">
<div class="pagination">
<g:paginate total="\${${propertyName}Count ?: 0}" />
</div>
</g:if>
</div>
</section>
</div>
</div>
</body>
</html>
48 changes: 28 additions & 20 deletions src/main/templates/scaffolding/show.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,34 @@
<title><g:message code="default.show.label" args="[entityName]" /></title>
</head>
<body>
<a href="#show-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
<div id="show-${propertyName}" class="content scaffold-show" role="main">
<h1><g:message code="default.show.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<f:display bean="${propertyName}" />
<g:form resource="\${this.${propertyName}}" method="DELETE">
<fieldset class="buttons">
<g:link class="edit" action="edit" resource="\${this.${propertyName}}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
<input class="delete" type="submit" value="\${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('\${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
</fieldset>
</g:form>
<div id="content" role="main">
<div class="container">
<section class="row">
<a href="#show-${propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
</section>
<section class="row">
<div id="show-${propertyName}" class="col-12 content scaffold-show" role="main">
<h1><g:message code="default.show.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<f:display bean="${propertyName}" />
<g:form resource="\${this.${propertyName}}" method="DELETE">
<fieldset class="buttons">
<g:link class="edit" action="edit" resource="\${this.${propertyName}}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
<input class="delete" type="submit" value="\${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('\${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
</fieldset>
</g:form>
</div>
</section>
</div>
</div>
</body>
</html>

0 comments on commit da617c6

Please sign in to comment.