github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vpage/Args.html.go (about) 1 // Code generated by qtc from "Args.html". DO NOT EDIT. 2 // See https://github.com/valyala/quicktemplate for details. 3 4 // <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 5 6 //line views/vpage/Args.html:2 7 package vpage 8 9 //line views/vpage/Args.html:2 10 import ( 11 "strconv" 12 13 "github.com/kyleu/dbaudit/app" 14 "github.com/kyleu/dbaudit/app/controller/cutil" 15 "github.com/kyleu/dbaudit/views/components/edit" 16 "github.com/kyleu/dbaudit/views/layout" 17 ) 18 19 //line views/vpage/Args.html:11 20 import ( 21 qtio422016 "io" 22 23 qt422016 "github.com/valyala/quicktemplate" 24 ) 25 26 //line views/vpage/Args.html:11 27 var ( 28 _ = qtio422016.Copy 29 _ = qt422016.AcquireByteBuffer 30 ) 31 32 //line views/vpage/Args.html:11 33 type Args struct { 34 layout.Basic 35 URL string 36 Directions string 37 ArgRes *cutil.ArgResults 38 Hidden map[string]string 39 } 40 41 //line views/vpage/Args.html:19 42 func (p *Args) StreamBody(qw422016 *qt422016.Writer, as *app.State, ps *cutil.PageState) { 43 //line views/vpage/Args.html:19 44 qw422016.N().S(` 45 <div class="card"> 46 <h3>`) 47 //line views/vpage/Args.html:21 48 if p.Directions == "" { 49 //line views/vpage/Args.html:21 50 qw422016.N().S(`Enter Data`) 51 //line views/vpage/Args.html:21 52 } else { 53 //line views/vpage/Args.html:21 54 qw422016.E().S(p.Directions) 55 //line views/vpage/Args.html:21 56 } 57 //line views/vpage/Args.html:21 58 qw422016.N().S(`</h3> 59 <form action="`) 60 //line views/vpage/Args.html:22 61 qw422016.E().S(p.URL) 62 //line views/vpage/Args.html:22 63 qw422016.N().S(`" method="get"> 64 `) 65 //line views/vpage/Args.html:23 66 for k, v := range p.Hidden { 67 //line views/vpage/Args.html:23 68 qw422016.N().S(` <input type="hidden" name="`) 69 //line views/vpage/Args.html:24 70 qw422016.E().S(k) 71 //line views/vpage/Args.html:24 72 qw422016.N().S(`" value="`) 73 //line views/vpage/Args.html:24 74 qw422016.E().S(v) 75 //line views/vpage/Args.html:24 76 qw422016.N().S(`" /> 77 `) 78 //line views/vpage/Args.html:25 79 } 80 //line views/vpage/Args.html:25 81 qw422016.N().S(` <div class="overflow full-width"> 82 <table class="mt min-200 expanded"> 83 <tbody> 84 `) 85 //line views/vpage/Args.html:29 86 for _, arg := range p.ArgRes.Args { 87 //line views/vpage/Args.html:31 88 v := p.ArgRes.Values.GetStringOpt(arg.Key) 89 if v == "" { 90 v = arg.Default 91 } 92 title := arg.Title 93 if len(title) > 50 { 94 title = title[:50] + "..." 95 } 96 97 //line views/vpage/Args.html:40 98 switch arg.Type { 99 //line views/vpage/Args.html:41 100 case "bool": 101 //line views/vpage/Args.html:41 102 qw422016.N().S(` `) 103 //line views/vpage/Args.html:42 104 edit.StreamBoolTable(qw422016, arg.Key, title, v == "true", 5, arg.Description) 105 //line views/vpage/Args.html:42 106 qw422016.N().S(` 107 `) 108 //line views/vpage/Args.html:43 109 case "textarea": 110 //line views/vpage/Args.html:43 111 qw422016.N().S(` `) 112 //line views/vpage/Args.html:44 113 edit.StreamTextareaTable(qw422016, arg.Key, "", title, 12, v, 5, arg.Description) 114 //line views/vpage/Args.html:44 115 qw422016.N().S(` 116 `) 117 //line views/vpage/Args.html:45 118 case "number", "int": 119 //line views/vpage/Args.html:46 120 i, _ := strconv.ParseInt(v, 10, 32) 121 122 //line views/vpage/Args.html:46 123 qw422016.N().S(` `) 124 //line views/vpage/Args.html:47 125 edit.StreamIntTable(qw422016, arg.Key, "", title, int(i), 5, arg.Description) 126 //line views/vpage/Args.html:47 127 qw422016.N().S(` 128 `) 129 //line views/vpage/Args.html:48 130 default: 131 //line views/vpage/Args.html:48 132 qw422016.N().S(` `) 133 //line views/vpage/Args.html:49 134 edit.StreamDatalistTable(qw422016, arg.Key, "", title, v, arg.Choices, nil, 5, arg.Description) 135 //line views/vpage/Args.html:49 136 qw422016.N().S(` 137 `) 138 //line views/vpage/Args.html:50 139 } 140 //line views/vpage/Args.html:51 141 } 142 //line views/vpage/Args.html:51 143 qw422016.N().S(` </tbody> 144 </table> 145 </div> 146 <button class="mt" type="submit">Submit</button> 147 </form> 148 </div> 149 `) 150 //line views/vpage/Args.html:58 151 } 152 153 //line views/vpage/Args.html:58 154 func (p *Args) WriteBody(qq422016 qtio422016.Writer, as *app.State, ps *cutil.PageState) { 155 //line views/vpage/Args.html:58 156 qw422016 := qt422016.AcquireWriter(qq422016) 157 //line views/vpage/Args.html:58 158 p.StreamBody(qw422016, as, ps) 159 //line views/vpage/Args.html:58 160 qt422016.ReleaseWriter(qw422016) 161 //line views/vpage/Args.html:58 162 } 163 164 //line views/vpage/Args.html:58 165 func (p *Args) Body(as *app.State, ps *cutil.PageState) string { 166 //line views/vpage/Args.html:58 167 qb422016 := qt422016.AcquireByteBuffer() 168 //line views/vpage/Args.html:58 169 p.WriteBody(qb422016, as, ps) 170 //line views/vpage/Args.html:58 171 qs422016 := string(qb422016.B) 172 //line views/vpage/Args.html:58 173 qt422016.ReleaseByteBuffer(qb422016) 174 //line views/vpage/Args.html:58 175 return qs422016 176 //line views/vpage/Args.html:58 177 }