ecoportal-api-v2 0.9.4 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 221d5b580361d663ead77df095ca7dd833b758c4b5ee1abca477cb0f4e2ac07f
4
- data.tar.gz: 2c22b60ee833628b5c21209bc00b42a29b456b3e42283c04113113f4687ae71c
3
+ metadata.gz: 9502632e0f39a86587a093fb54bcadcd42b7a3db38ed98d5ec35ea5a56a9b257
4
+ data.tar.gz: 393ff91c773c047ffa031350a88af80f395847f326ec4b13011f33dc2477c6b5
5
5
  SHA512:
6
- metadata.gz: 2a95f288bc76b1f18187bc6dbc612ce5d034d6ea6655829ea309acbe53862051c388701de9c99c58b76fd41a40e4ae6d1c1fea4343e077b70da610addf1e9bac
7
- data.tar.gz: c72c8eba1d55203ff3fa4c3d6d1d3ec76c922e99897ec41b300d97138526d8b1df8391ddf75ec410b25246699a2afcf49958914c58c7a8a0f6484ffe504428de
6
+ metadata.gz: c7733b21b7d7dec324c7561cb495e83ffc39f6e567eb5332613590ca914f611ec8361d6a356506f4f6eb846f0cbc5f7361e6235e9c1eb0b992ef7010dff0d093
7
+ data.tar.gz: 80d8a90e09c22ddd80854fa4d38ab6b7b6c0d533db3f694059818f20573c9a2f023888f3959fa8c67db8a37a6bbb9597a1d66fda0485e418c4197fcd1788d9e3
data/CHANGELOG.md CHANGED
@@ -1,16 +1,32 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.9.5] - 2022-11-xx
4
+ ## [0.9.7] - 2022-11-xx
5
5
 
6
6
  ### Added
7
7
  ### Changed
8
8
  ### Fixed
9
+ - `Ecoportal::API::V2::Page::Component#bindings`
10
+
11
+ ## [0.9.6] - 2022-11-18
12
+
13
+ ### Added
14
+ - `Ecoportal::API::V2::Page::Stage#components`
15
+ - `Ecoportal::API::V2::Page::Component#replace`
16
+ - `Ecoportal::API::V2::Page::Force::Binding#replace`
17
+
18
+ ### Fixed
19
+ - `Ecoportal::API::V2::Page::Component#bindings`
20
+
21
+ ## [0.9.5] - 2022-11-17
22
+
23
+ ### Fixed
24
+ - `Ecoportal::API::V2::Page::Component::ImagesField#empty?` missed to add this one.
9
25
 
10
26
  ## [0.9.4] - 2022-11-15
11
27
 
12
28
  ### Added
13
- - `Ecoportal::API::V2::Page::Component::Image#add_image`
29
+ - `Ecoportal::API::V2::Page::Component::ImagesField#add_image`
14
30
  - `empty?` method to components
15
31
 
16
32
  ## [0.9.3] - 2022-10-11
@@ -17,6 +17,10 @@ module Ecoportal
17
17
  passboolean :strech, :no_popup, :hide_options
18
18
  embeds_many :images, klass: "Ecoportal::API::V2::Page::Component::Image", order_key: :weight
19
19
 
20
+ def empty?
21
+ images.empty?
22
+ end
23
+
20
24
  def add_image(upload_id, pos: NOT_USED, before: NOT_USED, after: NOT_USED)
21
25
  image_doc = images.items_class.new_doc
22
26
  images.upsert!(image_doc, pos: pos, before: before, after: after) do |image|
@@ -139,7 +139,6 @@ module Ecoportal
139
139
  ooze.forces.each_with_object([]) do |force, out|
140
140
  out.push(*force.bindings.get_by_reference(self))
141
141
  end
142
- out
143
142
  end
144
143
 
145
144
  # @return [Array<Ecoportal::API::V2::Page::Force] the forces this component is bound to if any.
@@ -154,6 +153,22 @@ module Ecoportal
154
153
  forces.count > 0
155
154
  end
156
155
 
156
+ # If the field has bindings they are replaced by this new field
157
+ # @note careful with this, depending what's done in the force, this may brake the force.
158
+ def replace(fld)
159
+ if fld.section
160
+ fld.move(section: self.section, before: self)
161
+ else
162
+ self.section.add(fld, before: self)
163
+ end
164
+ replace_bindings(fld)
165
+ self.delete!
166
+ end
167
+
168
+ def replace_bindings(fld)
169
+ bindings.map {|b| b.replace(fld)}
170
+ end
171
+
157
172
  def delete!
158
173
  bindings.each {|b| b.delete!}
159
174
  self.unattach!
@@ -53,6 +53,12 @@ module Ecoportal
53
53
  self.component? ? component : section
54
54
  end
55
55
 
56
+ def replace(mem_sec)
57
+ self._parent.add(mem_sec, name: self.name, before: self) do |bind|
58
+ self.delete! if bind
59
+ end
60
+ end
61
+
56
62
  def delete!
57
63
  self._parent.delete!(self)
58
64
  end
@@ -21,6 +21,10 @@ module Ecoportal
21
21
  self._parent.ooze
22
22
  end
23
23
 
24
+ def components
25
+ sections.map(&:components).flatten(1).uniq
26
+ end
27
+
24
28
  # @yield [section] do some stuff with section.
25
29
  # @yieldparam section [Ecoportal::API::V2::Page::Section] one of the sections of this stage
26
30
  # @return [Array<Ecoportal::API::V2::Page::Section>] sections attached to this stage.
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GEM2_VERSION = "0.9.4"
3
+ GEM2_VERSION = "0.9.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-15 00:00:00.000000000 Z
11
+ date: 2022-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler