udongo 7.0.1 → 7.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: 6ebe5d0ae0452bf3d7e74d1f177c2a6bb9573a4d
4
- data.tar.gz: ee18f273a09e0fbf35d6e1ff632e4cb59e811db3
3
+ metadata.gz: 1e840d9bb18fba2da849e3c6ec733ab2c6f8fd88
4
+ data.tar.gz: a354bc901b32d59bec7010afbfed60ce5eef60ec
5
5
  SHA512:
6
- metadata.gz: 20d5a992a3ca9f53d8637140f1077e06abcc04603fc79a76719f4dc670e9554a4a47f76650331206b9a5c588bcf2e30f049e4a52f45a730e1c9e17fcbd2cedcf
7
- data.tar.gz: c382e849537dbecc8b893c0d77def603691d843b070587035da5885d43a8e5ecfd25fb22f2552c0ceac421859aa9a0a32e7fc12045e8f87eabbd5d9c7b392c0e
6
+ metadata.gz: 4e93e8f31f091510d4cf03d597727db9342cc57ba31e6e9e79d8fee47f8b896756625a3b1f12269fdc5500e0e10639ab959bfa3f5e9d211d347d1b00705f020b
7
+ data.tar.gz: c72873d2fda0032e8139ccbe587d09900e21e0fe76f8067299f891add9570ba3a7da60a2b2603ba5d672778b6076552196ea7c92d8150c63c102760e33b0ecbc
data/changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ 7.0.2 - 2017-09-21
2
+ --
3
+ * Fix issue with the locale duplication class not being found.
4
+
5
+
1
6
  7.0.1 - 2017-09-21
2
7
  --
3
8
  * Removed some unused translations.
@@ -1,86 +1,90 @@
1
- class Udongo::FlexibleContent::DuplicateLocale
2
- def initialize(object, source_locale, destination_locale)
3
- @object = object
4
- @source_locale = source_locale
5
- @destination_locale = destination_locale
6
- end
1
+ module Udongo
2
+ module FlexibleContent
3
+ class DuplicateLocale
4
+ def initialize(object, source_locale, destination_locale)
5
+ @object = object
6
+ @source_locale = source_locale
7
+ @destination_locale = destination_locale
8
+ end
7
9
 
8
- def execute!
9
- check_for_flexible_content!
10
- check_for_different_locales!
10
+ def execute!
11
+ check_for_flexible_content!
12
+ check_for_different_locales!
11
13
 
12
- ActiveRecord::Base.transaction do
13
- clear_destination_content!
14
+ ActiveRecord::Base.transaction do
15
+ clear_destination_content!
14
16
 
15
- @object.content_rows.by_locale(@source_locale).each do |source_row|
16
- new_row = duplicate_row(source_row)
17
+ @object.content_rows.by_locale(@source_locale).each do |source_row|
18
+ new_row = duplicate_row(source_row)
17
19
 
18
- source_row.columns.each do |source_column|
19
- duplicate_column(new_row, source_column)
20
+ source_row.columns.each do |source_column|
21
+ duplicate_column(new_row, source_column)
22
+ end
23
+ end
20
24
  end
21
25
  end
22
- end
23
- end
24
26
 
25
- private
27
+ private
26
28
 
27
- def check_for_flexible_content!
28
- return if @object.respond_to?(:flexible_content?) && @object.flexible_content?
29
- raise 'The object you provided does not have the FlexibleContent concern included.'
30
- end
29
+ def check_for_flexible_content!
30
+ return if @object.respond_to?(:flexible_content?) && @object.flexible_content?
31
+ raise 'The object you provided does not have the FlexibleContent concern included.'
32
+ end
31
33
 
32
- def check_for_different_locales!
33
- if @source_locale.to_s == @destination_locale.to_s
34
- raise "The source and destination locale are the same (#{@source_locale})"
35
- end
36
- end
34
+ def check_for_different_locales!
35
+ if @source_locale.to_s == @destination_locale.to_s
36
+ raise "The source and destination locale are the same (#{@source_locale})"
37
+ end
38
+ end
37
39
 
38
- def clear_destination_content!
39
- @object.content_rows.by_locale(@destination_locale).destroy_all
40
- end
40
+ def clear_destination_content!
41
+ @object.content_rows.by_locale(@destination_locale).destroy_all
42
+ end
41
43
 
42
- def duplicate_row(source)
43
- @object.content_rows.create!(
44
- locale: @destination_locale,
45
- full_width: source.full_width?,
46
- horizontal_alignment: source.horizontal_alignment,
47
- vertical_alignment: source.vertical_alignment,
48
- background_color: source.background_color,
49
- no_gutters: source.no_gutters?,
50
- padding_top: source.padding_top,
51
- padding_bottom: source.padding_bottom,
52
- margin_top: source.margin_top,
53
- margin_bottom: source.margin_bottom,
54
- position: source.position
55
- )
56
- end
44
+ def duplicate_row(source)
45
+ @object.content_rows.create!(
46
+ locale: @destination_locale,
47
+ full_width: source.full_width?,
48
+ horizontal_alignment: source.horizontal_alignment,
49
+ vertical_alignment: source.vertical_alignment,
50
+ background_color: source.background_color,
51
+ no_gutters: source.no_gutters?,
52
+ padding_top: source.padding_top,
53
+ padding_bottom: source.padding_bottom,
54
+ margin_top: source.margin_top,
55
+ margin_bottom: source.margin_bottom,
56
+ position: source.position
57
+ )
58
+ end
57
59
 
58
- def duplicate_column(new_row, source_column)
59
- widget = duplicate_widget(source_column.content)
60
+ def duplicate_column(new_row, source_column)
61
+ widget = duplicate_widget(source_column.content)
60
62
 
61
- new_row.columns.create!(
62
- width_xs: source_column.width_xs,
63
- width_sm: source_column.width_sm,
64
- width_md: source_column.width_md,
65
- width_lg: source_column.width_lg,
66
- width_xl: source_column.width_xl,
67
- position: source_column.position,
68
- content: widget,
69
- external_reference: source_column.id
70
- )
71
- end
63
+ new_row.columns.create!(
64
+ width_xs: source_column.width_xs,
65
+ width_sm: source_column.width_sm,
66
+ width_md: source_column.width_md,
67
+ width_lg: source_column.width_lg,
68
+ width_xl: source_column.width_xl,
69
+ position: source_column.position,
70
+ content: widget,
71
+ external_reference: source_column.id
72
+ )
73
+ end
72
74
 
73
- def duplicate_widget(source)
74
- source.class.create!(
75
- widget_attributes(source)
76
- )
77
- end
75
+ def duplicate_widget(source)
76
+ source.class.create!(
77
+ widget_attributes(source)
78
+ )
79
+ end
78
80
 
79
- def widget_attributes(widget)
80
- attributes = widget.attributes
81
- attributes.delete('id')
82
- attributes.delete('created_at')
83
- attributes.delete('updated_at')
84
- attributes
81
+ def widget_attributes(widget)
82
+ attributes = widget.attributes
83
+ attributes.delete('id')
84
+ attributes.delete('created_at')
85
+ attributes.delete('updated_at')
86
+ attributes
87
+ end
88
+ end
85
89
  end
86
90
  end
@@ -1,3 +1,3 @@
1
1
  module Udongo
2
- VERSION = '7.0.1'
2
+ VERSION = '7.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: udongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davy Hellemans