javascript - Rails Displaying Recommendations - Facebook/Linkedin style -


i'm writing rails 3.2.1 app , display suggested items user in following way:

currently, have array of suggested items, , want display 5 suggestions @ time. user able to

  1. click on item link something.
  2. click on close button (and "x")
  3. if user rejects recommendation clicking on close button, display

another suggestion in same place on list of 5 displayed suggestions. new suggestion takes place of rejected one.

any ideas on how can it? have tried searching on web can't seem find useful direction. appreciated!

well, 'store' decision of user in session/cookie/database depending on how persistent want decision be. after user rejects suggestion reload suggestions taking decision account.

e.g.

suggestions.where(["id not in (?)", user.rejected_suggestions]) 

(assuming have m-to-n-relation between user , suggestions called rejected_suggestions)

and way displayed javascript. use example jquery , fade rejected suggestion hiding , let new 1 slide in.

http://api.jquery.com/fadeout/

http://api.jquery.com/slidedown/

and reloading , storing decision use ajax call.

alternatively: load few more suggestions (than 5) , use js fade them out , slide new ones view - , when suggestions have been rejected display like: 'we sorry, there no suggestions @ moment.'


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -