promethee 4.1.9 → 4.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/promethee.sass +11 -0
  3. data/app/views/promethee/components/aside/_show.html.erb +2 -1
  4. data/app/views/promethee/components/blockquote/_show.html.erb +2 -1
  5. data/app/views/promethee/components/collection/_show.html.erb +2 -1
  6. data/app/views/promethee/components/collection_item/_show.html.erb +5 -3
  7. data/app/views/promethee/components/column/_show.html.erb +2 -1
  8. data/app/views/promethee/components/cover/_show.html.erb +3 -1
  9. data/app/views/promethee/components/faq/_show.html.erb +2 -1
  10. data/app/views/promethee/components/faq_item/_show.html.erb +2 -1
  11. data/app/views/promethee/components/image/_show.html.erb +2 -1
  12. data/app/views/promethee/components/page/_show.html.erb +2 -1
  13. data/app/views/promethee/components/row/_show.html.erb +1 -0
  14. data/app/views/promethee/components/slider/_show.html.erb +11 -7
  15. data/app/views/promethee/components/slider_item/_show.html.erb +3 -2
  16. data/app/views/promethee/components/table/_edit.inspect.html.erb +1 -3
  17. data/app/views/promethee/components/table/_edit.move.html.erb +2 -2
  18. data/app/views/promethee/components/table/_show.html.erb +10 -3
  19. data/app/views/promethee/components/table_cell/_edit.define.html.erb +1 -1
  20. data/app/views/promethee/components/table_cell/_edit.inspect.html.erb +1 -0
  21. data/app/views/promethee/components/table_cell/_edit.move.html.erb +1 -0
  22. data/app/views/promethee/components/table_cell/_localize.html.erb +2 -2
  23. data/app/views/promethee/components/table_cell/_show.html.erb +1 -0
  24. data/app/views/promethee/components/text/_show.html.erb +2 -1
  25. data/app/views/promethee/components/video/_show.html.erb +2 -1
  26. data/app/views/promethee/presets/_image-with-text.html.erb +1 -1
  27. data/lib/promethee/core_ext/tags.rb +12 -10
  28. data/lib/promethee/rails/helper.rb +9 -1
  29. data/lib/promethee/rails/version.rb +1 -1
  30. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d70442f21dcf78fd221ab2fd1d4043434e3ce8b6ef962ae7834179a439234de6
4
- data.tar.gz: 79359c33b7f75ac12791c50c3dd400775557ffd6238c2a032b39263fe378fa0d
3
+ metadata.gz: a0f9aa0e77a8e849cdd8342fe18743536c033f23799c5d9102b2b385dabaae32
4
+ data.tar.gz: ff506afde6c8864d8044157b6975e5af4dad9b149f96152ca493b0557f90cfaf
5
5
  SHA512:
6
- metadata.gz: 03c978f8966ce1437e326ee439c0cc50cbf2868fda3efabef784138932f9c0040580650a1550a585f21ef81e4e995304d56dbc1742bbe8f7500f89cdea8f9643
7
- data.tar.gz: 101c397d3e626b2e862654741456e7978cd35cb29c916d7385809c657a4dc62c50c01240145fbb97763a1b5b4f8351ed5395d4fb2769923bfa3ddc5118f35edd
6
+ metadata.gz: be067209b5e1bdcb607bdfa54af4e929369f2d3a66b3d395bd12ea1c23f6088fb658527a762638acf8f3ea6c27a0067cd05895663af81ff99b2b12a5d826e9b3
7
+ data.tar.gz: 260e42af1d557b4d78cfe26cc549b7921e51b3ed65561646a13b0cbd64de25bd2a7f123e0ec720156c5dd1b7736933607a0c607a69aeb59e4129c9e6480e6ee6
@@ -160,6 +160,17 @@ $black: #000000 !default
160
160
  .fontawesome-carousel-control .fa
161
161
  font-size: 30px
162
162
 
163
+ &__table
164
+ tr
165
+ p
166
+ margin-bottom: 0
167
+ &.empty
168
+ background-color: #EEEEEE
169
+ td
170
+ line-height: 1px
171
+ padding-bottom: 1px
172
+ padding-top: 1px
173
+
163
174
 
164
175
  // component direct in root
165
176
  &__page > &__blockquote,
@@ -5,7 +5,8 @@
5
5
  open_label_position = component[:attributes].dig(:open_label_position, :value)&.to_s
6
6
  %>
7
7
 
8
- <aside class="<%= promethee_class_for component %> aside">
8
+ <aside class="<%= promethee_class_for component %> aside"
9
+ id="<%= promethee_id_for component %>">
9
10
  <div class="promethee__component__row">
10
11
  <div class="promethee__component__content">
11
12
  <div class="aside__content">
@@ -3,7 +3,8 @@
3
3
  author = component[:attributes].dig(:author, :value)&.to_s
4
4
  %>
5
5
 
6
- <div class="<%= promethee_class_for(component) %>">
6
+ <div class="<%= promethee_class_for(component) %>"
7
+ id="<%= promethee_id_for component %>">
7
8
  <div class="promethee__component__row">
8
9
  <div class="promethee__component__content">
9
10
  <blockquote class="blockquote">
@@ -12,7 +12,8 @@
12
12
  end
13
13
  %>
14
14
 
15
- <div class="row <%= promethee_class_for component %>">
15
+ <div class="row <%= promethee_class_for component %>"
16
+ id="<%= promethee_id_for component %>">
16
17
  <% component[:children].each.with_index do |child, n| %>
17
18
  <div class="<%= col_classes %>">
18
19
  <%= render 'promethee/show/component', component: child %>
@@ -17,8 +17,8 @@ when 'video'
17
17
  end
18
18
  end
19
19
  %>
20
- <div class="collection-item__content">
21
-
20
+ <div class="<%= promethee_class_for component %> collection-item__content"
21
+ id="<%= promethee_id_for component %>">
22
22
  <% if iframe_src.present? %>
23
23
  <div class="embed-responsive embed-responsive-16by9">
24
24
  <iframe frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" src="<%= iframe_src %>"></iframe>
@@ -26,5 +26,7 @@ end
26
26
  <% elsif image_blob.present? %>
27
27
  <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: caption %>
28
28
  <% end %>
29
- <%= caption %>
29
+ <div class="collection-item__content__caption">
30
+ <%= caption %>
31
+ </div>
30
32
  </div>
@@ -41,6 +41,7 @@ if component[:attributes].dig(:mobile, :value, :enabled, :value)
41
41
  classes += " col-xs-#{size} col-xs-offset-#{offset}" # BS3, does nothing for BS4
42
42
  end
43
43
  %>
44
- <div class="<%= classes %> <%= promethee_class_for component %>">
44
+ <div class="<%= classes %> <%= promethee_class_for component %>"
45
+ id="<%= promethee_id_for component %>">
45
46
  <%= render 'promethee/show/components', components: component[:children] %>
46
47
  </div>
@@ -5,7 +5,9 @@ surtitle = component[:attributes].dig(:surtitle, :value)&.to_s
5
5
  title = component[:attributes].dig(:title, :value)&.to_s
6
6
  subtitle = component[:attributes].dig(:subtitle, :value)&.to_s
7
7
  %>
8
- <div id="component-<%= component[:id] %>" class="<%= promethee_class_for(component) %>" style="background-image: url(<%= url_for(blob.variant(resize: '1920>', quality: 95)) if blob %>)">
8
+ <div class="<%= promethee_class_for(component) %>"
9
+ id="<%= promethee_id_for component %>"
10
+ style="background-image: url(<%= url_for(blob.variant(resize: '1920>', quality: 95)) if blob %>)">
9
11
  <div class="container">
10
12
  <div class="promethee__component__row">
11
13
  <div class="promethee__component__content">
@@ -1,4 +1,5 @@
1
- <div class="<%= promethee_class_for component %>">
1
+ <div class="<%= promethee_class_for component %>"
2
+ id="<%= promethee_id_for component %>">
2
3
  <div class="promethee__component__row">
3
4
  <div class="promethee__component__content">
4
5
  <% component[:children].each do |child| %>
@@ -6,7 +6,8 @@ special_question = component[:attributes].dig(:special_question, :value)
6
6
  image_blob = blob_from_data component[:attributes].dig(:image, :value)
7
7
  %>
8
8
 
9
- <div class="<%= promethee_class_for component %> <%= 'promethee__component__faq_item--special' if special_question %>">
9
+ <div class="<%= promethee_class_for component %> <%= 'promethee__component__faq_item--special' if special_question %>"
10
+ id="<%= promethee_id_for component %>">
10
11
  <h4 data-toggle="collapse"
11
12
  data-target="#collapse-faq-<%= component[:id] %>"
12
13
  aria-expanded="false"
@@ -4,7 +4,8 @@ blob = blob_from_data component[:attributes].dig(:image, :value)
4
4
  alt = component[:attributes].dig(:alt, :value)&.to_s
5
5
  caption = component[:attributes].dig(:caption, :value)&.to_s
6
6
  %>
7
- <figure class="<%= promethee_class_for component %>">
7
+ <figure class="<%= promethee_class_for component %>"
8
+ id="<%= promethee_id_for component %>">
8
9
  <div class="promethee__component__row">
9
10
  <div class="promethee__component__content">
10
11
  <%= render 'promethee/show/image.srcset', blob: blob, alt: alt, caption: caption if blob %>
@@ -11,6 +11,7 @@
11
11
  <script><%= javascripts %></script>
12
12
  <% end %>
13
13
 
14
- <div class="<%= promethee_class_for component %>">
14
+ <div class="<%= promethee_class_for component %>"
15
+ id="<%= promethee_id_for component %>">
15
16
  <%= render 'promethee/show/components', components: component[:children] %>
16
17
  </div>
@@ -22,6 +22,7 @@ end
22
22
  %>
23
23
 
24
24
  <div class="row <%= promethee_class_for component %><%= ' promethee__component__row--background' if has_background %>"
25
+ id="<%= promethee_id_for component %>"
25
26
  style="background-color: <%= background_color %>; <%= background_images.count > 0 ? "background-repeat: no-repeat; background-image: #{background_images.join(', ')}; background-position: #{background_positions.join(', ')}; background-size: #{background_sizes.join(', ')};" : '' %>">
26
27
  <%= render 'promethee/show/components', components: component[:children] %>
27
28
  </div>
@@ -1,4 +1,6 @@
1
- <div id="slider-<%= component[:id] %>" class="carousel slide <%= promethee_class_for component %>" data-ride="carousel">
1
+ <div class="carousel slide <%= promethee_class_for component %>"
2
+ id="<%= promethee_id_for component %>"
3
+ data-ride="carousel">
2
4
  <div class="carousel-inner">
3
5
  <% component[:children].each.with_index do |item, n| %>
4
6
  <div class="carousel-item item<%= ' active' if n.zero? %>">
@@ -7,10 +9,12 @@
7
9
  <% end %>
8
10
  </div>
9
11
 
10
- <a class="left carousel-control fontawesome-carousel-control carousel-control-prev" href="#slider-<%= component[:id] %>" data-slide="prev">
11
- <%= icon('fa', 'chevron-left') %>
12
- </a>
13
- <a class="right carousel-control fontawesome-carousel-control carousel-control-next" href="#slider-<%= component[:id] %>" data-slide="next">
14
- <%= icon('fa', 'chevron-right') %>
15
- </a>
12
+ <% if component[:children].many? %>
13
+ <a class="left carousel-control fontawesome-carousel-control carousel-control-prev" href="#<%= promethee_id_for component %>" data-slide="prev">
14
+ <%= icon('fa', 'chevron-left') %>
15
+ </a>
16
+ <a class="right carousel-control fontawesome-carousel-control carousel-control-next" href="#<%= promethee_id_for component %>" data-slide="next">
17
+ <%= icon('fa', 'chevron-right') %>
18
+ </a>
19
+ <% end %>
16
20
  </div>
@@ -17,13 +17,14 @@ when 'video'
17
17
  end
18
18
  end
19
19
  %>
20
- <div class="carousel-item__content">
20
+ <div class="<%= promethee_class_for component %> carousel-item__content"
21
+ id="<%= promethee_id_for component %>">
21
22
  <% if iframe_src.present? %>
22
23
  <div class="embed-responsive embed-responsive-16by9">
23
24
  <iframe frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" src="<%= iframe_src %>"></iframe>
24
25
  </div>
25
26
  <% elsif image_blob.present? %>
26
- <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: caption %>
27
+ <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: caption, image_zoomable: false %>
27
28
  <% end %>
28
29
  <div class="carousel-item__content__caption">
29
30
  <%= caption %>
@@ -48,9 +48,7 @@
48
48
  {{ getTableCell(getHeaderCellUids()[$index]).attributes.text.value }}
49
49
  </span>
50
50
  <br/>
51
- <input type="text"
52
- ng-model="getTableCell(cellUid).attributes.text.value"
53
- class="form-control" />
51
+ <summernote config="summernoteConfig" ng-model="getTableCell(cellUid).attributes.text.value"></summernote>
54
52
  </div>
55
53
  </div>
56
54
  <hr>
@@ -5,14 +5,14 @@
5
5
  <thead>
6
6
  <tr>
7
7
  <th ng-repeat="cellUid in component.attributes.structure.value[0]">
8
- {{getTableCell(cellUid).attributes.text.value}}
8
+ <div ng-bind-html="getTableCell(cellUid).attributes.text.value | htmlSafe"></div>
9
9
  </th>
10
10
  </tr>
11
11
  </thead>
12
12
  <tbody>
13
13
  <tr ng-repeat="row in component.attributes.structure.value" ng-if="$index > 0">
14
14
  <td ng-repeat="cellUid in row">
15
- {{getTableCell(cellUid).attributes.text.value}}
15
+ <div ng-bind-html="getTableCell(cellUid).attributes.text.value | htmlSafe"></div>
16
16
  </td>
17
17
  </tr>
18
18
  </tbody>
@@ -4,7 +4,7 @@
4
4
  row.map { |cellUid|
5
5
  {
6
6
  uid: cellUid,
7
- text: cells.find { |cell| cell[:id] == cellUid }.dig(:attributes, :text, :value)
7
+ text: cells.find { |cell| cell[:id] == cellUid }.dig(:attributes, :text, :value)&.html_safe
8
8
  }
9
9
  }
10
10
  }
@@ -12,7 +12,8 @@
12
12
  headerRow = rows.shift
13
13
  %>
14
14
 
15
- <div id="component-<%= component[:id] %>" class="<%= promethee_class_for(component) %>">
15
+ <div class="<%= promethee_class_for(component) %>"
16
+ id="<%= promethee_id_for component %>">
16
17
  <% unless headerRow.nil? %>
17
18
  <div class="table-responsive">
18
19
  <table class="table">
@@ -25,7 +26,13 @@
25
26
  </thead>
26
27
  <tbody>
27
28
  <% rows.each do |row| %>
28
- <tr>
29
+ <%
30
+ row_class = 'empty'
31
+ row.each do |cell|
32
+ row_class = '' unless cell[:text].blank?
33
+ end
34
+ %>
35
+ <tr class="<%= row_class %>">
29
36
  <% row.each do |cell| %>
30
37
  <td><%= cell[:text] %></td>
31
38
  <% end %>
@@ -11,7 +11,7 @@
11
11
  text: {
12
12
  searchable: true,
13
13
  translatable: true,
14
- type: 'string',
14
+ type: 'text',
15
15
  value: ''
16
16
  }
17
17
  }
@@ -0,0 +1 @@
1
+ <%# Defined in components/table/_edit.inspect.html.erb %>
@@ -0,0 +1 @@
1
+ <%# Defined in components/table/_edit.move.html.erb %>
@@ -2,11 +2,11 @@
2
2
  <div class="row mt-2" ng-show="master.attributes.text.value || frozen_component.attributes.text.value">
3
3
  <div class="col-md-6">
4
4
  <b>Text</b>
5
- <p>{{ master.attributes.text.value }}</p>
5
+ <div ng-bind-html="master.attributes.text.value | htmlSafe"></div>
6
6
  </div>
7
7
  <div class="col-md-6">
8
8
  <b>Text</b>
9
- <input class="form-control" ng-model="component.attributes.text.value" type="text">
9
+ <summernote config="summernoteConfig" ng-model="component.attributes.text.value"></summernote>
10
10
  </div>
11
11
  </div>
12
12
  </script>
@@ -0,0 +1 @@
1
+ <%# Defined in components/table/_show.html.erb %>
@@ -1,7 +1,8 @@
1
1
  <%
2
2
  body = component[:attributes].dig(:body, :value)&.to_s&.html_safe
3
3
  %>
4
- <div class="<%= promethee_class_for component %>">
4
+ <div class="<%= promethee_class_for component %>"
5
+ id="<%= promethee_id_for component %>">
5
6
  <div class="promethee__component__row">
6
7
  <div class="promethee__component__content">
7
8
  <%= body %>
@@ -14,7 +14,8 @@ else
14
14
  iframe_src = url
15
15
  end
16
16
  %>
17
- <div class="<%= promethee_class_for component %>">
17
+ <div class="<%= promethee_class_for component %>"
18
+ id="<%= promethee_id_for component %>">
18
19
  <div class="promethee__component__row">
19
20
  <div class="promethee__component__content">
20
21
  <div class="embed-responsive embed-responsive-16by9">
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  angular.injector(['ng', 'Promethee']).get('presets').push({
3
3
  name: 'Image with text',
4
- icon: <%= render('promethee/presets/icon.image-with-text').to_json.html_safe %>,
4
+ icon: <%= promethee_preset_render_icon 'image-with-text' %>,
5
5
  position: 1,
6
6
  components: [
7
7
  {
@@ -9,7 +9,8 @@ module ActionView
9
9
  @options[:master_data] = object.send @method_name unless object.nil?
10
10
  @options[:master_data] = @options[:value] if @options.key?(:value)
11
11
  @options[:disable_page_attributes] ||= false
12
- ApplicationController.renderer.render partial: 'promethee/edit', locals: @options
12
+
13
+ @template_object.render partial: 'promethee/edit', locals: @options
13
14
  end
14
15
  end
15
16
 
@@ -18,15 +19,16 @@ module ActionView
18
19
  localization_data = object.send @method_name unless object.nil?
19
20
  localization_data = @options[:value] if @options.include? :value
20
21
  @options[:disable_page_attributes] ||= false
21
- ApplicationController.renderer.render partial: 'promethee/localize',
22
- locals: {
23
- object_name: @object_name,
24
- method_name: @method_name,
25
- localization_data: localization_data,
26
- master_data: @options[:master],
27
- other_data: @options[:other],
28
- disable_page_attributes: @options[:disable_page_attributes]
29
- }
22
+
23
+ @template_object.render partial: 'promethee/localize',
24
+ locals: {
25
+ object_name: @object_name,
26
+ method_name: @method_name,
27
+ localization_data: localization_data,
28
+ master_data: @options[:master],
29
+ other_data: @options[:other],
30
+ disable_page_attributes: @options[:disable_page_attributes]
31
+ }
30
32
  end
31
33
  end
32
34
  end
@@ -3,7 +3,7 @@ module Promethee::Rails::Helper
3
3
  render partial: 'promethee/show', locals: { master_data: data, localization_data: options[:l] }
4
4
  end
5
5
 
6
- def promethee_class_for component, *modifiers
6
+ def promethee_class_for(component, *modifiers)
7
7
  base = "promethee__component"
8
8
  component_base = "#{base}__#{component[:type]}"
9
9
 
@@ -14,6 +14,10 @@ module Promethee::Rails::Helper
14
14
  ].flatten.select(&:present?).join ' '
15
15
  end
16
16
 
17
+ def promethee_id_for(component)
18
+ "promethee-component-#{component[:id]}"
19
+ end
20
+
17
21
  def promethee_component_partials
18
22
  promethee_partials_for 'components/*/_edit.*.html.erb'
19
23
  end
@@ -22,6 +26,10 @@ module Promethee::Rails::Helper
22
26
  render("promethee/components/#{icon}/icon.svg").to_json.html_safe
23
27
  end
24
28
 
29
+ def promethee_preset_render_icon(icon)
30
+ render("promethee/presets/icon.#{icon}.svg").to_json.html_safe
31
+ end
32
+
25
33
  def promethee_util_partials
26
34
  promethee_partials_for 'utils/_*.html.erb'
27
35
  end
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '4.1.9'
3
+ VERSION = '4.1.14'
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.9
4
+ version: 4.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Gaya
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-08-31 00:00:00.000000000 Z
17
+ date: 2020-10-02 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails