Implement a calender with Ruby and Javascript in Rails
Posted
by
samuel02
on Stack Overflow
See other posts from Stack Overflow
or by samuel02
Published on 2012-04-11T17:11:06Z
Indexed on
2012/04/11
17:28 UTC
Read the original article
Hit count: 243
I'm trying to implement a calendar with Ruby and Javascript in Rails. I'm using a calendar helper that creates a calendar with given year and month and events as parameters (<%= calendar(:year => 2012, :month => 4, :events => @events %>
).
I also have three buttons next, today and previous with which the user should be able to navigate the calendar with. I am also going to implement some js that makes it possible to select dates in the calendar. So what I would like to do is to insert the calendar in the DOM with javascript in order to generate a new calendar when the user clicks one of the buttons. That way I will be able to control the behavior of the buttons and add the select functionality.
The problem is that I can't just insert my erb code in a javascript plus I'm not even sure it's the right way to go? Any suggestions are appreciated!
© Stack Overflow or respective owner