sibu 1.0.3 → 1.0.4

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
  SHA1:
3
- metadata.gz: 7991033d4b4015c8079d0952b34c7f11cb9a9e01
4
- data.tar.gz: 4b908d62c7a595af8127ab72b71c77f9abfd2095
3
+ metadata.gz: 48f219f6b806e3d5d5fbd7ce2df9224fd2e65b8a
4
+ data.tar.gz: 56fcfd81852d1cb3a11f4c0b4a3754cbf0f261c7
5
5
  SHA512:
6
- metadata.gz: eef44db76d0e344005e6070543eb9b8829b5c1fb751cdfdde9cd299bd9688686f6cf1b97335a404b14808ff0f8ddc7bfebac1610964c307c17743db68081b467
7
- data.tar.gz: 010ac8a10ff5cedb1e96d576354c600245a33f9b253bef5a07fab9fb3cca51344ebf8a529bb2621380dcb7977c554fae4edef5db4353c25aa022ffe7d2b6c401
6
+ metadata.gz: 10d19792d46338bd0bd7a3be61bad6547562e8e55edf252ee311727b7f02dfad823c95e66667f3e314ad6d3be30ca51a688028b0a1628f7d6ecfda46caf2e12d
7
+ data.tar.gz: 92ecb493f7f4f5986cb0c8f5936add93dd5d962fa7618c5eba06cbd40638bc73837ba0f9e94a6673968c3ec044685ac25fa5d2e37eb21cbd20c8e5b0eb41bad3
@@ -3,10 +3,21 @@
3
3
  *= require_self
4
4
  */
5
5
 
6
- .sibu_content_panel {
6
+ body.sibu_edit_content, .sibu_content_panel {
7
7
  position: relative
8
8
  }
9
9
 
10
+ body.sibu_edit_content > .sibu_panel:first-child {
11
+ position: fixed;
12
+ width: 100%;
13
+ z-index: 999999;
14
+ top: 0;
15
+ }
16
+
17
+ body.sibu_edit_content > .sibu_content_panel {
18
+ padding-top: 60px;
19
+ }
20
+
10
21
  .sb-editable {
11
22
  cursor: pointer;
12
23
  outline: dashed rgba(94, 219, 255, 0.8) 3px;
@@ -12,7 +12,7 @@
12
12
  <%= csrf_meta_tags %>
13
13
  <%= yield :styles %>
14
14
  </head>
15
- <body>
15
+ <body class="sibu_edit_content">
16
16
  <% [:top_panel, :side_panel, :content_panel, :bottom_panel].each do |panel| %>
17
17
  <% unless conf[panel].blank? %>
18
18
  <div class="<%= panel == :content_panel ? 'sibu_content_panel' : 'sibu_panel' %>">
@@ -74,7 +74,8 @@
74
74
  editMode.querySelector("#new_section_after").style.display = "block";
75
75
  editMode.querySelector("#delete_section").style.display = "block";
76
76
  }
77
- window.scrollTo(0, top);
77
+ var topPadding = top <= 120 ? 60 : 120;
78
+ window.scrollTo(0, top - topPadding);
78
79
  section.classList.add('sb-editing');
79
80
  initInnerOverlays(section);
80
81
  document.querySelector("#edit_overlays").innerHTML = "";
@@ -235,8 +236,8 @@
235
236
  container.innerHTML = "";
236
237
 
237
238
  for (var i = 0; i < sections.length; i++) {
238
- var sectionBox = sections[i].getBoundingClientRect();
239
- var yOffset = sectionBox.top - document.querySelector(".sibu_content_panel").getBoundingClientRect().top;
239
+ var sectionBox = eltBox(sections[i]);
240
+ var yOffset = sectionBox.top;
240
241
  var width = sections[i].offsetWidth, height = (sections[i].offsetHeight === 0 ? childrenHeight(sections[i]) : sections[i].offsetHeight);
241
242
  var overlay = document.createElement("div");
242
243
  overlay.setAttribute("data-sb-overlay", sections[i].getAttribute("data-sb-id"));
@@ -258,6 +259,25 @@
258
259
  }, 800);
259
260
  }
260
261
 
262
+ function eltBox(elt) {
263
+ var x, y, w, h, bbox = elt.getBoundingClientRect();
264
+ if (isIE()) {
265
+ x = bbox.left + window.scrollX;
266
+ y = bbox.top + window.scrollY;
267
+ } else {
268
+ x = bbox.x + window.scrollX;
269
+ y = bbox.y + window.scrollY;
270
+ }
271
+ w = bbox.width;
272
+ h = bbox.height;
273
+ return {top: y, left: x, width: w, height: h}
274
+ }
275
+
276
+ function isIE() {
277
+ let ua = navigator.userAgent;
278
+ return ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
279
+ }
280
+
261
281
  function childrenHeight(parentElt) {
262
282
  var height = 0, children = parentElt.querySelectorAll("*");
263
283
  for (var i = 0; i < children.length; i++) {
@@ -5,7 +5,7 @@
5
5
  <form class="edit_element_form" action="<%= update_element_site_page_path(@site.id, @page.id, format: :js) %>" accept-charset="UTF-8" method="patch">
6
6
  <div class="sibu_field">
7
7
  <%= label_tag 'element[code]', "Code d'intégration du contenu" %>
8
- <%= text_area_tag 'element[code]', @element["code"], placeholder: ' ex: <iframe src="..."></iframe>' %>
8
+ <%= text_area_tag 'element[code]', @element["code"], placeholder: 'ex: <iframe src="..."></iframe>' %>
9
9
  </div>
10
10
  <%= hidden_field_tag 'element[id]', @element["id"] %>
11
11
  <%= hidden_field_tag :element_id, @element_id %>
@@ -2,7 +2,7 @@
2
2
  <div class="actions">
3
3
  <%= link_to 'Retour', :back %>
4
4
  </div>
5
- <h2>Modifier une page</h2>
5
+ <h2>Réglages de la page</h2>
6
6
  <div class="sibu_form">
7
7
  <%= render 'form' %>
8
8
  </div>
@@ -86,8 +86,8 @@ setTimeout(function() {
86
86
  document.querySelector("#clone_elt").style.display = "inline-block";
87
87
  document.querySelector("#duplicate_elt").style.display = "inline-block";
88
88
  <% else %>
89
- document.querySelector("#clone_elt").remove();
90
- document.querySelector("#duplicate_elt").remove();
89
+ if (document.querySelector("#clone_elt")) document.querySelector("#clone_elt").remove();
90
+ if (document.querySelector("#duplicate_elt")) document.querySelector("#duplicate_elt").remove();
91
91
  <% end %>
92
92
 
93
93
  <% if @children %>
@@ -24,7 +24,7 @@
24
24
  <%= link_to 'Voir', site_page_path(@site.id, p), target: '_blank' %> |
25
25
  <%= link_to 'Editer', site_page_edit_content_path(site_id: @site.id, page_id: p.id) %> |
26
26
  <%= link_to 'Copier', duplicate_site_page_path(@site.id, p), method: :post, data: {confirm: "Copier la page \"#{p.name}\" ?"} %> |
27
- <%= link_to 'Paramétrer', edit_site_page_path(@site.id, p) %> |
27
+ <%= link_to 'Réglages', edit_site_page_path(@site.id, p) %> |
28
28
  <%= link_to 'Supprimer', site_page_path(@site.id, p), method: :delete, data: {confirm: "Supprimer la page \"#{p.name}\" ?"} %>
29
29
  </td>
30
30
  </tr>
@@ -24,7 +24,7 @@
24
24
  <td><%= l s.updated_at %></td>
25
25
  <td colspan="2">
26
26
  <%= link_to 'Pages', site_pages_path(s) %> |
27
- <%= link_to 'Paramétrer', edit_site_path(s) %> |
27
+ <%= link_to 'Réglages du site', edit_site_path(s) %> |
28
28
  <%= link_to 'Copier', duplicate_site_path(s), method: :post, data: {confirm: "Copier le site \"#{s.name}\" ?"} %> |
29
29
  <%= link_to 'Supprimer', site_path(s), method: :delete, data: {confirm: "Supprimer le site \"#{s.name}\" ?"} %>
30
30
  </td>
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails