Sha256: 370240aceaa2ceb60e059bc100dafe900b8df53ff077f4bb70bac93527e885cc

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

module SimpleImagesHelper
  def render_simple_images_edit_link_for(image)
    render 'simple_images/edit', image: image
  end

  def render_simple_images_destroy_link_for(image)
    render 'simple_images/destroy', image: image
  end

  def render_simple_images_actions_for(image)
    [].tap do |ary|
      ary << render_simple_images_edit_link_for(image)
      ary << render_simple_images_destroy_link_for(image)
    end.join.html_safe
  end

  def render_simple_images_form_for(imageable)
    render 'simple_images/form', imageable: imageable
  end

  def si_dom_id(image_or_imageable)
    if image_or_imageable.is_a?(SimpleImage)
      'si_' + image_or_imageable.imageable.class.to_s.underscore + '_' +
      image_or_imageable.imageable.id.to_s
    else
      'si_' + image_or_imageable.class.to_s.underscore + '_' +
      image_or_imageable.id.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_images-0.0.3 app/helpers/simple_images_helper.rb