Sha256: 181918514c0f0f2b1679f6fe5a1cd0f856a2e6cae87e090484cf339285538dd6

Contents?: true

Size: 1.49 KB

Versions: 21

Compression:

Stored size: 1.49 KB

Contents

#
# ishapi / newsitems / _index
#
json.n_newsitems newsitems.count
json.newsitems do
  json.array! newsitems do |item|
    json.created_at  item.created_at
    json.descr       item.descr
    json.description item.descr
    json.name        item.name
    
    if item.gallery
      json.item_type  'gallery' #@TODO: should be a constant
      json.name        item.gallery.name
      json.galleryname item.gallery.galleryname
     
      json.partial!    'ishapi/application/meta', :item => item.gallery
      json.partial!    'ishapi/photos/index',     :photos => item.gallery.photos.limit( 6 )
    end
    if item.report
      json.item_type  'report'
      json.name       item.report.name
      json.reportname item.report.name_seo
      json.descr      item.report.subhead
      json.report_id  item.report_id.to_s
      json.username   item.report.user_profile.name if item.report.user_profile
      if item.report.photo
        json.photo_url item.report.photo.photo.url( :small ) 
        json.thumb_url item.report.photo.photo.url( :thumb )
      end
    end
    
    if item.video
      json.partial! 'ishapi/videos/show', :video => item.video
      
      json.item_type  'video'
      json.name       item.video.name
      json.descr      item.video.descr
      json.x          item.video.x
      json.y          item.video.y
      json.youtube_id item.video.youtube_id
    end
    if item.photo
      json.item_type 'photo'
      json.partial! 'ishapi/photos/index', :photos => [ item.photo ]
    end
    
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ishapi-0.1.8.77 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.76 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.75 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.74 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.73 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.72 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.71 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.70 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.69 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.68 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.67 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.66 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.65 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.64 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.63 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.62 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.61 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.60 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.59 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.58 app/views/ishapi/newsitems/_index.jbuilder