Sha256: bf29a9331ca77618e7782075d9407601dc0e62c3f3484ca7ae7a395eef1045a0

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

module Crimagify
  module ApplicationHelper

  	def image_cropper(object, options, image_options = {})
  		image_options[:class] = "#{image_options[:class]} img_start"
			img = object.crimagify_images.where("image_name=?", options[:image_name])
			version_name = options[:ratio]
			if img == []
				url_image = "rails.png"
			else
				url_image = img.first.image_url(options[:ratio]).to_s rescue ""
			end
			if url_image == ""
				url_image = "rails.png"
			end
			render(:partial => "crimagify/crop_partials/fields_cropper", :locals => { id_image: options[:image_name], url_image: url_image, image_options: image_options, version_name: version_name })
		end

		def images_id(object)
			html = ""
			html << content_tag(:input, nil, :id => :parent, :name => :parent, :type => :hidden, :value => "#{object.class.name}")
			html << content_tag(:input, nil, :id => :parent_id, :name => :parent_id,  :type => :hidden, :value => "#{object.id}")
			html << content_tag(:input, nil, :id => :id_images, :name => :id_images, :type => :hidden, :value => "")
			return raw html
		end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crimagify-0.0.2.1 app/helpers/crimagify/application_helper.rb
crimagify-0.0.2 app/helpers/crimagify/application_helper.rb