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.
@@ -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
@@ -5,3 +5,5 @@
5
5
  //= require 'activeadmin-selleo-cms/jquery-ui-timepicker-addon.js'
6
6
  //= require 'jquery.iframe-transport.js'
7
7
  //= require 'jquery.remotipart.js'
8
+ //= require 'activeadmin-selleo-cms/jquery.Jcrop'
9
+ //= require jquery.ui.effect-highlight
@@ -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