ack_rails_admin_jcrop 0.0.1 → 0.0.2

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: 1c45c721d62676e69f072cb3ed919257336a9ee0
4
- data.tar.gz: 983bc219258fb286d126992fbcd836567c9f4ea7
3
+ metadata.gz: a4f0c2fb571d80ca926baf496b823b681c8ddb2a
4
+ data.tar.gz: 60d44c3be2f7f01c5f00f7a868306ae31dde55b4
5
5
  SHA512:
6
- metadata.gz: f9968c92d86cc7c4b5b68bd93e8be7ae21665c97b19df14947e3dcb7f1094fc3ebd50b330596ce307b87ee5fac0f537f11aaba63273ec9cf160643c3bed950d9
7
- data.tar.gz: 372e2985f1122b124d586bd1bf80eeaa6afe2f8278e2fdf3cc5ef7cc4a282fa422bda4d4c079e8259f37a9f68ab36eb4521ef181c4a24ff1867dcf1f635b65ce
6
+ metadata.gz: c68157026b39feca78a3e1bdc75a60bf06e5bda3430bef960960a5a9bcfb677f58b25bd4c7bef22f9be4ff073a438c46c4a9e38702915f3d29c3fd70b4cc002b
7
+ data.tar.gz: 3203270f31dec56969c9401dfc7957a229ffe42ed7aec7a48558fca7ffe5d0997b625d94709edfb81b5c5c461a403901602715327938afa066c063df9e50075d
@@ -5,7 +5,7 @@
5
5
  var widget = this;
6
6
  var dom_widget = widget.element;
7
7
 
8
- var thumbnailLink = dom_widget.find('img.img-polaroid').parent();
8
+ var thumbnailLink = dom_widget.find('.jcrop_data_value');
9
9
  thumbnailLink.unbind().bind("click", function(e){
10
10
  widget._bindModalOpening(e, dom_widget.find('a.jcrop_handle').data('link'));
11
11
  return false;
@@ -77,7 +77,7 @@
77
77
  var select = widget.element.find('select').filter(":hidden");
78
78
 
79
79
  thumb = widget.element.find('a.jcrop_handle').data('thumb');
80
- widget.element.find('img.img-polaroid').removeAttr('src').attr('src', json.urls[thumb] + '?' + new Date().valueOf());
80
+ widget.element.find('.jcrop_data_value img').removeAttr('src').attr('src', json.urls[thumb] + '?' + new Date().valueOf());
81
81
 
82
82
  widget._trigger("success");
83
83
  dialog.modal("hide");
@@ -1,6 +1,8 @@
1
- .jcrop_type
2
- .img-polaroid
3
- min-width: 50px
1
+ .jcrop_data_value
2
+ cursor: pointer
3
+
4
+ .jcrop_data_value img, .jcrop_type .img-polaroid
5
+ min-width: 50px
4
6
 
5
7
  .jcrop-holder, .jcrop-subject
6
8
  max-width: 960px !important
@@ -1,4 +1,11 @@
1
- - rails_admin_jcrop_options = field.jcrop_options.to_json
1
+ - if field.jcrop_options.is_a?(Hash)
2
+ - rails_admin_jcrop_options = field.jcrop_options.to_json
3
+ - else
4
+ - _method = field.jcrop_options.to_sym
5
+ - if form.object.respond_to?(_method)
6
+ - rails_admin_jcrop_options = form.object.send(field.jcrop_options.to_sym).to_json
7
+ - else
8
+ - rails_admin_jcrop_options = {}
2
9
 
3
10
  = stylesheet_link_tag 'rails_admin/jquery.Jcrop'
4
11
  = stylesheet_link_tag 'rails_admin/ra.jcrop'
@@ -9,7 +16,7 @@
9
16
 
10
17
  .toggle{style=('display:none;' if file and field.delete_method and form.object.send(field.delete_method) == '1')}
11
18
  - if value = field.pretty_value
12
- = value
19
+ .jcrop_data_value= value
13
20
  = form.file_field(field.name, field.html_attributes.reverse_merge({data: {fileupload: true, rails_admin_jcrop_options: rails_admin_jcrop_options } }))
14
21
 
15
22
  - url = jcrop_path(model_name: form.object.class.to_param, modal: true, id: form.object.id, field: field.name, fit_image: field.fit_image)
@@ -6,7 +6,7 @@ module RailsAdminJcrop
6
6
  end
7
7
 
8
8
  def crop!(obj, field)
9
- obj.send(field).reprocess!
9
+ obj.send(field).reprocess! && obj.save
10
10
  end
11
11
  end
12
12
  end
@@ -17,7 +17,6 @@ module Paperclip
17
17
  module NewClassMethods
18
18
  def has_attached_file(*args)
19
19
  super
20
-
21
20
  self.attachment_definitions.each do |name, options|
22
21
  options[:processors] ||= []
23
22
  options[:processors] << :rails_admin_jcropper
@@ -1,3 +1,3 @@
1
1
  module RailsAdminJcrop
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ack_rails_admin_jcrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ack43
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-23 00:00:00.000000000 Z
12
+ date: 2015-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails