activeadmin-selleo-cms 0.0.38 → 0.0.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,16 @@ ActiveAdmin.register ActiveadminSelleoCms::Attachment, as: 'Attachment' do
6
6
  controller do
7
7
  respond_to :html, :js
8
8
 
9
+ before_filter :set_styles, only: [:create, :update]
10
+
11
+ private
12
+
13
+ def set_styles
14
+ params[:image][:cover] = params[:image].delete :cover
15
+ end
16
+
17
+ public
18
+
9
19
  def edit
10
20
  super do |format|
11
21
  format.html { render action: :edit, layout: false }
@@ -6,6 +6,16 @@ ActiveAdmin.register ActiveadminSelleoCms::Image, as: 'Image' do
6
6
  controller do
7
7
  respond_to :html, :js
8
8
 
9
+ before_filter :set_styles, only: [:create, :update]
10
+
11
+ private
12
+
13
+ def set_styles
14
+ params[:image][:data] = params[:image].delete :data
15
+ end
16
+
17
+ public
18
+
9
19
  def edit
10
20
  super do |format|
11
21
  format.html { render action: :edit, layout: false }
@@ -17,7 +27,6 @@ ActiveAdmin.register ActiveadminSelleoCms::Image, as: 'Image' do
17
27
  format.html { render action: :new, layout: false }
18
28
  end
19
29
  end
20
-
21
30
  end
22
31
 
23
32
  end
@@ -10,7 +10,7 @@ module ActiveadminSelleoCms
10
10
  has_attached_file :cover,
11
11
  :url => "/system/cms/covers/:id/:style_:basename.:extension",
12
12
  :path => ":rails_root/public/system/cms/covers/:id/:style_:basename.:extension",
13
- :styles => Proc.new{ |attachment| attachment.instance.image_sizes },
13
+ :styles => Proc.new{ |attachment| attachment.instance.cover_sizes },
14
14
  :default_style => :normal
15
15
 
16
16
  validates_attachment_size :cover, :less_than => 10.megabytes
@@ -20,7 +20,7 @@ module ActiveadminSelleoCms
20
20
  data.url(format)
21
21
  end
22
22
 
23
- def image_sizes
23
+ def cover_sizes
24
24
  { :normal => "#{cover_width || 120}x#{cover_height || 90}#{cover_resize_method || ">"}" }
25
25
  end
26
26
 
@@ -1,6 +1,6 @@
1
1
  module ActiveadminSelleoCms
2
2
  class Image < ActiveadminSelleoCms::Asset
3
- attr_accessor :image_width, :image_height, :resize_method, :cover_width, :cover_height
3
+ attr_accessor :image_width, :image_height, :resize_method
4
4
 
5
5
  has_attached_file :data,
6
6
  :url => "/system/cms/images/:id/:style_:basename.:extension",
@@ -3,8 +3,11 @@
3
3
  -#= @page.errors.full_messages
4
4
 
5
5
  = form.inputs id: 'image_fields' do
6
- = form.input :data, label: "Image", hint: (resource.data.exists? ? image_tag(resource.data.url, style: "max-width:520px") : "No image")
7
6
  = form.input :assetable_type, as: :hidden, input_html: { value: resource.assetable_type }
8
7
  = form.input :assetable_id, as: :hidden, input_html: { value: resource.assetable_id }
8
+ = form.input :image_width, as: :hidden, input_html: { value: resource.assetable.activeadmin_selleo_cms_section.width }
9
+ = form.input :image_height, as: :hidden, input_html: { value: resource.assetable.activeadmin_selleo_cms_section.height }
10
+ = form.input :resize_method, as: :hidden, input_html: { value: resource.assetable.activeadmin_selleo_cms_section.resize_method }
11
+ = form.input :data, label: "Image", hint: (resource.data.exists? ? image_tag(resource.data.url, style: "max-width:520px") : "No image")
9
12
  = form.input :caption
10
13
  = form.actions :submit
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.38"
2
+ VERSION = "0.0.39"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-selleo-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.39
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-12 00:00:00.000000000 Z
12
+ date: 2013-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails