GeoRSS aggregator and Layar augmented reality server
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

40 lignes
991 B

  1. module PostsHelper
  2. def post_to_poi(post)
  3. # http://layar.com/documentation/browser/api/getpois-response/
  4. {
  5. :id => post._id,
  6. :imageURL => "%s%s/assets/layar-icons/tal-logo-100.png" % [ request.protocol, request.env['HTTP_HOST'] ],
  7. :anchor => {
  8. :geolocation => {
  9. :lat => post.loc['lat'],
  10. :lon => post.loc['lng'],
  11. :alt => 0
  12. }
  13. },
  14. :text => {
  15. :title => post.title,
  16. :description => clean_description(post.summary),
  17. :footnote => "From #{post.feed.title}"
  18. },
  19. :actions => [
  20. {
  21. :label => "Read more...",
  22. :uri => post.url,
  23. :contentType => "text/html",
  24. :method => "GET",
  25. :activityType => 1
  26. }
  27. ]
  28. }
  29. end
  30. def clean_description(s)
  31. if s.size > 137
  32. s = s[0..136] + '...'
  33. end
  34. coder = HTMLEntities.new
  35. coder.decode(s.gsub(/<.+?>/, ''))
  36. end
  37. end