Rails app (3.2.8) and turbolinks (not sure if relevant) enabled.
- I have some information, a
link
on a users show page. (E.g. A notification that something has changed.) - When the user clicks on the link I want to direct him to the page and
- Visually highlight the elements that changed.
Currently I'm planning to handle it like this:
Create the links so they are of the form:
project2/comment.1453
Create a notifications controller,
which gets the projects2
and the type of change comment
and its id 1453
. So in theory I want to redirect to projects2
and highlight the comment with id 1453 on that page. The problem is: After the redirect how do I highlight the comment?
notificationscontroller.rb (Pseudo code!)
def show
project = Project.find(params[:project_id])
comment = Comment.find(params[:commment_id])
redirect_to project AND highlight!
end
During my research I've come across Backbone, and it looks like Backbones router could solve this problem by responding to the url with a function (the highlighting of the comment). But I don't have any experience with Backbone.
I'm not sure what the general approach to this sort of functionality is. And would like to avoid going down the wrong path. Would be great if you could help me out.
Edit: Sort of a mini question: I'm not sure which character to use for comment.1453
is #
a better choice? (comment#1453
)