1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| {% import ( "{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/app/lib/audit" "{{{ .Package }}}/app/util" "{{{ .Package }}}/views/components" "{{{ .Package }}}/views/layout" ) %}
{% code type Edit struct { layout.Basic Model *audit.Audit IsNew bool } %}
{% func (p *Edit) Body(as *app.State, ps *cutil.PageState) %} <div class="card"> {%- if p.IsNew -%} <div class="right"><a href="/admin/audit/random"><button>Random</button></a></div> <h3>{%= components.SVGRefIcon(`cog`, ps) %} New Audit</h3> <form action="/admin/audit/new" class="mt" method="post"> {%- else -%} <div class="right"><a href="{%s p.Model.WebPath() %}/delete" onclick="return confirm('Are you sure you wish to delete audit [{%s p.Model.String() %}]?')"><button>Delete</button></a></div> <h3>{%= components.SVGRefIcon(`cog`, ps) %} Edit Audit [{%s p.Model.String() %}]</h3> <form action="" class="mt" method="post"> {%- endif -%} <div class="overflow full-width"> <table class="mt expanded"> <tbody> {% if p.IsNew %}{%= components.TableInput("id", "", "ID", p.Model.ID.String(), 5, "UUID in format (00000000-0000-0000-0000-000000000000)") %}{% endif %} {%= components.TableInput("app", "", "App", p.Model.App, 5, "String text") %} {%= components.TableInput("act", "", "Act", p.Model.Act, 5, "String text") %} {%= components.TableInput("client", "", "Client", p.Model.Client, 5, "String text") %} {%= components.TableInput("server", "", "Server", p.Model.Server, 5, "String text") %} {%= components.TableInput("user", "", "User", p.Model.User, 5, "String text") %} {%= components.TableTextarea("metadata", "", "Metadata", 8, util.ToJSON(p.Model.Metadata), 5, "JSON object") %} {%= components.TableInput("message", "", "Message", p.Model.Message, 5, "String text") %} {%= components.TableInputTimestamp("started", "", "Started", &p.Model.Started, 5, "Date and time, in almost any format") %} {%= components.TableInputTimestamp("completed", "", "Completed", &p.Model.Completed, 5, "Date and time, in almost any format") %} <tr><td colspan="2"><button type="submit">Save Changes</button></td></tr> </tbody> </table> </div> </form> </div> {% endfunc %}
|