This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from as27/htmltemplates
htmltemplates
- Loading branch information
Showing
7 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
generators/resource/templates/templates/model-view-_errors.html.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<%= if (verrs) { %> | ||
<div class="errors"> | ||
<ul> | ||
<%= for (k, v) in verrs { %> | ||
<li><%= v %></li> | ||
<% } %> | ||
</ul> | ||
</div> | ||
<% } %> |
11 changes: 10 additions & 1 deletion
11
generators/resource/templates/templates/model-view-_form.html.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
<h2>{{.camel}}#Form</h2> | ||
{{ range $p := .modelProps }} | ||
<div> | ||
<label for="{{$p}}">{{$p}}:</label> | ||
<input type="text" name="{{$p}}" id="{{$p}}" value="<%= {{$.varSingular}}.{{$p}} %>" /> | ||
</div> | ||
{{ end }} | ||
|
||
<div> | ||
<input type="submit" value="Save" /> | ||
</div> |
9 changes: 8 additions & 1 deletion
9
generators/resource/templates/templates/model-view-edit.html.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
<h1>{{.camel}}#Edit</h1> | ||
<h1>Edit {{.model}}</h1> | ||
|
||
<%= partial("{{.modelPluralUnder}}/errors.html") %> | ||
|
||
<form action="/{{.under}}/<%= {{.varSingular}}.ID" method="POST" accept-charset="utf-8"> | ||
<input type="hidden" name="_method" id="_method" value="PUT" /> | ||
<%= partial("{{.modelPluralUnder}}/form.html") %> | ||
</form> |
29 changes: 28 additions & 1 deletion
29
generators/resource/templates/templates/model-view-index.html.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
<h1>{{.camel}}#Index</h1> | ||
|
||
<h1>{{.modelPlural}}</h1> | ||
|
||
<p> | ||
<a href="/{{.plural}}/new">Create New {{.model}}</a> | ||
</p> | ||
|
||
<table> | ||
<thead> | ||
{{ range $p := .modelProps }} | ||
<th>{{ $p }}</th> | ||
{{ end }} | ||
</thead> | ||
<tbody> | ||
<%= for ({{.varSingular}}) in {{.varPlural}} { %> | ||
<tr> | ||
{{ range $mp := .modelProps }} | ||
<td><%= {{$.varSingular}}.{{$mp}} %></td> | ||
{{ end }} | ||
<td> | ||
<a href="/{{$.plural}}/<%= {{$.varSingular}}.ID %>">View</a> | ||
<a href="/{{$.plural}}/<%= {{$.varSingular}}.ID %>/edit">Edit</a> | ||
<a href="/{{$.plural}}/<%= {{$.varSingular}}.ID %>" data-method="DELETE" data-confirm="Are you sure?">Destroy</a> | ||
</td> | ||
</tr> | ||
<% } %> | ||
</tbody> | ||
</table> |
6 changes: 5 additions & 1 deletion
6
generators/resource/templates/templates/model-view-new.html.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
<h1>{{.camel}}#New</h1> | ||
<h1>New {{.model}}</h1> | ||
|
||
<%= partial("{{.modelPluralUnder}}/errors.html") %> | ||
<form action="/{{.under}}" method="POST" accept-charset="utf-8"> | ||
<%= partial("{{.modelPluralUnder}}/form.html") %> | ||
</form> |
14 changes: 13 additions & 1 deletion
14
generators/resource/templates/templates/model-view-show.html.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
<h1>{{.camel}}#Show</h1> | ||
<h1>{{.camel}}#Show</h1> | ||
{{ range $p := .modelProps }} | ||
<div> | ||
{{ $p }}: <%= {{$.varSingular}}.{{$p}} %> | ||
|
||
</div> | ||
{{ end }} | ||
|
||
<ul> | ||
<li><a href="/{{$.plural}}">Back to all {{.modelPlural}}</a></li> | ||
<li><a href="/{{$.plural}}/<%= {{$.varSingular}}.ID %>/edit">Edit</a></li> | ||
<li><a href="/{{$.plural}}/<%= {{$.varSingular}}.ID %>" data-method="DELETE" data-confirm="Are you sure?">Destroy</a> | ||
</ul> |