Posts [ 12 ]

Topic: Injecting Javascript into view (Beginner Question)

Hello, I am relatively new to RoR and completely new to Javascript. I am trying to take example javascript code from THEJIT graphing tool and inject it into my view. Can't seem to find a tutorial anywhere on how to go from zero to deployment with it so I am hoping I can get some help here.

Re: Injecting Javascript into view (Beginner Question)

I am not 100% sure what barChart is exactly but the code you gave me does not seem to output anything so i guess it might not be an HTML object? I inserted your code and where u said Javascript here I pasted in what I had. Here is the barChart class from thejit, not sure if this helps. I am just at the beginner stages of all this so I apologize for the lack of detail in my questions.

Re: Injecting Javascript into view (Beginner Question)

I have copied there HTML into my view, have the javascript, have the css files (all come in there download); however I still don't get what they get outside of the hardcoded text. The CSS files are in app/assets/stylesheets, Javascripts files are in app/assets/javascripts. How should I set up the "src = .." to represent these libraries. I have tried various ways and I still do not get a chart so I am trying to cover all potential problems.

The fist line will grab ALL the css in app/assets/stylesheetsThe second line will grab all the javascripts in app/assets/javascriptsThe third line will generate the authenticity token for posts, you can leave it out of you are not using forms that post on the page.