[Git][noosfero/noosfero][master] 2 commits: api: fix image upload for blocks
Victor Costa
gitlab at mg.gitlab.com
Thu Dec 22 18:39:36 BRST 2016
Victor Costa pushed to branch master at Noosfero / noosfero
Commits:
106def22 by Leonardo Soares at 2016-12-22T16:12:32-03:00
api: fix image upload for blocks
- - - - -
6c7ba5b9 by Victor Costa at 2016-12-22T20:39:33+00:00
Merge branch 'upload-image-blocks' into 'master'
api: fix image upload for blocks
See merge request !1072
- - - - -
2 changed files:
- app/api/entities.rb
- app/models/block.rb
Changes:
=====================================
app/api/entities.rb
=====================================
--- a/app/api/entities.rb
+++ b/app/api/entities.rb
@@ -48,6 +48,7 @@ module Api
class Image < Entity
root 'images', 'image'
+ expose :id
expose :filename
expose :url do |image, options|
image.public_filename
=====================================
app/models/block.rb
=====================================
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -325,7 +325,7 @@ class Block < ApplicationRecord
def images_builder=(raw_images)
raw_images.each do |img|
- if img[:remove_image] == 'true'
+ if img[:remove_image] == true || img[:remove_image] == 'true'
images.find_by(id: img[:id]).destroy!
elsif !img[:uploaded_data].blank?
images.build(img)
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/204763243a541f18d9d0037beffb0e2e2d8c3715...6c7ba5b937541c5daedcdfceb532b66a30cc692d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20161222/33da5df1/attachment-0001.html>
More information about the Noosfero-dev
mailing list