My little contribution to a rails plugin (sort of)
June 14, 2009
Getting your bug fix/code pulled into the main repo really gets you excited & satisfied.
I never thought it could give me this much sense of enjoyment. Check it out.
4 Comments
leave one →
Hi, and thanks for your contribution. I think i love it… It is exactly what I was looking for.
Could you please clarify something for me?
On (or about) line 63 of weekly_builder/lib/weekly_calendar.rb in the concat(…) section, I am trying to edit the
nlick function to do something else, and can’t seem to get any syntax to work (at all, not even an a page.alert ‘Why won’t this change’).
I need it to show/hide a partial instead of going to an href. I have accomplished this on the event.name with ‘edit’, :locals => {:event => event } } -%> in the view, but the whole div is perfectly clickable, and I would like to control the action on that instead of only being able to click on the name.
I have googled and cannot seem to find a solution. Everything I try either throws a javascript error, or does nothing once I fix that error…
Any help or direction would be greatly appreciated.
Thanks in advance,
D
Hi, darin. Thanks for commenting. To solve your problem, I suggest you could simply put a javascript function call on the onclick option. For example:
concat(content_tag(“div”, ”, :id => “click_hour”,
nclick => “click_me();”))
And in your view, you could do a simple script like so
function click_me() {
//do some funky stuff
}
This is the simplest solution I can think of. I hope this could at least help you on your use case.
I am sorry, it not absolutely approaches me. Perhaps there are still variants?
In it something is. Now all is clear, I thank for the help in this question.