diff --git a/carrierwave-crop.gemspec b/carrierwave-crop.gemspec index 3a07c69..e798aad 100644 --- a/carrierwave-crop.gemspec +++ b/carrierwave-crop.gemspec @@ -6,7 +6,7 @@ require 'carrierwave/crop/version' Gem::Specification.new do |spec| spec.name = "carrierwave-crop" spec.version = CarrierWave::Crop::VERSION - spec.authors = ["kirtithorat"] + spec.authors = ["Kirti Thorat"] spec.email = ["kirti.brenz@gmail.com"] spec.summary = %q{CarrierWave extension for cropping images with preview.} spec.description = %q{CarrierWave extension to crop uploaded images using Jcrop plugin.} diff --git a/lib/carrierwave/crop/helpers.rb b/lib/carrierwave/crop/helpers.rb index a8a28f1..8bd6848 100644 --- a/lib/carrierwave/crop/helpers.rb +++ b/lib/carrierwave/crop/helpers.rb @@ -20,7 +20,8 @@ def previewbox(attachment, opts = {}) attachment = attachment.to_sym if(self.object.send(attachment).class.ancestors.include? CarrierWave::Uploader::Base ) - model_name = self.object.class.name.downcase + ## Fixes Issue #1 : Colons in html id attributes with Namespaced Models + model_name = self.object.class.name.downcase.split("::").last width, height = 100, 100 if(opts[:width] && opts[:height]) width, height = opts[:width].round, opts[:height].round @@ -52,8 +53,8 @@ def cropbox(attachment, opts={}) attachment_instance = self.object.send(attachment) if(attachment_instance.class.ancestors.include? CarrierWave::Uploader::Base ) - - model_name = self.object.class.name.downcase + ## Fixes Issue #1 : Colons in html id attributes with Namespaced Models + model_name = self.object.class.name.downcase.split("::").last hidden_elements = self.hidden_field(:"#{attachment}_crop_x", id: "#{model_name}_#{attachment}_crop_x") [:crop_y, :crop_w, :crop_h].each do |attribute| hidden_elements << self.hidden_field(:"#{attachment}_#{attribute}", id: "#{model_name}_#{attachment}_#{attribute}") diff --git a/lib/carrierwave/crop/model_additions.rb b/lib/carrierwave/crop/model_additions.rb index 4bfccab..541065b 100644 --- a/lib/carrierwave/crop/model_additions.rb +++ b/lib/carrierwave/crop/model_additions.rb @@ -58,7 +58,7 @@ def crop_image(attachment) module Uploader - # Perfoems cropping. + # Performs cropping. # # On original version of attachment # process crop: :avatar