github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/layout/Menu.html.go (about) 1 // Code generated by qtc from "Menu.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/layout/Menu.html:2 7 package layout 8 9 //line views/layout/Menu.html:2 10 import ( 11 "strings" 12 13 "github.com/kyleu/dbaudit/app/controller/cmenu" 14 "github.com/kyleu/dbaudit/app/controller/cutil" 15 "github.com/kyleu/dbaudit/app/lib/menu" 16 "github.com/kyleu/dbaudit/views/components" 17 ) 18 19 //line views/layout/Menu.html:11 20 import ( 21 qtio422016 "io" 22 23 qt422016 "github.com/valyala/quicktemplate" 24 ) 25 26 //line views/layout/Menu.html:11 27 var ( 28 _ = qtio422016.Copy 29 _ = qt422016.AcquireByteBuffer 30 ) 31 32 //line views/layout/Menu.html:11 33 func StreamMenu(qw422016 *qt422016.Writer, ps *cutil.PageState) { 34 //line views/layout/Menu.html:12 35 if len(ps.Menu) > 0 { 36 //line views/layout/Menu.html:12 37 qw422016.N().S(`<div class="menu-container">`) 38 //line views/layout/Menu.html:14 39 components.StreamIndent(qw422016, true, 2) 40 //line views/layout/Menu.html:14 41 qw422016.N().S(`<div class="menu">`) 42 //line views/layout/Menu.html:16 43 components.StreamIndent(qw422016, true, 3) 44 //line views/layout/Menu.html:16 45 qw422016.N().S(`<menu class="level-0">`) 46 //line views/layout/Menu.html:18 47 for _, i := range ps.Menu { 48 //line views/layout/Menu.html:19 49 StreamMenuItem(qw422016, i, []string{}, ps.Breadcrumbs, 3, ps) 50 //line views/layout/Menu.html:20 51 } 52 //line views/layout/Menu.html:21 53 components.StreamIndent(qw422016, true, 3) 54 //line views/layout/Menu.html:21 55 qw422016.N().S(`</menu>`) 56 //line views/layout/Menu.html:23 57 components.StreamIndent(qw422016, true, 2) 58 //line views/layout/Menu.html:23 59 qw422016.N().S(`</div>`) 60 //line views/layout/Menu.html:25 61 components.StreamIndent(qw422016, true, 1) 62 //line views/layout/Menu.html:25 63 qw422016.N().S(`</div>`) 64 //line views/layout/Menu.html:27 65 } 66 //line views/layout/Menu.html:28 67 } 68 69 //line views/layout/Menu.html:28 70 func WriteMenu(qq422016 qtio422016.Writer, ps *cutil.PageState) { 71 //line views/layout/Menu.html:28 72 qw422016 := qt422016.AcquireWriter(qq422016) 73 //line views/layout/Menu.html:28 74 StreamMenu(qw422016, ps) 75 //line views/layout/Menu.html:28 76 qt422016.ReleaseWriter(qw422016) 77 //line views/layout/Menu.html:28 78 } 79 80 //line views/layout/Menu.html:28 81 func Menu(ps *cutil.PageState) string { 82 //line views/layout/Menu.html:28 83 qb422016 := qt422016.AcquireByteBuffer() 84 //line views/layout/Menu.html:28 85 WriteMenu(qb422016, ps) 86 //line views/layout/Menu.html:28 87 qs422016 := string(qb422016.B) 88 //line views/layout/Menu.html:28 89 qt422016.ReleaseByteBuffer(qb422016) 90 //line views/layout/Menu.html:28 91 return qs422016 92 //line views/layout/Menu.html:28 93 } 94 95 //line views/layout/Menu.html:30 96 func StreamMenuItem(qw422016 *qt422016.Writer, i *menu.Item, path []string, breadcrumbs cmenu.Breadcrumbs, indent int, ps *cutil.PageState) { 97 //line views/layout/Menu.html:32 98 path = append(path, i.Key) 99 active, final := breadcrumbs.Active(i, path) 100 101 //line views/layout/Menu.html:35 102 if i.Key == "" { 103 //line views/layout/Menu.html:36 104 components.StreamIndent(qw422016, true, indent+1) 105 //line views/layout/Menu.html:36 106 qw422016.N().S(`<li class="separator"></li>`) 107 //line views/layout/Menu.html:38 108 } else if len(i.Children) > 0 { 109 //line views/layout/Menu.html:39 110 itemID := strings.Join(path, "--") 111 112 //line views/layout/Menu.html:40 113 components.StreamIndent(qw422016, true, indent+1) 114 //line views/layout/Menu.html:41 115 if active { 116 //line views/layout/Menu.html:41 117 qw422016.N().S(`<li class="active" data-menu-key="`) 118 //line views/layout/Menu.html:41 119 qw422016.E().S(i.Key) 120 //line views/layout/Menu.html:41 121 qw422016.N().S(`">`) 122 //line views/layout/Menu.html:41 123 } else { 124 //line views/layout/Menu.html:41 125 qw422016.N().S(`<li data-menu-key="`) 126 //line views/layout/Menu.html:41 127 qw422016.E().S(i.Key) 128 //line views/layout/Menu.html:41 129 qw422016.N().S(`">`) 130 //line views/layout/Menu.html:41 131 } 132 //line views/layout/Menu.html:42 133 components.StreamIndent(qw422016, true, indent+2) 134 //line views/layout/Menu.html:42 135 qw422016.N().S(`<input id="`) 136 //line views/layout/Menu.html:43 137 qw422016.E().S(itemID) 138 //line views/layout/Menu.html:43 139 qw422016.N().S(`-input" type="checkbox"`) 140 //line views/layout/Menu.html:43 141 if active { 142 //line views/layout/Menu.html:43 143 qw422016.N().S(` `) 144 //line views/layout/Menu.html:43 145 qw422016.N().S(`checked="checked"`) 146 //line views/layout/Menu.html:43 147 } 148 //line views/layout/Menu.html:43 149 qw422016.N().S(` `) 150 //line views/layout/Menu.html:43 151 qw422016.N().S(`hidden="hidden" />`) 152 //line views/layout/Menu.html:44 153 components.StreamIndent(qw422016, true, indent+2) 154 //line views/layout/Menu.html:45 155 if final { 156 //line views/layout/Menu.html:45 157 qw422016.N().S(`<label class="final" for="`) 158 //line views/layout/Menu.html:45 159 qw422016.E().S(itemID) 160 //line views/layout/Menu.html:45 161 qw422016.N().S(`-input" title="`) 162 //line views/layout/Menu.html:45 163 qw422016.E().S(i.Desc()) 164 //line views/layout/Menu.html:45 165 qw422016.N().S(`">`) 166 //line views/layout/Menu.html:45 167 } else { 168 //line views/layout/Menu.html:45 169 qw422016.N().S(`<label for="`) 170 //line views/layout/Menu.html:45 171 qw422016.E().S(itemID) 172 //line views/layout/Menu.html:45 173 qw422016.N().S(`-input" title="`) 174 //line views/layout/Menu.html:45 175 qw422016.E().S(i.Desc()) 176 //line views/layout/Menu.html:45 177 qw422016.N().S(`">`) 178 //line views/layout/Menu.html:45 179 } 180 //line views/layout/Menu.html:46 181 if i.Route != "" { 182 //line views/layout/Menu.html:47 183 components.StreamIndent(qw422016, true, indent+3) 184 //line views/layout/Menu.html:47 185 qw422016.N().S(`<a class="label-link" href="`) 186 //line views/layout/Menu.html:48 187 qw422016.E().S(i.Route) 188 //line views/layout/Menu.html:48 189 qw422016.N().S(`">`) 190 //line views/layout/Menu.html:48 191 components.StreamSVGRef(qw422016, `link`, 15, 15, ``, ps) 192 //line views/layout/Menu.html:48 193 qw422016.N().S(`</a>`) 194 //line views/layout/Menu.html:49 195 } 196 //line views/layout/Menu.html:50 197 components.StreamExpandCollapse(qw422016, indent+3, ps) 198 //line views/layout/Menu.html:51 199 if i.Badge != "" { 200 //line views/layout/Menu.html:52 201 components.StreamIndent(qw422016, true, indent+3) 202 //line views/layout/Menu.html:52 203 qw422016.N().S(`<div class="badge">`) 204 //line views/layout/Menu.html:53 205 qw422016.E().S(i.Badge) 206 //line views/layout/Menu.html:53 207 qw422016.N().S(`</div>`) 208 //line views/layout/Menu.html:54 209 } 210 //line views/layout/Menu.html:55 211 components.StreamIndent(qw422016, true, indent+3) 212 //line views/layout/Menu.html:56 213 if i.Icon != "" { 214 //line views/layout/Menu.html:57 215 components.StreamSVGRef(qw422016, i.Icon, 16, 16, "icon", ps) 216 //line views/layout/Menu.html:58 217 } 218 //line views/layout/Menu.html:59 219 if i.Route != "" { 220 //line views/layout/Menu.html:60 221 if i.Warning != "" { 222 //line views/layout/Menu.html:60 223 qw422016.N().S(`<a class="link-confirm" data-message="`) 224 //line views/layout/Menu.html:61 225 qw422016.E().S(i.Warning) 226 //line views/layout/Menu.html:61 227 qw422016.N().S(`" href="`) 228 //line views/layout/Menu.html:61 229 qw422016.E().S(i.Route) 230 //line views/layout/Menu.html:61 231 qw422016.N().S(`">`) 232 //line views/layout/Menu.html:61 233 qw422016.E().S(i.Title) 234 //line views/layout/Menu.html:61 235 qw422016.N().S(`</a>`) 236 //line views/layout/Menu.html:62 237 } else { 238 //line views/layout/Menu.html:62 239 qw422016.N().S(`<a href="`) 240 //line views/layout/Menu.html:63 241 qw422016.E().S(i.Route) 242 //line views/layout/Menu.html:63 243 qw422016.N().S(`">`) 244 //line views/layout/Menu.html:63 245 qw422016.E().S(i.Title) 246 //line views/layout/Menu.html:63 247 qw422016.N().S(`</a>`) 248 //line views/layout/Menu.html:64 249 } 250 //line views/layout/Menu.html:65 251 } else { 252 //line views/layout/Menu.html:66 253 qw422016.E().S(i.Title) 254 //line views/layout/Menu.html:67 255 } 256 //line views/layout/Menu.html:68 257 components.StreamIndent(qw422016, true, indent+2) 258 //line views/layout/Menu.html:68 259 qw422016.N().S(`</label>`) 260 //line views/layout/Menu.html:70 261 components.StreamIndent(qw422016, true, indent+2) 262 //line views/layout/Menu.html:70 263 qw422016.N().S(`<div class="menu-content level-`) 264 //line views/layout/Menu.html:71 265 qw422016.N().D(len(path)) 266 //line views/layout/Menu.html:71 267 qw422016.N().S(`">`) 268 //line views/layout/Menu.html:72 269 components.StreamIndent(qw422016, true, indent+3) 270 //line views/layout/Menu.html:72 271 qw422016.N().S(`<menu>`) 272 //line views/layout/Menu.html:74 273 for _, i := range i.Children { 274 //line views/layout/Menu.html:75 275 StreamMenuItem(qw422016, i, path, breadcrumbs, indent+3, ps) 276 //line views/layout/Menu.html:76 277 } 278 //line views/layout/Menu.html:77 279 components.StreamIndent(qw422016, true, indent+3) 280 //line views/layout/Menu.html:77 281 qw422016.N().S(`</menu>`) 282 //line views/layout/Menu.html:79 283 components.StreamIndent(qw422016, true, indent+2) 284 //line views/layout/Menu.html:79 285 qw422016.N().S(`</div>`) 286 //line views/layout/Menu.html:81 287 components.StreamIndent(qw422016, true, indent+1) 288 //line views/layout/Menu.html:81 289 qw422016.N().S(`</li>`) 290 //line views/layout/Menu.html:83 291 } else { 292 //line views/layout/Menu.html:85 293 finalClass := "item" 294 if active { 295 finalClass += " active" 296 } 297 if final { 298 finalClass += " final" 299 } 300 if i.Warning != "" { 301 finalClass += " link-confirm" 302 } 303 304 //line views/layout/Menu.html:96 305 components.StreamIndent(qw422016, true, indent+1) 306 //line views/layout/Menu.html:96 307 qw422016.N().S(`<li data-menu-key="`) 308 //line views/layout/Menu.html:97 309 qw422016.E().S(i.Key) 310 //line views/layout/Menu.html:97 311 qw422016.N().S(`">`) 312 //line views/layout/Menu.html:98 313 if i.Warning != "" { 314 //line views/layout/Menu.html:98 315 qw422016.N().S(`<a class="`) 316 //line views/layout/Menu.html:99 317 qw422016.E().S(finalClass) 318 //line views/layout/Menu.html:99 319 qw422016.N().S(`" data-message="`) 320 //line views/layout/Menu.html:99 321 qw422016.E().S(i.Warning) 322 //line views/layout/Menu.html:99 323 qw422016.N().S(`" href="`) 324 //line views/layout/Menu.html:99 325 qw422016.E().S(i.Route) 326 //line views/layout/Menu.html:99 327 qw422016.N().S(`" title="`) 328 //line views/layout/Menu.html:99 329 qw422016.E().S(i.Desc()) 330 //line views/layout/Menu.html:99 331 qw422016.N().S(`">`) 332 //line views/layout/Menu.html:100 333 } else { 334 //line views/layout/Menu.html:100 335 qw422016.N().S(`<a class="`) 336 //line views/layout/Menu.html:101 337 qw422016.E().S(finalClass) 338 //line views/layout/Menu.html:101 339 qw422016.N().S(`" href="`) 340 //line views/layout/Menu.html:101 341 qw422016.E().S(i.Route) 342 //line views/layout/Menu.html:101 343 qw422016.N().S(`" title="`) 344 //line views/layout/Menu.html:101 345 qw422016.E().S(i.Desc()) 346 //line views/layout/Menu.html:101 347 qw422016.N().S(`">`) 348 //line views/layout/Menu.html:102 349 } 350 //line views/layout/Menu.html:103 351 if i.Badge != "" { 352 //line views/layout/Menu.html:104 353 components.StreamIndent(qw422016, true, indent+3) 354 //line views/layout/Menu.html:104 355 qw422016.N().S(`<div class="badge">`) 356 //line views/layout/Menu.html:105 357 qw422016.E().S(i.Badge) 358 //line views/layout/Menu.html:105 359 qw422016.N().S(`</div>`) 360 //line views/layout/Menu.html:106 361 } 362 //line views/layout/Menu.html:107 363 if i.Icon != "" { 364 //line views/layout/Menu.html:108 365 components.StreamSVGRef(qw422016, i.Icon, 16, 16, "icon", ps) 366 //line views/layout/Menu.html:109 367 } 368 //line views/layout/Menu.html:110 369 qw422016.E().S(i.Title) 370 //line views/layout/Menu.html:110 371 qw422016.N().S(`</a></li>`) 372 //line views/layout/Menu.html:113 373 } 374 //line views/layout/Menu.html:114 375 } 376 377 //line views/layout/Menu.html:114 378 func WriteMenuItem(qq422016 qtio422016.Writer, i *menu.Item, path []string, breadcrumbs cmenu.Breadcrumbs, indent int, ps *cutil.PageState) { 379 //line views/layout/Menu.html:114 380 qw422016 := qt422016.AcquireWriter(qq422016) 381 //line views/layout/Menu.html:114 382 StreamMenuItem(qw422016, i, path, breadcrumbs, indent, ps) 383 //line views/layout/Menu.html:114 384 qt422016.ReleaseWriter(qw422016) 385 //line views/layout/Menu.html:114 386 } 387 388 //line views/layout/Menu.html:114 389 func MenuItem(i *menu.Item, path []string, breadcrumbs cmenu.Breadcrumbs, indent int, ps *cutil.PageState) string { 390 //line views/layout/Menu.html:114 391 qb422016 := qt422016.AcquireByteBuffer() 392 //line views/layout/Menu.html:114 393 WriteMenuItem(qb422016, i, path, breadcrumbs, indent, ps) 394 //line views/layout/Menu.html:114 395 qs422016 := string(qb422016.B) 396 //line views/layout/Menu.html:114 397 qt422016.ReleaseByteBuffer(qb422016) 398 //line views/layout/Menu.html:114 399 return qs422016 400 //line views/layout/Menu.html:114 401 }