Module: Portfolio::SiteItemsHelper

Defined in:
app/helpers/portfolio/site_items_helper.rb

Instance Method Summary collapse

Instance Method Details

#ajax_checkbox(item, field) ⇒ Object



11
12
13
14
15
# File 'app/helpers/portfolio/site_items_helper.rb', line 11

def ajax_checkbox item, field
  check_box_tag field, item.id, item[field],
    class: 'ajax_checkbox',
    data: { path: polymorphic_path([:admin, @site, item]), field: field }
end

#item_path(item) ⇒ Object



17
18
19
20
# File 'app/helpers/portfolio/site_items_helper.rb', line 17

def item_path item
  portfolio.send "show_portfolio_#{item.class.human_name}_path",
       item.site.key, item.path_title, item.id
end

#site_item_image(site_item, style) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/portfolio/site_items_helper.rb', line 3

def site_item_image site_item, style
  if site_item.default_image
    image_tag(site_item.default_image.image(style))
  else
    image_tag("portfolio/#{style}/missing.png")
  end
end