rails_admin_jcrop 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8d991eab65fb7f30df49d118a550cd73e8c40ff
4
- data.tar.gz: 97fff698c39f9f6257dbca6ea60b6a42ed1f65c7
3
+ metadata.gz: 53d5489e657c9d9affc179738e5c61e0abc3b9eb
4
+ data.tar.gz: 08e64cefde8e422604c65d31aef910fa878e5191
5
5
  SHA512:
6
- metadata.gz: d25a648e40225a1ea69dd34a6f17aab80fff6343ad03b2be9b1d7c806583c6f32e4c4b8d9c03375104ca9193a4bdfb7bb0d3b1cd7d29e6c772fd4a8c9ca90d70
7
- data.tar.gz: 1e96f8e8c0b88ff6f228c638fcfea3149d0d4564f32c4e713b5bbe6422c132f8285a0de67db477d09e5fdeed231e72c69ce32705c0a5764ec38fa1481c3c8a93
6
+ metadata.gz: 1507eebf55b314a1e6977009647972f4347f55e424a81d46cc1f76bd6371f7a9b0f6db88d433b4ff8f96b685f1fde89d6a9cf489a995897a84af23c3802f1e65
7
+ data.tar.gz: 2c81e11ad84afe5a22e8df2d1a86d442e200e99a3d75d12800a167f07fe7977b0011b5cf6ac05e8c929d5b7b7cb8dfee16d5e07b76a12aaf082ecf49a126c555
data/README.markdown CHANGED
@@ -4,37 +4,43 @@
4
4
 
5
5
  1. Add it to your Gemfile and run `bundle install`:
6
6
 
7
- gem 'rails_admin'
8
- # Because rails_admin_jcrop autoload modules by checking plugins you use, it's
9
- # recommended to require it explictly before rails_admin_jcrop
10
- # e.g. if you use carrierwave
11
- # gem 'carrierwave', :require => 'carrierwave'
12
- gem 'rails_admin_jcrop' #, git: 'git://github.com/janx/rails_admin_jcrop.git'
7
+ ```ruby
8
+ gem 'rails_admin'
9
+ # Because rails_admin_jcrop autoload modules by checking plugins you use, it's
10
+ # recommended to require it explictly before rails_admin_jcrop
11
+ # e.g. if you use carrierwave
12
+ # gem 'carrierwave', :require => 'carrierwave'
13
+ gem 'rails_admin_jcrop' #, git: 'git://github.com/janx/rails_admin_jcrop.git'
14
+ ```
13
15
 
14
16
  2. Configure your model field to use Jcrop:
15
17
 
16
- # RAILS_ROOT/config/initializers/rails_admin.rb
17
- config.model User do
18
- configure :avatar, :jcrop
18
+ ```ruby
19
+ # RAILS_ROOT/config/initializers/rails_admin.rb
20
+ config.model User do
21
+ configure :avatar, :jcrop
19
22
 
20
- # Below is optional
21
- edit do
22
- field :avatar do
23
- jcrop_options aspectRatio: 500.0/320.0
24
- end
25
- end
26
- end
23
+ # Below is optional
24
+ edit do
25
+ field :avatar do
26
+ jcrop_options aspectRatio: 500.0/320.0
27
+ end
28
+ end
29
+ end
30
+ ```
27
31
 
28
32
  3. If you use Paperclip, you need to do nothing here, rails_admin_jcrop will append RailsAdminJcropper processor to your attachment automatically. If CarrierWave is used, please invoke :rails_admin_crop in your uploader:
29
33
 
30
- class AvatarUploader < CarrierWave::Uploader::Base
34
+ ```ruby
35
+ class AvatarUploader < CarrierWave::Uploader::Base
31
36
 
32
- version :thumb do
33
- process :rails_admin_crop
34
- process :resize_to_fill: [500,320]
35
- end
37
+ version :thumb do
38
+ process :rails_admin_crop
39
+ process :resize_to_fill: [500,320]
40
+ end
36
41
 
37
- end
42
+ end
43
+ ```
38
44
 
39
45
  4. Done! Click the image on your RailsAdmin model edit page and enjoy cropping!
40
46
  ![Cropping Screenshot](https://github.com/janx/rails_admin_jcrop/raw/master/screenshots/example.png)
@@ -51,9 +57,11 @@
51
57
 
52
58
  You can pass any Jcrop plugin allowed options here, for example, use `aspectRatio` to fix the ratio of selection box:
53
59
 
54
- field :avatar do
55
- jcrop_options aspectRatio: 500.0/320.0
56
- end
60
+ ```ruby
61
+ field :avatar do
62
+ jcrop_options aspectRatio: 500.0/320.0
63
+ end
64
+ ```
57
65
 
58
66
  Please check [Jcrop document](http://deepliquid.com/content/Jcrop_Manual.html#Setting_Options) for more available options.
59
67
 
@@ -61,9 +69,11 @@ Please check [Jcrop document](http://deepliquid.com/content/Jcrop_Manual.html#Se
61
69
 
62
70
  By default, image is scaled properly to make cropping more easy, but sometimes the image is still too large to fit in the modal window, you may need to scroll image up/down to crop. If you set `fit_image` to true, image will always be resized to fit in modal window.
63
71
 
64
- field :avatar do
65
- fit_image true
66
- end
72
+ ```ruby
73
+ field :avatar do
74
+ fit_image true
75
+ end
76
+ ```
67
77
 
68
78
  Check screenshots below to see the difference:
69
79
 
@@ -123,6 +133,7 @@ Any help is encouraged. Here are some ways you can contribute:
123
133
  * [Alan Rosin Sikora](https://github.com/alansikora) ([alansikora](https://github.com/alansikora))
124
134
  * [cec](https://github.com/cec)
125
135
  * [Alex Chien](https://github.com/AlexChien)
136
+ * [Mitsuhiro Shibuya]([mshibuya](https://github.com/mshibuya))
126
137
 
127
138
  ### And ... ###
128
139
 
@@ -30,8 +30,8 @@ module RailsAdmin
30
30
  end
31
31
 
32
32
  RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
33
- if properties[:name] == :jcrop
34
- fields << RailsAdmin::Config::Fields::Types::Jcrop.new(parent, properties[:name], properties)
33
+ if (properties.respond_to?(:name) ? properties.name : properties[:name]) == :jcrop
34
+ fields << RailsAdmin::Config::Fields::Types::Jcrop.new(parent, :jcrop, properties)
35
35
  true
36
36
  else
37
37
  false
@@ -1,3 +1,3 @@
1
1
  module RailsAdminJcrop
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_jcrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Xie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2014-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.0.3
109
+ rubygems_version: 2.1.11
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Jcrop plugin for rails admin.