promethee 4.1.3 → 4.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/promethee-edit/_move.sass +4 -2
  3. data/app/assets/stylesheets/promethee.sass +17 -8
  4. data/app/views/promethee/_localize.html.erb +9 -1
  5. data/app/views/promethee/components/aside/_edit.inspect.html.erb +3 -3
  6. data/app/views/promethee/components/aside/_localize.html.erb +2 -2
  7. data/app/views/promethee/components/blockquote/_edit.define.html.erb +1 -1
  8. data/app/views/promethee/components/blockquote/_localize.html.erb +2 -2
  9. data/app/views/promethee/components/collection/_edit.inspect.html.erb +4 -4
  10. data/app/views/promethee/components/collection_item/_edit.inspect.html.erb +2 -2
  11. data/app/views/promethee/components/collection_item/_localize.html.erb +2 -2
  12. data/app/views/promethee/components/cover/_localize.html.erb +4 -4
  13. data/app/views/promethee/components/faq_item/_localize.html.erb +1 -1
  14. data/app/views/promethee/components/image/_localize.html.erb +3 -3
  15. data/app/views/promethee/components/page/_localize.html.erb +1 -1
  16. data/app/views/promethee/components/slider_item/_localize.html.erb +2 -2
  17. data/app/views/promethee/components/table_cell/_localize.html.erb +8 -10
  18. data/app/views/promethee/components/text/_localize.html.erb +1 -1
  19. data/app/views/promethee/components/video/_localize.html.erb +1 -1
  20. data/app/views/promethee/edit/_radiobuttons.html.erb +1 -1
  21. data/app/views/promethee/show/_image.srcset.html.erb +1 -1
  22. data/lib/promethee/data/localization.rb +21 -5
  23. data/lib/promethee/rails/version.rb +1 -1
  24. metadata +10 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e91ca04c762aa3d0a47a07c44702de24ee1d34f1b6d488623c72f7b94198cd6a
4
- data.tar.gz: b5b97483969c8cac91180a2e04b351b393c17e61a986dffa3fcc3c716dfab390
3
+ metadata.gz: 90a33ce9e6312e37485cedecf012ec40d94192351e6e401167e32422eef6e190
4
+ data.tar.gz: 9dd9dd15ca827d6b5ddca45fe561b97b9bd866160c0e2ae2e159ba12fe0bf71d
5
5
  SHA512:
6
- metadata.gz: b7952215fec899231ef7f66a4d8c23bed46418b92b2845816fa6f19885f1958268aa69a4cd7a6757e44e783c0ca66215038d981f435a139f633e025c391ceb10
7
- data.tar.gz: bd26801c9f12d5cfa9f6bff198738e6453842574f6473b6c26a1bd9e3e5b1b11200a096de91434d5b449e37c5a8dd75518e3dedd8de0b896d718ab2facd47705
6
+ metadata.gz: 392c05d4d2adafd32d51056c221d3a8c9f690e2a7c46c1b57ebdae481667dce00cf0790841a9db746ec3bec9c4be2200e81720d592b3aa5ac753480b358c761f
7
+ data.tar.gz: 65c267a80b55d9dd606f49d4980f38ea875c13a2d69e92587407093b40e399d8d87857e01e9ec972ec1db343ad7c4e1891c53e08ed1c3e895fb6588ef0d08045
@@ -6,10 +6,12 @@
6
6
  line-height: 100%
7
7
  &__inner
8
8
  border: 1px solid #CCCCCC
9
- min-height: 50px
9
+ display: flex
10
+ flex-direction: column
11
+ justify-content: center
12
+ min-height: 70px
10
13
  position: relative
11
14
  p.text-empty
12
- line-height: 50px
13
15
  margin-bottom: 0
14
16
  &--selected
15
17
  > .promethee-edit__component__inner
@@ -164,20 +164,26 @@ $black: #000000 !default
164
164
  // component direct in root
165
165
  &__page > &__blockquote,
166
166
  &__page > &__cover
167
- .promethee__component__content
168
- @extend .col-md-8
169
- @extend .offset-md-2 !optional
170
- @extend .col-md-offset-2 !optional
167
+ .promethee__component
168
+ &__row
169
+ @extend .row
170
+ &__content
171
+ @extend .col-md-8
172
+ @extend .offset-md-2 !optional
173
+ @extend .col-md-offset-2 !optional
171
174
 
172
175
  &__page > &__aside,
173
176
  &__page > &__faq,
174
177
  &__page > &__image,
175
178
  &__page > &__text,
176
179
  &__page > &__video
177
- .promethee__component__content
178
- @extend .col-md-10
179
- @extend .offset-md-1 !optional
180
- @extend .col-md-offset-1 !optional
180
+ .promethee__component
181
+ &__row
182
+ @extend .row
183
+ &__content
184
+ @extend .col-md-10
185
+ @extend .offset-md-1 !optional
186
+ @extend .col-md-offset-1 !optional
181
187
 
182
188
 
183
189
  @media screen and (max-width: 767.98px)
@@ -187,6 +193,9 @@ $black: #000000 !default
187
193
  &__page > &__video
188
194
  padding-left: 0
189
195
  padding-right: 0
196
+ .promethee__component__row
197
+ margin-left: 0
198
+ margin-right: 0
190
199
  .promethee__component__content
191
200
  padding-left: 0
192
201
  padding-right: 0
@@ -53,11 +53,17 @@ promethee_masters_multiple = Promethee::Data::MastersMultiple.new master_data, o
53
53
  $scope.data = <%= promethee_data.to_json.html_safe %>;
54
54
  $scope.masters = mastersMultiple;
55
55
  $scope.masters.set(<%= promethee_masters_multiple.to_json.html_safe %>);
56
+
56
57
  $scope.$watch('data', function(new_val, old_val) {
57
58
  if (old_val != new_val) {
58
59
  window.warnBeforeUnload.lock();
59
60
  }
60
61
  }, true);
62
+
63
+ $scope.freezeData = function (data) {
64
+ return JSON.parse(JSON.stringify(data));
65
+ };
66
+
61
67
  $scope.copyTranslations = function(event) {
62
68
  event.preventDefault();
63
69
  if (confirm('Warning: this will overwrite every translations!')) {
@@ -97,7 +103,9 @@ promethee_masters_multiple = Promethee::Data::MastersMultiple.new master_data, o
97
103
  ng-controller="PrometheeLocalizerController as prometheeLocalizerController">
98
104
 
99
105
  <script type="text/ng-template" id="promethee/localize/component">
100
- <span class="hidden d-none">{{ master = masters.masterForComponent(component) }}</span>
106
+ <span class="hidden d-none" ng-init="frozen_component = freezeData(component)">
107
+ {{ master = masters.masterForComponent(component) }}
108
+ </span>
101
109
  <ng-include src="'promethee/components/' + component.type + '/localize'"></ng-include>
102
110
  </script>
103
111
 
@@ -17,9 +17,9 @@
17
17
  <div class="form-group">
18
18
  <label class="label-control">Button label position</label>
19
19
  <div>
20
- <label class="radio-inline"> <input ng-model="promethee.inspected.attributes.open_label_position.value" type="radio" value="left" />Left </label>
21
- <label class="radio-inline"> <input ng-model="promethee.inspected.attributes.open_label_position.value" type="radio" value="center" />Center </label>
22
- <label class="radio-inline"> <input ng-model="promethee.inspected.attributes.open_label_position.value" type="radio" value="right" />Right </label>
20
+ <label class="radio-inline form-check form-check-inline"> <input ng-model="promethee.inspected.attributes.open_label_position.value" type="radio" value="left" class="form-check-input" />Left </label>
21
+ <label class="radio-inline form-check form-check-inline"> <input ng-model="promethee.inspected.attributes.open_label_position.value" type="radio" value="center" class="form-check-input" />Center </label>
22
+ <label class="radio-inline form-check form-check-inline"> <input ng-model="promethee.inspected.attributes.open_label_position.value" type="radio" value="right" class="form-check-input" />Right </label>
23
23
  </div>
24
24
  </div>
25
25
  </script>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  </div>
16
16
 
17
- <div class="row" ng-show="master.attributes.collapsed_content.value">
17
+ <div class="row" ng-show="master.attributes.collapsed_content.value || frozen_component.attributes.collapsed_content.value">
18
18
  <div class="col-md-6">
19
19
  <b>Aside collapsed content</b>
20
20
  <div ng-bind-html="master.attributes.collapsed_content.value | htmlSafe"></div>
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
  </div>
29
29
 
30
- <div class="row" ng-show="master.attributes.collapsed_content.value">
30
+ <div class="row" ng-show="master.attributes.open_label.value || frozen_component.attributes.open_label.value">
31
31
  <div class="col-md-6">
32
32
  <b>Button label</b>
33
33
  <div ng-bind-html="master.attributes.open_label.value | htmlSafe"></div>
@@ -16,7 +16,7 @@
16
16
  },
17
17
  author: {
18
18
  searchable: true,
19
- translatable: false,
19
+ translatable: true,
20
20
  type: 'string',
21
21
  value: ''
22
22
  }
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/blockquote/localize">
2
- <div ng-show="master.attributes.body.value">
2
+ <div ng-show="master.attributes.body.value || frozen_component.attributes.body.value">
3
3
  <hr>
4
4
  <div class="row">
5
5
  <div class="col-md-6">
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </div>
17
17
 
18
- <div class="row" ng-show="master.attributes.author.value">
18
+ <div class="row" ng-show="master.attributes.author.value || frozen_component.attributes.author.value">
19
19
  <div class="col-md-6">
20
20
  <b>Author</b>
21
21
  <p>{{master.attributes.author.value}}</p>
@@ -3,16 +3,16 @@
3
3
  <label class="label-control">Items per line (on desktop):</label>
4
4
  <div class="row">
5
5
  <div class="col-xs-2 col-2">
6
- <input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="2"> 2
6
+ <label class="radio-inline form-check form-check-inline"><input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="2" class="form-check-input">2</label>
7
7
  </div>
8
8
  <div class="col-xs-2 col-2">
9
- <input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="3"> 3
9
+ <label class="radio-inline form-check form-check-inline"><input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="3" class="form-check-input">3</label>
10
10
  </div>
11
11
  <div class="col-xs-2 col-2">
12
- <input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="4"> 4
12
+ <label class="radio-inline form-check form-check-inline"><input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="4" class="form-check-input">4</label>
13
13
  </div>
14
14
  <div class="col-xs-2 col-2">
15
- <input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="6"> 6
15
+ <label class="radio-inline form-check form-check-inline"><input ng-model="promethee.inspected.attributes.items_per_line.value" type="radio" ng-value="6" class="form-check-input">6</label>
16
16
  </div>
17
17
  </div>
18
18
  </div>
@@ -2,8 +2,8 @@
2
2
  <div class="form-group">
3
3
  <label class="label-control">Media type</label>
4
4
  <div>
5
- <label class="radio-inline"> <input ng-model="promethee.inspected.attributes.media_type.value" type="radio" value="image" />Image </label>
6
- <label class="radio-inline"> <input ng-model="promethee.inspected.attributes.media_type.value" type="radio" value="video" />Video </label>
5
+ <label class="radio-inline form-check form-check-inline"> <input ng-model="promethee.inspected.attributes.media_type.value" type="radio" value="image" class="form-check-input" />Image </label>
6
+ <label class="radio-inline form-check form-check-inline"> <input ng-model="promethee.inspected.attributes.media_type.value" type="radio" value="video" class="form-check-input" />Video </label>
7
7
  </div>
8
8
  </div>
9
9
 
@@ -1,8 +1,8 @@
1
1
  <script type="text/ng-template" id="promethee/components/collection_item/localize">
2
- <div ng-show="master.attributes.caption.value !== '' || master.attributes.media_type.value == 'video'">
2
+ <div ng-show="master.attributes.caption.value || frozen_component.attributes.caption.value || master.attributes.media_type.value == 'video'">
3
3
  <hr>
4
4
 
5
- <div class="row" ng-show="master.attributes.caption.value !== ''">
5
+ <div class="row" ng-show="master.attributes.caption.value || frozen_component.attributes.caption.value">
6
6
  <div class="col-md-6">
7
7
  <b>Collection Item Caption</b>
8
8
  <div class="promethee-edit__wrapper" ng-bind-html="master.attributes.caption.value | htmlSafe"></div>
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/cover/localize">
2
- <div ng-show="master.attributes.surtitle.value || master.attributes.title.value || master.attributes.subtitle.value">
2
+ <div ng-show="master.attributes.surtitle.value || frozen_component.attributes.surtitle.value || master.attributes.title.value || frozen_component.attributes.title.value || master.attributes.subtitle.value || frozen_component.attributes.subtitle.value">
3
3
  <hr>
4
4
 
5
5
  <div class="row">
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
  </div>
10
10
 
11
- <div class="row" ng-show="master.attributes.surtitle.value">
11
+ <div class="row" ng-show="master.attributes.surtitle.value || frozen_component.attributes.surtitle.value">
12
12
  <div class="col-md-6">
13
13
  <b>Surtitle</b>
14
14
  <p>{{master.attributes.surtitle.value}}</p>
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  </div>
23
23
 
24
- <div class="row" ng-show="master.attributes.title.value">
24
+ <div class="row" ng-show="master.attributes.title.value || frozen_component.attributes.title.value">
25
25
  <div class="col-md-6">
26
26
  <b>Title</b>
27
27
  <p>{{master.attributes.title.value}}</p>
@@ -34,7 +34,7 @@
34
34
  </div>
35
35
  </div>
36
36
 
37
- <div class="row" ng-show="master.attributes.subtitle.value">
37
+ <div class="row" ng-show="master.attributes.subtitle.value || frozen_component.attributes.subtitle.value">
38
38
  <div class="col-md-6">
39
39
  <b>Subtitle</b>
40
40
  <p>{{master.attributes.subtitle.value}}</p>
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/faq_item/localize">
2
- <div ng-show="master.attributes.title.value">
2
+ <div ng-show="master.attributes.title.value || frozen_component.attributes.title.value">
3
3
  <hr>
4
4
  <div class="row">
5
5
  <div class="col-md-6">
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/image/localize">
2
- <div ng-show="master.attributes.alt.value || master.attributes.caption.value">
2
+ <div ng-show="master.attributes.alt.value || frozen_component.attributes.alt.value || master.attributes.caption.value || frozen_component.attributes.caption.value">
3
3
  <hr>
4
4
 
5
5
  <div class="row">
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  </div>
13
13
 
14
- <div class="row" ng-show="master.attributes.caption.value">
14
+ <div class="row" ng-show="master.attributes.caption.value || frozen_component.attributes.caption.value">
15
15
  <div class="col-md-6">
16
16
  <b>Caption</b>
17
17
  <p>{{master.attributes.caption.value}}</p>
@@ -25,7 +25,7 @@
25
25
  </div>
26
26
  </div>
27
27
 
28
- <div class="row" ng-show="master.attributes.alt.value">
28
+ <div class="row" ng-show="master.attributes.alt.value || frozen_component.attributes.alt.value">
29
29
  <div class="col-md-6">
30
30
  <b>Alt</b>
31
31
  <p>{{master.attributes.alt.value}}</p>
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </div>
17
17
 
18
- <div class="row" ng-show="master.attributes.description.value">
18
+ <div class="row" ng-show="master.attributes.description.value || frozen_component.attributes.description.value">
19
19
  <div class="col-md-6">
20
20
  <div>
21
21
  <b>Page description</b>
@@ -1,8 +1,8 @@
1
1
  <script type="text/ng-template" id="promethee/components/slider_item/localize">
2
- <div ng-show="master.attributes.caption.value !== '' || master.attributes.media_type.value == 'video'">
2
+ <div ng-show="master.attributes.caption.value || frozen_component.attributes.caption.value || master.attributes.media_type.value == 'video'">
3
3
  <hr>
4
4
 
5
- <div class="row" ng-show="master.attributes.caption.value !== ''">
5
+ <div class="row" ng-show="master.attributes.caption.value || frozen_component.attributes.caption.value">
6
6
  <div class="col-md-6">
7
7
  <b>Slider Item Caption</b>
8
8
  <div class="promethee-edit__wrapper" ng-bind-html="master.attributes.caption.value | htmlSafe"></div>
@@ -1,14 +1,12 @@
1
1
  <script type="text/ng-template" id="promethee/components/table_cell/localize">
2
- <div ng-show="master.attributes.text.value !== ''">
3
- <div class="row mt-2" ng-show="master.attributes.text.value !== ''">
4
- <div class="col-md-6">
5
- <b>Text</b>
6
- <p>{{ master.attributes.text.value }}</p>
7
- </div>
8
- <div class="col-md-6">
9
- <b>Text</b>
10
- <input class="form-control" ng-model="component.attributes.text.value" type="text">
11
- </div>
2
+ <div class="row mt-2" ng-show="master.attributes.text.value || frozen_component.attributes.text.value">
3
+ <div class="col-md-6">
4
+ <b>Text</b>
5
+ <p>{{ master.attributes.text.value }}</p>
6
+ </div>
7
+ <div class="col-md-6">
8
+ <b>Text</b>
9
+ <input class="form-control" ng-model="component.attributes.text.value" type="text">
12
10
  </div>
13
11
  </div>
14
12
  </script>
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/text/localize">
2
- <div ng-show="master.attributes.body.value">
2
+ <div ng-show="master.attributes.body.value || frozen_component.attributes.body.value">
3
3
  <hr>
4
4
  <div class="row">
5
5
  <div class="col-md-6">
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/video/localize">
2
- <div ng-show="master.attributes.url.value !== ''">
2
+ <div ng-show="master.attributes.url.value || frozen_component.attributes.url.value">
3
3
  <hr>
4
4
  <div class="row">
5
5
  <div class="col-md-6">
@@ -2,7 +2,7 @@
2
2
  <label class="label-control"><%= label %></label>
3
3
  <div style="margin-left: 2px">
4
4
  <% values.each do |value| %>
5
- <label class="radio-inline"> <input ng-model="<%= model %>" type="radio" value="<%= value %>" /><%= value.humanize %> </label>
5
+ <label class="radio-inline form-check form-check-inline"> <input ng-model="<%= model %>" type="radio" value="<%= value %>" class="form-check-input" /><%= value.humanize %> </label>
6
6
  <% end %>
7
7
  </div>
8
8
  </div>
@@ -3,7 +3,7 @@
3
3
  <% image_width = blob.metadata.has_key?(:width) ? blob.metadata[:width] : ActiveStorage::Analyzer::ImageAnalyzer.new(blob).metadata[:width] %>
4
4
 
5
5
  <% if image_zoomable %>
6
- <a data-fancybox title="<%= strip_tags(caption) %>" href="<%= fullsize_url %>">
6
+ <a data-fancybox="gallery" title="<%= strip_tags(caption) %>" href="<%= fullsize_url %>">
7
7
  <% end %>
8
8
  <img src="<%= fullsize_url %>"
9
9
  srcset="
@@ -11,11 +11,13 @@ class Promethee::Data::Localization < Promethee::Data
11
11
 
12
12
  # We want to be up to date with the master, so this method will:
13
13
  # 1.take the master's components flattened
14
- # 2 substitute what's already localized, based on the component id
14
+ # 2 substitute values of what's already localized, based on the component id
15
15
  # Consequences of step 1 are:
16
16
  # 1 it adds new components from the master
17
17
  # 2 it removes components not in the master anymore
18
18
  # 3 it takes the order from the master
19
+ # 4 use all translatable attributes from the master
20
+ # 5 merge them with translation values if they exist
19
21
  def merge
20
22
  @data_before_merge = @data.deep_dup
21
23
  @data = {
@@ -23,11 +25,10 @@ class Promethee::Data::Localization < Promethee::Data
23
25
  components: []
24
26
  }
25
27
  @master_data.flat.each do |master_component|
28
+ translatable_master_component = get_component_without_attributes_values(master_component)
26
29
  localized_component = find_localized_component master_component[:id]
27
- # We take the localized component if it exists, the master component otherwise
28
- component = localized_component || get_component_without_attributes_values(master_component)
29
- component[:attributes] ||= {}
30
- # We add it to the list of localized components
30
+
31
+ component = get_merged_translatable_component(translatable_master_component, localized_component)
31
32
  @data[:components] << component
32
33
  end
33
34
  end
@@ -43,6 +44,21 @@ class Promethee::Data::Localization < Promethee::Data
43
44
  clean_component
44
45
  end
45
46
 
47
+ def get_merged_translatable_component(master_component, localized_component)
48
+ # Not found in translation, we use the prepared master component
49
+ return master_component if localized_component.nil?
50
+
51
+ master_component[:attributes] ||= {}
52
+ localized_component[:attributes] ||= {}
53
+
54
+ # Merge values with the prepared master, allowing to add missing attributes from translation
55
+ master_component[:attributes].each do |attr_key, attr_value|
56
+ attr_value[:value] = localized_component.dig(:attributes, attr_key, :value) || ''
57
+ end
58
+
59
+ master_component
60
+ end
61
+
46
62
  def find_localized_component(id)
47
63
  return unless @data_before_merge
48
64
  return unless @data_before_merge.include? :components
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '4.1.3'
3
+ VERSION = '4.1.8'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promethee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.3
4
+ version: 4.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Gaya
@@ -14,22 +14,28 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-03-30 00:00:00.000000000 Z
17
+ date: 2020-08-24 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
21
21
  requirement: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - "~>"
23
+ - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: 5.2.0
26
+ - - "<"
27
+ - !ruby/object:Gem::Version
28
+ version: '6.1'
26
29
  type: :runtime
27
30
  prerelease: false
28
31
  version_requirements: !ruby/object:Gem::Requirement
29
32
  requirements:
30
- - - "~>"
33
+ - - ">="
31
34
  - !ruby/object:Gem::Version
32
35
  version: 5.2.0
36
+ - - "<"
37
+ - !ruby/object:Gem::Version
38
+ version: '6.1'
33
39
  - !ruby/object:Gem::Dependency
34
40
  name: angularjs-rails
35
41
  requirement: !ruby/object:Gem::Requirement