mirror of
https://github.com/joerdav/go-htmx-examples.git
synced 2026-02-04 09:20:23 +00:00
feat: clicktoedit
This commit is contained in:
@@ -38,14 +38,6 @@ templ replaceMe(page int) {
|
||||
templ Index(users []user) {
|
||||
@shared.Layout("Click to Load") {
|
||||
<h2 class="title">Click to Load</h2>
|
||||
<p>This example shows how to implement click-to-load the next page in a table of data. The crux of the demo is the final row:</p>
|
||||
<pre><code class="language-html">
|
||||
@shared.Raw() {
|
||||
@replaceMe(1)
|
||||
}
|
||||
</code></pre>
|
||||
<p>This row contains a button that will replace the entire row with the next page of results (which will contain a button to load the next page of results). And so on.</p>
|
||||
<h2 class="title">Demo</h2>
|
||||
@demo(users, 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,128 +366,6 @@ func Index(users []user) templ.Component {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element (standard)
|
||||
_, err = templBuffer.WriteString("<p>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Text
|
||||
var_14 := `This example shows how to implement click-to-load the next page in a table of data. The crux of the demo is the final row:`
|
||||
_, err = templBuffer.WriteString(var_14)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</p>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Whitespace (normalised)
|
||||
_, err = templBuffer.WriteString(` `)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element (standard)
|
||||
_, err = templBuffer.WriteString("<pre>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element (standard)
|
||||
_, err = templBuffer.WriteString("<code")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element Attributes
|
||||
_, err = templBuffer.WriteString(" class=\"language-html\"")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString(">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// TemplElement
|
||||
var_15 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
|
||||
templBuffer, templIsBuffer := w.(*bytes.Buffer)
|
||||
if !templIsBuffer {
|
||||
templBuffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templBuffer)
|
||||
}
|
||||
// TemplElement
|
||||
err = replaceMe(1).Render(ctx, templBuffer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !templIsBuffer {
|
||||
_, err = io.Copy(w, templBuffer)
|
||||
}
|
||||
return err
|
||||
})
|
||||
err = shared.Raw().Render(templ.WithChildren(ctx, var_15), templBuffer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</code>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</pre>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Whitespace (normalised)
|
||||
_, err = templBuffer.WriteString(` `)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element (standard)
|
||||
_, err = templBuffer.WriteString("<p>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Text
|
||||
var_16 := `This row contains a button that will replace the entire row with the next page of results (which will contain a button to load the next page of results). And so on.`
|
||||
_, err = templBuffer.WriteString(var_16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</p>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Whitespace (normalised)
|
||||
_, err = templBuffer.WriteString(` `)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element (standard)
|
||||
_, err = templBuffer.WriteString("<h2")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Element Attributes
|
||||
_, err = templBuffer.WriteString(" class=\"title\"")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString(">")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Text
|
||||
var_17 := `Demo`
|
||||
_, err = templBuffer.WriteString(var_17)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</h2>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Whitespace (normalised)
|
||||
_, err = templBuffer.WriteString(` `)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// TemplElement
|
||||
err = demo(users, 1).Render(ctx, templBuffer)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user