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
Add Custom Render Support via Reply #103
Comments
It's done :) |
Cant get custom rendering to work for meHi, first of all, coding in php for almost 20 years, I'm pretty new to go (since a few months), but I'm having some experience in c and c# therefore go looks familiar to me. One of them is to have some kind of web components in my html templates. As our web design is made using the pinegrow web editor, I need to have a way to replace blocks with representing default content in the layout (always full pages, content of the block may be just an image of the output) with dynamic content of the database in template(s) - best way each block gets his own template. Simple Example:
Template: This I can do with go html/template, but I don't find a way to do it with aah :( First of all I expected Reply().HTMLlf(layout,template,data) would do it, but I don't know why the template isn't overriding the default of the layout. Now I'm trying to build a custom render method, but yet the both base examples don't work:
Internal Server Error: RenderFunc:
Internal Server Error: $ go version I've tried some things to get this conversion right, but got no success. Good chance I don't know yet, how to do it right. |
@AugustHell Thank you for using aah for your project. I'm glad to hear your appreciation. Feel free to reach out on Gitter or here for any assistance with aah. aah go view engine is enhanced features with default go template engine. So it has all the capabilities 😄 Let's get to your questions. First you might have a read the aah views directory structure. Just give you a high level tour-
Now view template path is Next move on to Layout, if you take a closer look at layout Next move on to Rendering-
I hope I have describe it alright. Bottomline, you can use all capabilities of go template engine with Regarding custom render, this error Thanks again for using |
@AugustHell Thanks finding a bug #174, I have fixed it. Made |
Thank you very much for your quick detailed reply and the aah update! I understand the part of the layout and page rendering. Only, it doesn't work like I'd expect it. Maybe another quirk? I'm using block instead of template, cause I like to have default content in the layout in place, that should be replaced by the controller with dynamic content on runtime. That could be done with template too, it's just a line more, but neither way is working if you look at this example: layouts/master.html
pages/app/index.html
app/controllers/app.go
If I run this, neither the body nor the footer default content is replaced, so nothing of pages/app/index.html is in the output. Output:
BTW, highly welcomed would be, if there is a replay function that handles multiple "pages" like several blocks on a page
Another neat way would be if it is plugable, like in erlang/elixirs plug: |
@AugustHell I understand your goal (generally it should be 😄). I'm wondering why Thanks for the suggestion on reply design. First I would like to understand how erlang/elixirs works then I could think on design. (Added note on Roadmap) |
@AugustHell Congrats you have found a bug #175 and I have fixed it go-aah/view@525d4de Please take an update of view library: Use all the capabilities of Go template engine plus aah and share your inputs 😄 Thanks for contributing to BTW would you like to jump on aah edge version? you can try new features/enhancements and your findings could help me. |
Thanks a lot. As I'm working on an administration tool at the moment, I can use the edge version, but need to stay focused on things that the project needs. Websockets might be a topic instead of ajax, but more interesting for me is the database layer part. Keep on your great work! |
@AugustHell Got it, so will do when I get a time.
I think, for you better to stay on release version so that you can focus on your project; because edge version has possiblity of build failures. Thank you for the appreciation. |
@AugustHell I thought check with you. how is your experience so far with aah? Please let me know your candid feedback. |
Add custom render support via Reply. So that aah user can implement interface
aah.Render
and supply it as custom render.Classic real time usage is JSON API response - https://github.com/google/jsonapi.
Samples
Sample 1
Sample 2
The text was updated successfully, but these errors were encountered: