ecm_pictures2_backend 2.0.1 → 2.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: 7e99b6973529cd20af56583ea2cbec224c19961d
4
- data.tar.gz: 2c2b6f5527d6ff8f1d96c8cb3a508d4fc85d8a2e
3
+ metadata.gz: 700744373fc780dd88f36e9459cda0a6bf790cf2
4
+ data.tar.gz: de6d2f89b0cdee79d1bbff819beb9353a505d971
5
5
  SHA512:
6
- metadata.gz: ccd58650d2e0d7197dead24e435bec8eda0aabbf715d08778e87f32b8a26aa062fd21e7e49a4ac8584c66b064f4665d18b15ec8193e9aef3055c72cd15e21247
7
- data.tar.gz: bbfc5db8bf3e8bed5e8082fbb2817485263cd5be95a8f299433ce67b9a5a2dc6d0ba5db77ba2027f99e08951c2ee90dc491161139158bdcbe543c14c1e1e10ba
6
+ metadata.gz: 0a2086394c8917c32741b252ba0c427eeee46a7f997efba62c6de7022de2b0eb9410d873f12ea0493401837729ca1de4c03d414eec122d8fe881a2a64bdbf6ed
7
+ data.tar.gz: ae15260cd8b9e3ba0fb0afd584270fdb4f6f8692fa88f0677b60844918b1c4aa4f11e26976717cb213a4b936fbb3bf281d2125ea0d3da1da5ecff29a8a646f98
@@ -6,11 +6,10 @@ class Ecm::Pictures::Backend::PicturesController < Itsf::Backend::Resource::Base
6
6
  private
7
7
 
8
8
  def request_includes_base64_image?
9
- params[:ecm_pictures_picture].key?(:image_base64) && params[:ecm_pictures_picture][:image_base64].present?
9
+ params[:ecm_pictures_picture].key?(:image_base64)
10
10
  end
11
11
 
12
- def extract_base64
13
- encoded_image = params[:ecm_pictures_picture].delete(:image_base64)
12
+ def extract_image_base64(encoded_image)
14
13
  decoded_image = Base64.decode64(encoded_image.gsub(/^data\:image\/\w+\;base64\,/, '')).force_encoding('UTF-8')
15
14
  content_type = encoded_image.split(';').first.split(':').last
16
15
  basename = 'image'
@@ -23,9 +22,13 @@ class Ecm::Pictures::Backend::PicturesController < Itsf::Backend::Resource::Base
23
22
  end
24
23
 
25
24
  def permitted_params
26
- permitted_params = params
27
- .require(:ecm_pictures_picture)
28
- .permit(:picture_gallery_id, :name, :markup_language, :description, :image, :tag_list)
29
- permitted_params.merge(image: extract_base64) if request_includes_base64_image?
25
+ processed_params = params.deep_dup
26
+ image_base64 = processed_params[:ecm_pictures_picture].try(:delete, :image_base64)
27
+ if image_base64.present?
28
+ image = extract_image_base64(image_base64)
29
+ processed_params.merge!(image: extract_base64)
30
+ end
31
+ processed_params.require(:ecm_pictures_picture)
32
+ .permit(:picture_gallery_id, :name, :markup_language, :description, :image, :tag_list)
30
33
  end
31
34
  end
@@ -1,7 +1,7 @@
1
1
  module Ecm
2
2
  module Pictures
3
3
  module Backend
4
- VERSION = '2.0.1'.freeze
4
+ VERSION = '2.0.2'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_pictures2_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -276,4 +276,3 @@ signing_key:
276
276
  specification_version: 4
277
277
  summary: Backend Module for ECM Pictures 2
278
278
  test_files: []
279
- has_rdoc: