Module: PushType::WysiwygMediaHelper

Includes:
AssetsHelper
Defined in:
app/helpers/push_type/wysiwyg_media_helper.rb

Instance Method Summary collapse

Instance Method Details

#wysiwyg_asset_hash(asset) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/push_type/wysiwyg_media_helper.rb', line 20

def wysiwyg_asset_hash(asset)
  {
    src: asset_preview_thumb_url(asset),
    info: {
      id:    asset.id,
      kind:  asset.kind,
      src:   main_app.media_url(asset.file_uid),
      title: asset.description_or_file_name
    }
  }
end

#wysiwyg_assets_hash(assets) ⇒ Object



6
7
8
9
10
11
# File 'app/helpers/push_type/wysiwyg_media_helper.rb', line 6

def wysiwyg_assets_hash(assets)
  {
    assets: assets.map { |a| wysiwyg_asset_hash(a) },
    meta:   wysiwyg_assets_meta(assets)
  } 
end

#wysiwyg_assets_meta(assets) ⇒ Object



13
14
15
16
17
18
# File 'app/helpers/push_type/wysiwyg_media_helper.rb', line 13

def wysiwyg_assets_meta(assets)
  {
    current_page: assets.current_page,
    total_pages:  assets.total_pages
  }
end