jcropper 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,6 +54,9 @@ Add the helpers to your view:
54
54
  <%= croppable_image [@site.user, :user], :avatar, :thumb -%>
55
55
  <%= croppable_image_preview [@site.user, :user], :avatar, :thumb -%>
56
56
 
57
+ Optional syntax, effects same as first option
58
+ <%= croppable_image :user, :avatar, :thumb -%>
59
+ <%= croppable_image_preview :user, :avatar, :thumb -%>
57
60
 
58
61
  Helper Options:
59
62
  :css_prefix => 'jcrop',
data/TODO CHANGED
@@ -18,4 +18,13 @@
18
18
  - use inline css or separate css
19
19
  - reset cropping when uploading new image
20
20
  - make options[:view_size] work
21
- - add a crop_updated_at field
21
+ - add a crop_updated_at field
22
+ - all these class_eval's in ClassMethods#jcrop really want to be class_exec's! but this is 1.9. so we have to do this:
23
+ to_eval = <<-TO_EVAL
24
+ after_initialize :jcropper_initialize
25
+ def jcropper_initialize
26
+ @cropped_image = CroppedImage.new(self, #{options.inspect})
27
+ end
28
+ TO_EVAL
29
+
30
+ and that only works if options.inspect renders ruby code, which it is not guaranteed to do.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jcropper}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Ziegler"]
12
- s.date = %q{2011-05-09}
12
+ s.date = %q{2011-08-31}
13
13
  s.description = %q{}
14
14
  s.email = %q{ryan@symbolforce.com}
15
15
  s.extra_rdoc_files = [
@@ -55,6 +55,8 @@ module JCropper
55
55
  def split_object_and_name(object_and_name)
56
56
  if object_and_name.is_a? Array
57
57
  object_and_name
58
+ elsif object_and_name.is_a? ActiveRecord::Base
59
+ [object_and_name, object_and_name.class.model_name]
58
60
  else
59
61
  [eval("@#{object_and_name.to_s}"), object_and_name]
60
62
  end
@@ -73,7 +75,7 @@ module JCropper
73
75
  :aspect_ratio => @js_cropper_c_i.target_geometry.width / @js_cropper_c_i.target_geometry.height,
74
76
  :original_geometry => {:width => @js_cropper_c_i.original_geometry.width, :height => @js_cropper_c_i.original_geometry.height},
75
77
  :starting_crop => @js_cropper_c_i.starting_crop,
76
- :js_object => 'croppedImage' + SecureRandom.hex(10),
78
+ :js_object => 'croppedImage' + ActiveSupport::SecureRandom.hex(10),
77
79
  :jcrop_options => @js_cropper_c_i.options[:maintain_aspect_ratio] ? {:aspectRatio => @js_cropper_c_i.target_geometry.width / @js_cropper_c_i.target_geometry.height} : {}
78
80
  }.merge(@js_cropper_options.merge(options))
79
81
  end
@@ -26,14 +26,14 @@ module JCropper
26
26
  to_eval = <<-TO_EVAL
27
27
  after_initialize :jcropper_initialize
28
28
  def jcropper_initialize
29
- @cropped_image = CroppedImage.new(self, #{options.to_hash})
29
+ @cropped_image = CroppedImage.new(self, #{options.inspect})
30
30
  end
31
31
  TO_EVAL
32
32
  else
33
33
  to_eval = <<-TO_EVAL
34
34
  ###CRZ - alias chain this
35
35
  def after_initialize
36
- @cropped_image = CroppedImage.new(self, #{options.to_hash})
36
+ @cropped_image = CroppedImage.new(self, #{options.inspect})
37
37
  end
38
38
  TO_EVAL
39
39
  end
@@ -1 +1 @@
1
- load File.join(File.dirname(__FILE__), '..', '..', 'tasks', 'jcropper.rake') if defined? Rake
1
+ load File.join(File.dirname(__FILE__), '..', 'tasks', 'jcropper.rake') if defined? Rake
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jcropper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Ziegler
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-09 00:00:00 -04:00
18
+ date: 2011-08-31 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21