ack_rails_admin_jcrop 0.0.3 → 0.0.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6be68f7add71d4fa568ceaade4035e7422e705a
|
4
|
+
data.tar.gz: fa922ff3e42d6bf637ab383c7520b483745b398a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b8d78a2f9271f0d28c40f9a6d59dd155ef770cb7438de716b74f6e98abb7e30ea7b864596a529c16e892b1b04ff86e06093271fea367fe59e4e4c2d1a63402
|
7
|
+
data.tar.gz: 95a535e8ecd264493415a8b5eefb41b67a1e28319232c71d3915a049cc5beedd59507ca644c1ecc6b900826e7bf81eea3d282b670ab8d7bf277006b5f70cec48
|
@@ -5,11 +5,37 @@
|
|
5
5
|
var widget = this;
|
6
6
|
var dom_widget = widget.element;
|
7
7
|
|
8
|
-
var thumbnailLink = dom_widget.find('.jcrop_data_value');
|
8
|
+
var thumbnailLink = dom_widget.find('.jcrop_data_value .preview');
|
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;
|
12
12
|
});
|
13
|
+
dom_widget.find('[data-fileupload]').unbind("change").bind("change", function() {
|
14
|
+
var input = this;
|
15
|
+
var image_container = $("#" + input.id).parent().children(".preview");
|
16
|
+
if (image_container.length > 0) {
|
17
|
+
if (image_container[0].tagName != "img") {
|
18
|
+
image_container.parent().removeClass("jcrop_data_value");
|
19
|
+
image_container.remove();
|
20
|
+
}
|
21
|
+
image_container = $("#" + input.id).parent().children(".preview");
|
22
|
+
}
|
23
|
+
if (image_container.length == 0) {
|
24
|
+
image_container = $("#" + input.id).parent().prepend($('<img />').addClass('preview')).find('img.preview');
|
25
|
+
image_container.parent().find('img:not(.preview)').hide();
|
26
|
+
ext = $("#" + input.id).val().split('.').pop().toLowerCase();
|
27
|
+
}
|
28
|
+
if (input.files && input.files[0] && $.inArray(ext, ['gif', 'png', 'jpg', 'jpeg', 'bmp']) != -1) {
|
29
|
+
reader = new FileReader();
|
30
|
+
reader.onload = function (e) {
|
31
|
+
image_container.attr("src", e.target.result);
|
32
|
+
};
|
33
|
+
reader.readAsDataURL(input.files[0]);
|
34
|
+
image_container.show();
|
35
|
+
} else {
|
36
|
+
image_container.hide();
|
37
|
+
}
|
38
|
+
})
|
13
39
|
},
|
14
40
|
|
15
41
|
_bindModalOpening: function(e, url) {
|
@@ -49,6 +75,7 @@
|
|
49
75
|
|
50
76
|
var jcrop_options = $.extend({
|
51
77
|
bgColor: 'white',
|
78
|
+
bgOpacity: 0.4,
|
52
79
|
keySupport: false,
|
53
80
|
onSelect: widget.updateCoordinates
|
54
81
|
}, widget.element.find('input[data-rails-admin-jcrop-options]').data('rails-admin-jcrop-options'));
|
@@ -130,7 +157,7 @@
|
|
130
157
|
show: true
|
131
158
|
})
|
132
159
|
.on('hidden.bs.modal', function(){
|
133
|
-
$(document).unbind("keyup")
|
160
|
+
$(document).unbind("keyup");
|
134
161
|
widget.dialog.remove(); // We don't want to reuse closed modals
|
135
162
|
widget.dialog = null;
|
136
163
|
});
|
@@ -1,11 +1,13 @@
|
|
1
1
|
.jcrop_data_value
|
2
2
|
cursor: pointer
|
3
3
|
display: inline-block
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
.preview
|
5
|
+
&:hover
|
6
|
+
.title_link_hint
|
7
|
+
font-weight: bold
|
8
|
+
&:active
|
9
|
+
.title_link_hint
|
10
|
+
color: black
|
9
11
|
.title_link_hint
|
10
12
|
color: blue
|
11
13
|
display: inline-block
|
@@ -18,3 +20,7 @@
|
|
18
20
|
|
19
21
|
.jcrop-holder, .jcrop-subject
|
20
22
|
max-width: 960px !important
|
23
|
+
|
24
|
+
.jcrop-holder
|
25
|
+
border: 1px solid black
|
26
|
+
margin: 0px auto
|
@@ -14,11 +14,12 @@
|
|
14
14
|
|
15
15
|
- file = form.object.send(field.method_name).presence
|
16
16
|
|
17
|
-
|
17
|
+
- _add_class = field.pretty_value ? "jcrop_data_value" : ""
|
18
|
+
.toggle{class="#{_add_class}" style=('display:none;' if file and field.delete_method and form.object.send(field.delete_method) == '1')}
|
18
19
|
- if value = field.pretty_value
|
19
|
-
.
|
20
|
+
.preview
|
20
21
|
.title_link_hint= "Обрезать"
|
21
|
-
|
22
|
+
.image_block
|
22
23
|
= value
|
23
24
|
= form.file_field(field.name, field.html_attributes.reverse_merge({data: {fileupload: true, rails_admin_jcrop_options: rails_admin_jcrop_options } }))
|
24
25
|
|
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.
|
4
|
+
version: 0.0.4
|
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-06-
|
12
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|