Giter Club home page Giter Club logo

Comments (5)

markbates avatar markbates commented on August 27, 2024 1

Fixed

from toodo.

houstonian avatar houstonian commented on August 27, 2024

I'm encountering the same problem. I registered and added an item fine, then when I went to show list I got the same output. Wondering what's going on. I'm looking into the templates. Will circle back if I find a solution.

from toodo.

houstonian avatar houstonian commented on August 27, 2024

<%= for (item) in items { return partial("items/li.html") } %>

this line seems to be the problem. Not familiar enough with go and buffalo templates to find a solution.

from toodo.

SQLServerIO avatar SQLServerIO commented on August 27, 2024

If I move the code in the _li.html template into the index.html template it works as expected. This may be a bug with plush not pushing the variable down out of the loop into the partial I don't know for sure I am brand new to buffalo myself.

from toodo.

scoop206 avatar scoop206 commented on August 27, 2024

I hit this too.
The problem was that when showing the list of items, the 'item' variable wasn't in the context that was available when the _li.html partial was being rendered.

It was also hard to get to the problem. By this I mean that I would modify the template that was calling the partial, and I wasn't seeing a change when reloading the webpage.
I beat my head against it for too long and then concluded that the app.Resource("/items", ItemsResource{}) in actions/app.go must be generating the templates already. So that it's basically ignoring what's on disk in the templates folder. (I'm not positive on this aspect but pushed forward on that hunch)

I cracked the buffalo source and could see in the generators that the current buffalo CRUD templates were newer. They now take a different approach. Rather than using a for loop to call partial for each they just do them all in one page. So the whole 'item' not in the context is no longer an issue if the app were to be rebuilt.

So that's what I did along with haphazardly documenting my experience in the README.
https://github.com/scoop206/buffalo-todo2

from toodo.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.