Hotwire example #288
Replies: 2 comments 7 replies
-
I'm trying to do the same thing you are, I keep getting calendar requires a block template error tho. Did you set up turbo_frame_tag like in the example? I'm guessing your calendar partial is in the views folder with the controller making the call and not referencing it from the simple_calendar folder? |
Beta Was this translation helpful? Give feedback.
-
Figured out how to incorporate turbo frames into the calendar itself. In the actual calendar block add turbo frames as such:
your partial location would replace
I had to use a custom method to create the turbo ids , because in order to update the correct day of the month turbo needs the unique So using the date that the meeting was created we have our unique id. the method for creating the dom id: I placed it in the
For my setup on creating/updating/deleting objects with turbo I created 3 views. Since my calendar is used on the schedule model; this is mine, yours could be events model, activity model, whatever you called it. In my views folder for
create_turbo file
update_turbo:
destroy_turbo:
I have a list being created, updated, and destroyed as well, the calendar portion starts when you see the You may ask your self why are they different? For the create action we are looking for the Hopefully this helps people when they are playing with this gem, I know I spent a good day trying to figure this out even though when I did it took like 2 hours to code and get it right. To get a better idea of whats happening, if you use this, open the inspector and view the turbo ids and see how they change when you don't use the Don't know if this is the correct way to do this but it works as I want it to work. |
Beta Was this translation helpful? Give feedback.
-
I have been struggling a bit getting the days to update with hotwire when events are put in. Is there a full working example that shows this?
Update: I ended up getting the events rendering with hotwire! The last thing I am looking to do is to change the month calendar to the month the event start_time was put in for. I was trying to do something like this but is not working. Any suggestions?
<%= turbo_stream.replace "calendar", partial: "scheduleevents/calendar", locals: {events: @scheduleevents, date: @scheduleevent.start_time} %>
Beta Was this translation helpful? Give feedback.
All reactions