promethee 4.1.4 → 4.1.9

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: b869c8cec07785cdb8427016f34e55e5612a5a2dce7b1dbae9acd17bd59b865f
4
- data.tar.gz: 2509a1cbad91a556c0c1aef60f86e04697544aeca4a944ebe3f8a3654c5c9307
3
+ metadata.gz: d70442f21dcf78fd221ab2fd1d4043434e3ce8b6ef962ae7834179a439234de6
4
+ data.tar.gz: 79359c33b7f75ac12791c50c3dd400775557ffd6238c2a032b39263fe378fa0d
5
5
  SHA512:
6
- metadata.gz: bbfdedf786eb854e48ad92d3342f0242d4b22499b20a82cf3b4cfe5d55deccb45881979c93833516f54304645b762b6f54f36f1c00533dc8ff6958ee1f23781e
7
- data.tar.gz: 55a68a0dc69657784d2d7d6dd45651b18c4835eea3295688f886d3cadf2bb41058285453bd10d00a61b94c1ffd3a84dbdebd2ce65050fb5b5ab479c8924f20be
6
+ metadata.gz: 03c978f8966ce1437e326ee439c0cc50cbf2868fda3efabef784138932f9c0040580650a1550a585f21ef81e4e995304d56dbc1742bbe8f7500f89cdea8f9643
7
+ data.tar.gz: 101c397d3e626b2e862654741456e7978cd35cb29c916d7385809c657a4dc62c50c01240145fbb97763a1b5b4f8351ed5395d4fb2769923bfa3ddc5118f35edd
@@ -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>
@@ -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>
@@ -25,5 +25,7 @@ end
25
25
  <% elsif image_blob.present? %>
26
26
  <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: caption %>
27
27
  <% end %>
28
- <%= caption %>
28
+ <div class="carousel-item__content__caption">
29
+ <%= caption %>
30
+ </div>
29
31
  </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.4'
3
+ VERSION = '4.1.9'
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.4
4
+ version: 4.1.9
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-31 00:00:00.000000000 Z
17
+ date: 2020-08-31 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