-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cro & HTMX Discussion #8
Comments
^^ I put the whole file here since I think it has a lot for this project:
<tr id="replaceMe">
<td colspan="3">
<button class='btn primary' hx-get="/contacts/?page=2"
hx-target="#replaceMe"
hx-swap="outerHTML">
Load More Agents... <img class="htmx-indicator" src="/img/bars.svg">
</button>
</td>
</tr> I think this needs an idea for how to represent the hx-get / hx-post sequences in our htmx source ... my initial shot would be to have something like: class hx-get {
has $.route; # <=== use this to set up the routes.raku
method next { sends the next htmx content }
} This would allow arbitrary programmatic patterns for the back end to service hx-get, hx-post and so on any f/back welcome |
Here's the joe blow example done in flash / blueprint: viz. https://github.com/Konfuzian/htmx-examples-with-flask/blob/main/examples/blueprints/click_to_edit.py from flask import Blueprint, render_template, request
bp = Blueprint("click_to_edit", __name__, url_prefix="/click_to_edit")
data = [
{
"firstName": "Joe",
"lastName": "Blow",
"email": "[email protected]",
}
]
@bp.route("/", defaults={"id": 0})
@bp.route("/contact/<int:id>", methods=["GET", "PUT"])
def contact(id):
if request.method == "PUT":
data[id] = {k: request.form[k] for k in ("firstName", "lastName", "email")}
return render_template("click_to_edit/index.html.j2", contact=data[id])
@bp.route("/contact/<int:id>/edit")
def contact_edit(id):
return render_template("click_to_edit/edit.html.j2", contact=data[id]) |
OK - based on some work on implemented HTMX examples, I think that the initial emphasis on functional HTML can and should be moved out to a new raku module ... that said, there is an existing raku module |
my current plan is to leave the main branch as a vanilla crotmp oriented set of all the HTMX examples where we have more exotic code styles like OO or Fn, then these can be placed on long-lived branches of their own |
I have been looking at the cro documentation website and I really like the way that Cro uses markdown for those static pages...
The magic is done with the routes.pm6 file https://github.com/Raku/cro-website/blob/main/lib/Routes.pm6
The text was updated successfully, but these errors were encountered: