activeadmin-selleo-cms 0.0.43 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- data/app/admin/activeadmin_selleo_cms/image.rb +5 -1
- data/app/assets/images/activeadmin-selleo-cms/Jcrop.gif +0 -0
- data/app/assets/javascripts/active_admin.js +2 -0
- data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +28 -0
- data/app/assets/javascripts/activeadmin-selleo-cms/inline-editing.js +14 -0
- data/app/assets/javascripts/activeadmin-selleo-cms/jquery.Jcrop.js +1694 -0
- data/app/assets/stylesheets/active_admin/cms.css.scss +1 -0
- data/app/assets/stylesheets/active_admin/jquery.Jcrop.css +165 -0
- data/app/models/activeadmin_selleo_cms/asset.rb +1 -1
- data/app/models/activeadmin_selleo_cms/image.rb +16 -2
- data/app/models/activeadmin_selleo_cms/layout.rb +1 -1
- data/app/views/admin/assets/edit.js.erb +0 -0
- data/app/views/admin/images/_crop_form.html.haml +16 -0
- data/app/views/admin/images/_form.html.haml +1 -0
- data/app/views/admin/images/crop.js.erb +1 -0
- data/app/views/admin/pages/_form.html.haml +10 -5
- data/app/views/admin/pages/_translated_fields.html.haml +48 -48
- data/app/views/admin/pages/edit.js.erb +1 -0
- data/config/initializers/cropper.rb +29 -0
- data/lib/activeadmin-selleo-cms/version.rb +1 -1
- metadata +10 -1
@@ -3,6 +3,10 @@ ActiveAdmin.register ActiveadminSelleoCms::Image, as: 'Image' do
|
|
3
3
|
|
4
4
|
form :partial => "form"
|
5
5
|
|
6
|
+
member_action :crop, :method => :get do
|
7
|
+
@image = ActiveadminSelleoCms::Image.find(params[:id])
|
8
|
+
end
|
9
|
+
|
6
10
|
controller do
|
7
11
|
respond_to :html, :js
|
8
12
|
|
@@ -11,7 +15,7 @@ ActiveAdmin.register ActiveadminSelleoCms::Image, as: 'Image' do
|
|
11
15
|
private
|
12
16
|
|
13
17
|
def set_styles
|
14
|
-
params[:image][:data] = params[:image].delete :data
|
18
|
+
params[:image][:data] = params[:image].delete :data if params[:image][:data]
|
15
19
|
end
|
16
20
|
|
17
21
|
public
|
Binary file
|
@@ -22,6 +22,34 @@ function fileManager(url){
|
|
22
22
|
}).dialog('open');
|
23
23
|
}
|
24
24
|
|
25
|
+
function updateCrop(coords) {
|
26
|
+
$('#image_crop_x').val(coords.x);
|
27
|
+
$('#image_crop_y').val(coords.y);
|
28
|
+
$('#image_crop_w').val(coords.w);
|
29
|
+
$('#image_crop_h').val(coords.h);
|
30
|
+
}
|
31
|
+
|
32
|
+
function cropImage(asset_id, width, height) {
|
33
|
+
$('#file-manager').html('').load('/admin/images/'+asset_id+'/crop.js', function() {
|
34
|
+
$(this).dialog("option", "position", ['center', 'center'] );
|
35
|
+
$(this).find('img').Jcrop({
|
36
|
+
minSize: [ width, height ],
|
37
|
+
aspectRatio: width/height,
|
38
|
+
allowMove: true,
|
39
|
+
allowResize: true,
|
40
|
+
onChange: updateCrop,
|
41
|
+
onSelect: updateCrop,
|
42
|
+
setSelect: [0, 0, width, height]
|
43
|
+
});
|
44
|
+
}).dialog('open');
|
45
|
+
}
|
46
|
+
|
47
|
+
function editPage(page_id) {
|
48
|
+
$('#file-manager').html('').load('/admin/pages/'+page_id+'/edit.js', function() {
|
49
|
+
$(this).dialog("option", "position", ['center', 'center'] );
|
50
|
+
}).dialog('open');
|
51
|
+
}
|
52
|
+
|
25
53
|
function delete_asset(asset_id) {
|
26
54
|
if(confirm('Are you sure?')) {
|
27
55
|
$.ajax({
|
@@ -0,0 +1,14 @@
|
|
1
|
+
//= require jquery.ui.dialog
|
2
|
+
//= require jquery.ui.draggable
|
3
|
+
//= require jquery.ui.droppable
|
4
|
+
//= require jquery.ui.sortable
|
5
|
+
//= require jquery.iframe-transport.js
|
6
|
+
//= require jquery.remotipart.js
|
7
|
+
//= require ckeditor/init
|
8
|
+
//= require ckeditor/plugins/inlinesave/plugin
|
9
|
+
//= require ckeditor/toolbars
|
10
|
+
//= require activeadmin-selleo-cms/custom
|
11
|
+
//= require activeadmin-selleo-cms/jquery-ui-timepicker-addon
|
12
|
+
//= require activeadmin-selleo-cms/jquery.Jcrop
|
13
|
+
//= require jquery.ui.effect-highlight
|
14
|
+
//= require jquery.ui.tabs
|