Skip to content

Commit

Permalink
Update scaffolding templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jan 16, 2024
1 parent e66e547 commit 410bbf1
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 92 deletions.
77 changes: 50 additions & 27 deletions grace-plugin-scaffolding/src/main/templates/scaffolding/create.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,56 @@
<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="col-12" role="navigation">
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="\${createLink(uri: '/')}">
<i class="bi bi-house-fill"></i><g:message code="default.home.label"/>
</a>
</li>
<li class="nav-item">
<g:link class="nav-link" action="index">
<i class="bi bi-journals"></i><g:message code="default.list.label" args="[entityName]" />
</g:link>
</li>
</ul>
</div>
</section>
<section class="row">
<div id="create-${propertyName}" class="col-12 scaffold scaffold-create" role="main">
<h1><g:message code="default.create.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="alert alert-success" role="status"><i class="bi bi-info-circle">\${flash.message}</div>
</g:if>
<g:hasErrors bean="\${this.${propertyName}}">
<div class="alert alert-danger" role="alert">
<ul class="errors">
<g:eachError bean="\${this.${propertyName}}" var="error">
<li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>>
<i class="bi bi-exclamation-circle"></i><g:message error="\${error}"/>
</li>
</g:eachError>
</ul>
</div>
</g:hasErrors>
<g:form resource="\${this.${propertyName}}" method="POST">
<fieldset class="form">
<f:all bean="${propertyName}"/>
</fieldset>
<fieldset class="buttons offset-3">
<button name="create" class="btn btn-primary">
<i class="bi bi-journal-plus"></i>
<g:message code="default.button.create.label" default="Create" />
</button>
</fieldset>
</g:form>
</div>
</section>
</div>
</div>
</body>
</html>
84 changes: 55 additions & 29 deletions grace-plugin-scaffolding/src/main/templates/scaffolding/edit.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,61 @@
<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="col-12" role="navigation">
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="\${createLink(uri: '/')}">
<i class="bi bi-house-fill"></i><g:message code="default.home.label"/>
</a>
</li>
<li class="nav-item">
<g:link class="nav-link" action="index">
<i class="bi bi-journals"></i><g:message code="default.list.label" args="[entityName]" />
</g:link>
</li>
<li class="nav-item">
<g:link class="nav-link" action="create">
<i class="bi bi-journal-plus"></i><g:message code="default.new.label" args="[entityName]" />
</g:link>
</li>
</ul>
</div>
</section>
<section class="row">
<div id="edit-${propertyName}" class="col-12 scaffold scaffold-edit" role="main">
<h1><g:message code="default.edit.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="alert alert-success" role="status"><i class="bi bi-info-circle"></i>\${flash.message}</div>
</g:if>
<g:hasErrors bean="\${this.${propertyName}}">
<div class="alert alert-danger" role="alert">
<ul class="errors">
<g:eachError bean="\${this.${propertyName}}" var="error">
<li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>>
<i class="bi bi-exclamation-circle"></i><g:message error="\${error}"/>
</li>
</g:eachError>
</ul>
</div>
</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 offset-3">
<button class="btn btn-primary">
<i class="bi bi-journal-check"></i><g:message code="default.button.update.label" default="Update" />
</button>
</fieldset>
</g:form>
</div>
</section>
</div>
</div>
</body>
</html>
50 changes: 34 additions & 16 deletions grace-plugin-scaffolding/src/main/templates/scaffolding/index.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,41 @@
<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="col-12" role="navigation">
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="\${createLink(uri: '/')}">
<i class="bi bi-house-fill"></i><g:message code="default.home.label"/>
</a>
</li>
<li class="nav-item">
<g:link class="nav-link" action="create">
<i class="bi bi-journal-plus"></i><g:message code="default.new.label" args="[entityName]" />
</g:link>
</li>
</ul>
</div>
</section>
<section class="row">
<div id="list-${propertyName}" class="col-12 scaffold scaffold-list" role="main">
<h1><g:message code="default.list.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="alert alert-success" role="status"><i class="bi bi-info-circle"></i>\${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')}">
<nav aria-label="Page navigation">
<bs:paginate total="\${${propertyName}Count ?: 0}" useIcons="true" align="center" />
</nav>
</g:if>
</div>
</section>
</div>
</div>
</body>
</html>
64 changes: 44 additions & 20 deletions grace-plugin-scaffolding/src/main/templates/scaffolding/show.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,50 @@
<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="col-12" role="navigation">
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="\${createLink(uri: '/')}">
<i class="bi bi-house-fill"></i><g:message code="default.home.label"/>
</a>
</li>
<li class="nav-item">
<g:link class="nav-link" action="index">
<i class="bi bi-journals"></i><g:message code="default.list.label" args="[entityName]" />
</g:link>
</li>
<li class="nav-item">
<g:link class="nav-link" action="create">
<i class="bi bi-journal-plus"></i><g:message code="default.new.label" args="[entityName]" />
</g:link>
</li>
</ul>
</div>
</section>
<section class="row">
<div id="show-${propertyName}" class="col-12 scaffold scaffold-show" role="main">
<h1><g:message code="default.show.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="alert alert-success" role="status"><i class="bi bi-info-circle"></i>\${flash.message}</div>
</g:if>
<f:display bean="${propertyName}" />
<g:form resource="\${this.${propertyName}}" method="DELETE">
<fieldset class="buttons offset-3">
<g:link class="btn btn-primary" action="edit" resource="\${this.${propertyName}}">
<i class="bi bi-journal-text"></i><g:message code="default.button.edit.label" default="Edit" />
</g:link>
<button class="btn btn-danger" onclick="return confirm('\${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
<i class="bi bi-journal-x"></i><g:message code="default.button.delete.label" default="Delete" />
</button>
</fieldset>
</g:form>
</div>
</section>
</div>
</div>
</body>
</html>

0 comments on commit 410bbf1

Please sign in to comment.