I am working on a Web Application with rails which is more of a single page ( think a dashboard )
I want a left side strip fetching a list with and a main app area to the left rendering most of the Application (All with jQuery)
In Rails I have a single controller Dashboard for now. I want the request of left side bar to reach the appropriate method so as I can reply with Json. Similarly for the main area.
As the application gets complex, the URL appended with #specific URL is also something I want.
example –> ‘gamail.com#inbox’ , ‘gmail.com#drafts’
How would the routes work in this case? I have read the Rails Official docs and searched quite a lot but could not find much information.
I am using the jQuery Back Button & Query library. This will allow you to create hash-urls and respond to changes in the url. What you then do with that hash-part depends on you.
Check out the examples there.
For example, suppose in your sidebar you have a list of books, or wines, or whatever. You create an url like you said,
http://yourwebsite.com#your-book, then inside your javascript code, you will have to translate that to the correct rails url, for instancehttp://yourwebsite.com/books/your-bookand show that JS/JSON on the part of the page you want it to be seen.So the routes in your rails-app are totally no linked, and you will have to translate the url-part to the correct url.
Backbone.js or spine.js offer routing on the client-side, but in my experience I only got that to work for really simple cases (but this could also be caused by my limited knowledge & experience in such frameworks).
Hope this helps.