Sha256: b92fdabdebe426b06dd94eb1dd210e3aed993edc10b8c5ef2a310f05c52a65f5

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

#
# ishapi / newsitems / _index
#

json.n_newsitems newsitems.count
json.newsitems do
  json.array! newsitems do |item|

    json.id          item.id.to_s
    json.name        item.name
    json.created_at  item.created_at
    
    if item.gallery
      json.item_type    'gallery'
      json.name         item.gallery.name
      json.galleryname  item.gallery.galleryname
      json.username     item.username
      
     
      json.partial!    'ishapi/application/meta', :item => item.gallery
      if item.gallery.is_premium
        json.premium_tier item.gallery.premium_tier
        json.is_premium   item.gallery.premium_tier > 0
        json.is_purchased current_user.profile.has_premium_purchase( item.gallery )
        json.partial!    'ishapi/photos/index',     :photos => [ item.gallery.photos[0] ]
      else
        json.partial!    'ishapi/photos/index',     :photos => item.gallery.photos
      end
    end

    if item.report
      json.item_type  'report'
      json.name       item.report.name
      json.reportname item.report.name_seo
      json.subhead     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_id
      json.partial! 'ishapi/videos/show', :video => Video.unscoped.find( item.video_id )
      
      # 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
      # json.url        item.video.video.url
    end

    if item.photo
      json.item_type 'photo'
      json.partial! 'ishapi/photos/index', :photos => [ item.photo ]
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ishapi-0.1.8.117 app/views/ishapi/newsitems/_index.jbuilder
ishapi-0.1.8.116 app/views/ishapi/newsitems/_index.jbuilder