sibu 0.9.3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +81 -4
- data/app/assets/javascripts/sibu/sibu.js.erb +17 -3
- data/app/assets/javascripts/tabs/van11y-accessible-tab-panel-aria.js +122 -124
- data/app/assets/stylesheets/sibu/defaults.scss +76 -80
- data/app/assets/stylesheets/sibu/sibu.css +8 -0
- data/app/controllers/sibu/application_controller.rb +8 -0
- data/app/controllers/sibu/pages_controller.rb +11 -4
- data/app/controllers/sibu/sites_controller.rb +4 -0
- data/app/helpers/sibu/application_helper.rb +1 -1
- data/app/helpers/sibu/pages_helper.rb +104 -23
- data/app/models/sibu/page.rb +3 -3
- data/app/models/sibu/site.rb +15 -1
- data/app/models/sibu/site_template.rb +1 -1
- data/app/views/layouts/sibu/edit_content.html.erb +184 -125
- data/app/views/sibu/images/edit.js.erb +5 -3
- data/app/views/sibu/pages/_code_edit_panel.html.erb +3 -2
- data/app/views/sibu/pages/_form.html.erb +8 -0
- data/app/views/sibu/pages/_link_edit_panel.html.erb +6 -6
- data/app/views/sibu/pages/_map_edit_panel.html.erb +3 -2
- data/app/views/sibu/pages/_media_edit_panel.html.erb +6 -6
- data/app/views/sibu/pages/_new_section_panel.html.erb +1 -1
- data/app/views/sibu/pages/_paragraph_edit_panel.html.erb +2 -2
- data/app/views/sibu/pages/_text_edit_panel.html.erb +2 -2
- data/app/views/sibu/pages/child_element.js.erb +2 -2
- data/app/views/sibu/pages/clone_element.js.erb +2 -2
- data/app/views/sibu/pages/create_section.js.erb +1 -1
- data/app/views/sibu/pages/delete_element.js.erb +1 -1
- data/app/views/sibu/pages/delete_section.js.erb +1 -1
- data/app/views/sibu/pages/edit_element.js.erb +68 -66
- data/app/views/sibu/pages/edit_section.js.erb +6 -5
- data/app/views/sibu/pages/index.html.erb +2 -2
- data/app/views/sibu/pages/new_section.js.erb +22 -13
- data/app/views/sibu/pages/update_element.js.erb +2 -2
- data/app/views/sibu/pages/update_section.js.erb +3 -3
- data/config/initializers/constants.rb +5 -3
- data/db/migrate/20200401130601_add_ref_to_site_templates.rb +5 -0
- data/lib/sibu/engine.rb +0 -2
- data/lib/sibu/version.rb +1 -1
- metadata +3 -18
- data/app/views/sibu/pages/destroy.html.erb +0 -2
- data/app/views/sibu/pages/update.html.erb +0 -2
@@ -1,3 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
document.querySelector(".sibu_edit_image").innerHTML = "<%= j(render 'edit_form') %>";
|
2
|
+
if (document.querySelector(".sibu_image.selected")) {
|
3
|
+
document.querySelector(".sibu_image.selected").classList.remove("selected");
|
4
|
+
}
|
5
|
+
document.querySelector("<%= "#sibu_image_#{@image.id}" %>").classList.add("selected");
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<h2>Modifier le contenu</h2>
|
2
2
|
<div id="edit_msg"></div>
|
3
|
+
<%= render 'element_actions' %>
|
3
4
|
<div class="sibu_edit_form">
|
4
|
-
<%=
|
5
|
+
<form class="edit_element_form" action="<%= update_element_site_page_path(@site.id, @page.id, format: :js) %>" accept-charset="UTF-8" method="patch">
|
5
6
|
<div class="sibu_field">
|
6
7
|
<%= label_tag 'element[code]', "Code d'intégration du contenu" %>
|
7
8
|
<%= text_area_tag 'element[code]', @element["code"], placeholder: ' ex: <iframe src="..."></iframe>' %>
|
@@ -14,5 +15,5 @@
|
|
14
15
|
<%= submit_tag 'Valider' %>
|
15
16
|
<%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
|
16
17
|
</div>
|
17
|
-
|
18
|
+
</form>
|
18
19
|
</div>
|
@@ -13,6 +13,13 @@
|
|
13
13
|
<small>L'adresse (ou URL) de la page, utilisée par les navigateurs web pour y accéder</small>
|
14
14
|
</div>
|
15
15
|
</div>
|
16
|
+
<div class="sibu_field">
|
17
|
+
<%= f.label :source, "Référence" %>
|
18
|
+
<div>
|
19
|
+
<%= f.text_field :source, placeholder: "Référence interne optionnelle (Ex: test mise en page 2) " %>
|
20
|
+
<small>Un bref descriptif de la page, à usage interne uniquement</small>
|
21
|
+
</div>
|
22
|
+
</div>
|
16
23
|
<div class="sibu_field">
|
17
24
|
<%= f.label :is_home, "Page d'accueil" %>
|
18
25
|
<div>
|
@@ -56,6 +63,7 @@
|
|
56
63
|
</div>
|
57
64
|
</div>
|
58
65
|
<%= f.hidden_field :site_id %>
|
66
|
+
<%= f.hidden_field :site_id %>
|
59
67
|
<div class="sibu_actions">
|
60
68
|
<%= f.submit 'Valider' %>
|
61
69
|
<%= link_to 'Annuler', :back %>
|
@@ -2,32 +2,32 @@
|
|
2
2
|
<div id="edit_msg"></div>
|
3
3
|
<%= render 'element_actions' %>
|
4
4
|
<div class="sibu_edit_form">
|
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
|
<% current_type = link_type(@element["value"]) %>
|
7
7
|
<div class="sibu_field">
|
8
8
|
<%= label_tag 'element[text]', 'Libellé' %>
|
9
9
|
<%= text_field_tag 'element[text]', @element["text"] %>
|
10
10
|
</div>
|
11
11
|
<div id="link_internal" class="sibu_field link_mode">
|
12
|
-
<%= radio_button_tag :mode, 'internal', current_type == 'internal', class: 'radio' %>
|
12
|
+
<%= radio_button_tag :mode, 'internal', current_type == 'internal', class: 'radio', onclick: 'setLinkMode(this)' %>
|
13
13
|
<%= label_tag 'mode_internal', 'Lien vers une page du site' %>
|
14
14
|
<%= select_tag 'element[value]', available_links, prompt: 'Sélectionnez une page', disabled: current_type != 'internal' %>
|
15
15
|
<%= hidden_field_tag 'element[target]', '_self', disabled: current_type != 'internal' %>
|
16
16
|
</div>
|
17
17
|
<div id="link_external" class="sibu_field link_mode">
|
18
|
-
<%= radio_button_tag :mode, 'external', current_type == 'external', class: 'radio' %>
|
18
|
+
<%= radio_button_tag :mode, 'external', current_type == 'external', class: 'radio', onclick: 'setLinkMode(this)' %>
|
19
19
|
<%= label_tag 'mode_external', 'Lien personnalisé' %>
|
20
20
|
<%= text_field_tag 'element[value]', (@element["value"] if current_type == 'external'), placeholder: 'Ex : http://www.un-site.com', disabled: current_type != 'external' %>
|
21
21
|
<%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'external' %>
|
22
22
|
</div>
|
23
23
|
<div id="link_email" class="sibu_field link_mode">
|
24
|
-
<%= radio_button_tag :mode, 'email', current_type == 'email', class: 'radio' %>
|
24
|
+
<%= radio_button_tag :mode, 'email', current_type == 'email', class: 'radio', onclick: 'setLinkMode(this)' %>
|
25
25
|
<%= label_tag 'mode_external', 'Lien vers un Email' %>
|
26
26
|
<%= text_field_tag 'element[value]', (@element["value"] if current_type == 'email'), placeholder: 'Ex : email@exemple.fr', disabled: current_type != 'email' %>
|
27
27
|
<%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'email' %>
|
28
28
|
</div>
|
29
29
|
<div id="link_document" class="sibu_field link_mode">
|
30
|
-
<%= radio_button_tag :mode, 'document', current_type == 'document', class: 'radio' %>
|
30
|
+
<%= radio_button_tag :mode, 'document', current_type == 'document', class: 'radio', onclick: 'setLinkMode(this)' %>
|
31
31
|
<%= label_tag 'mode_document', 'Lien vers un document' %>
|
32
32
|
<%= select_tag 'element[value]', available_docs, prompt: 'Sélectionnez un document', disabled: current_type != 'document' %>
|
33
33
|
<%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'document' %>
|
@@ -46,5 +46,5 @@
|
|
46
46
|
<%= submit_tag 'Valider' %>
|
47
47
|
<%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
|
48
48
|
</div>
|
49
|
-
|
49
|
+
</form>
|
50
50
|
</div>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<h2>Modifier la carte</h2>
|
2
2
|
<div id="edit_msg"></div>
|
3
|
+
<%= render 'element_actions' %>
|
3
4
|
<div class="sibu_edit_form">
|
4
|
-
<%=
|
5
|
+
<form class="edit_element_form" action="<%= update_element_site_page_path(@site.id, @page.id, format: :js) %>" accept-charset="UTF-8" method="patch">
|
5
6
|
<div class="sibu_field">
|
6
7
|
<%= label_tag 'element[data-lat]', 'Latitude' %>
|
7
8
|
<%= text_field_tag 'element[data-lat]', @element["data-lat"] %>
|
@@ -23,5 +24,5 @@
|
|
23
24
|
<%= submit_tag 'Valider' %>
|
24
25
|
<%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
|
25
26
|
</div>
|
26
|
-
|
27
|
+
</form>
|
27
28
|
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div id="edit_msg"></div>
|
3
3
|
<%= render 'element_actions' %>
|
4
4
|
<div class="sibu_edit_form">
|
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_image_selection">
|
7
7
|
<div class="sibu_select_images sibu_field">
|
8
8
|
<p>Sélectionnez ou <%= link_to 'téléchargez', new_image_path(page_id: @page.id, section_id: @section_id, entity_type: @entity_type,
|
@@ -32,19 +32,19 @@
|
|
32
32
|
</table>
|
33
33
|
</div>
|
34
34
|
<div class="sibu_selected_image">
|
35
|
-
<% if @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
|
35
|
+
<% if @element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank? %>
|
36
36
|
<p>Veuillez sélectionner une image.</p>
|
37
37
|
<% end %>
|
38
|
-
<div class="sibu_custom_center" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
|
38
|
+
<div class="sibu_custom_center" style="display: <%= (@element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
|
39
39
|
<%= check_box_tag('custom_center', true, (!@element["class"].blank? && @element["class"].include?('posx')), id: 'custom_center', class: 'checkbox') %>
|
40
40
|
<%= label_tag 'custom_center', "Recentrer l'image" %>
|
41
41
|
</div>
|
42
42
|
<div class="sibu_center">
|
43
|
-
<%= image_tag(@element["src"]) unless @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
|
43
|
+
<%= image_tag(@element["src"]) unless @element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank? %>
|
44
44
|
<div id="sibu_center_pos" style="display: none;">✕</div>
|
45
45
|
<div id="sibu_center_desc" style="display: none;"><em>Cliquez sur l'image pour la recentrer sur un point donné (à utiliser lorsque l'image est tronquée car la zone d'affichage est trop petite).</em></div>
|
46
46
|
</div>
|
47
|
-
<div class="sibu_field" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
|
47
|
+
<div class="sibu_field" style="display: <%= (@element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
|
48
48
|
<%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
|
49
49
|
<%= text_field_tag 'element[alt]', @element["alt"] %>
|
50
50
|
</div>
|
@@ -60,5 +60,5 @@
|
|
60
60
|
<%= submit_tag 'Valider' %>
|
61
61
|
<%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
|
62
62
|
</div>
|
63
|
-
|
63
|
+
</form>
|
64
64
|
</div>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<h3 style="display: none;"><%= t "sibu.section.category.#{cat}" %></h3>
|
20
20
|
<% sections.each do |st| %>
|
21
21
|
<div data-sb-template="<%= st["template"] %>" data-sb-category="<%= st["category"] %>">
|
22
|
-
<%=
|
22
|
+
<%= render_page_section st %>
|
23
23
|
</div>
|
24
24
|
<% end %>
|
25
25
|
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div id="edit_msg"></div>
|
3
3
|
<%= render 'element_actions' %>
|
4
4
|
<div class="sibu_edit_form">
|
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 id="editor-container"></div>
|
7
7
|
|
8
8
|
<%= hidden_field_tag 'element[text]' %>
|
@@ -14,5 +14,5 @@
|
|
14
14
|
<%= submit_tag 'Valider' %>
|
15
15
|
<%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
|
16
16
|
</div>
|
17
|
-
|
17
|
+
</form>
|
18
18
|
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div id="edit_msg"></div>
|
3
3
|
<%= render 'element_actions' %>
|
4
4
|
<div class="sibu_edit_form">
|
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[text]', 'Texte' %>
|
8
8
|
<%= text_field_tag 'element[text]', @element["text"] %>
|
@@ -15,5 +15,5 @@
|
|
15
15
|
<%= submit_tag 'Valider' %>
|
16
16
|
<%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
|
17
17
|
</div>
|
18
|
-
|
18
|
+
</form>
|
19
19
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @added.nil? %>
|
2
|
-
|
2
|
+
document.querySelector("#edit_panel #edit_msg").innerHTML = "<p class='sibu_alert'>Une erreur s'est produite lors de l'ajout du sous-menu.</p>";
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
document.querySelector("#edit_panel").classList.remove('active');
|
5
5
|
location.reload(true);
|
6
6
|
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @cloned.nil? %>
|
2
|
-
|
2
|
+
document.querySelector("#edit_panel #edit_msg").innerHTML = "<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>";
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
document.querySelector("#edit_panel").classList.remove("active");
|
5
5
|
refreshAfterEdit(true, '<%= @section_id %>');
|
6
6
|
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @created %>
|
2
2
|
location.reload(true);
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
document.querySelector("#edit_section_msg").innerHTML = "<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>";
|
5
5
|
<% end %>
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @deleted %>
|
2
2
|
refreshAfterEdit(true, '<%= @section_id %>');
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
document.querySelector("#edit_section_msg").innerHTML = "<p class='sibu_alert'>La suppression n'a pas pu être effectuée.</p>";
|
5
5
|
<% end %>
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @deleted %>
|
2
2
|
location.reload(true);
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
document.querySelector("#edit_section_msg").innerHTML = "<p class='sibu_alert'>Une erreur s'est produite lors de la suppression..</p>";
|
5
5
|
<% end %>
|
6
6
|
|
@@ -1,105 +1,107 @@
|
|
1
|
-
var editPanel =
|
2
|
-
editPanel.
|
1
|
+
var editPanel = document.querySelector("#edit_panel");
|
2
|
+
editPanel.innerHTML = "";
|
3
|
+
|
3
4
|
<% case @content_type %>
|
4
5
|
<% when 'text' %>
|
5
|
-
editPanel.
|
6
|
+
editPanel.innerHTML = "<%= j(render 'text_edit_panel') %>";
|
6
7
|
<% when 'embed' %>
|
7
|
-
editPanel.
|
8
|
+
editPanel.innerHTML = "<%= j(render 'code_edit_panel') %>";
|
8
9
|
<% when 'paragraph' %>
|
9
|
-
editPanel.
|
10
|
+
editPanel.innerHTML = "<%= j(render 'paragraph_edit_panel') %>";
|
10
11
|
<% when 'media' %>
|
11
|
-
editPanel.
|
12
|
+
editPanel.innerHTML = "<%= j(render 'media_edit_panel') %>";
|
12
13
|
<% when 'link' %>
|
13
|
-
editPanel.
|
14
|
+
editPanel.innerHTML = "<%= j(render 'link_edit_panel') %>";
|
14
15
|
<% when 'group' %>
|
15
|
-
editPanel.
|
16
|
+
editPanel.innerHTML = "<%= j(render 'group_edit_panel') %>";
|
16
17
|
<% when 'map' %>
|
17
|
-
editPanel.
|
18
|
+
editPanel.innerHTML = "<%= j(render 'map_edit_panel') %>";
|
18
19
|
<% when /^widget/ %>
|
19
|
-
editPanel.
|
20
|
+
editPanel.innerHTML = "<%= j(render "shared/sibu/#{@content_type}_panel") %>";
|
20
21
|
<% else %>
|
21
|
-
editPanel.
|
22
|
+
editPanel.innerHTML = "<%= j(render 'error_panel') %>";
|
22
23
|
<% end %>
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
editPanel.classList.add("active");
|
26
|
+
setTimeout(function() {
|
26
27
|
<% case @content_type %>
|
27
28
|
<% when 'paragraph' %>
|
28
29
|
var quill = initQuillEditor('#editor-container');
|
29
30
|
quill.root.innerHTML = "<%= j(raw(@element["text"] || 'Texte à modifier')) %>";
|
30
31
|
quill.on('text-change', function() {
|
31
|
-
|
32
|
-
});
|
33
|
-
var wrapper = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']");
|
34
|
-
editPanel.find(".ql-editor").css({
|
35
|
-
"font-family": wrapper.css("font-family"),
|
36
|
-
"font-size": wrapper.css("font-size"),
|
37
|
-
"color": wrapper.css("color"),
|
38
|
-
"text-align": wrapper.css("text-align")
|
32
|
+
document.querySelector("#element_text").value = quill.root.innerHTML;
|
39
33
|
});
|
34
|
+
var wrapper = document.querySelector("[data-sb-id='<%= @section_id %>'] [data-id='<%= @element_id %>']"),
|
35
|
+
editor = editPanel.querySelector(".ql-editor");
|
36
|
+
editor.style['font-family'] = wrapper.style['font-family'];
|
37
|
+
editor.style['font-size'] = wrapper.style['font-size'];
|
38
|
+
editor.style.color = wrapper.style.color;
|
39
|
+
editor.style['text-align'] = wrapper.style['text-align'];
|
40
40
|
<% when 'media' %>
|
41
|
-
var images = editPanel.
|
42
|
-
var customCenter =
|
43
|
-
images.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
customCenter.
|
59
|
-
|
60
|
-
|
41
|
+
var images = editPanel.querySelectorAll(".sibu_image");
|
42
|
+
var customCenter = document.querySelector("#custom_center");
|
43
|
+
for (var i = 0; i < images.length; i++) {
|
44
|
+
images[i].addEventListener("click", function(evt) {
|
45
|
+
if(!evt.currentTarget.classList.contains('selected')) {
|
46
|
+
evt.currentTarget.classList.remove('selected');
|
47
|
+
evt.currentTarget.classList.add('selected');
|
48
|
+
var imgElt = evt.currentTarget.querySelector("img");
|
49
|
+
document.querySelector("#element_src").value = imgElt.getAttribute("data-src");
|
50
|
+
document.querySelector("#element_alt").value = imgElt.getAttribute("data-alt");
|
51
|
+
editPanel.querySelector(".sibu_center").innerHTML =
|
52
|
+
'<img src="' + $("#element_src").val() + '"/>' +
|
53
|
+
'<div id="sibu_center_pos" style="display: none;">✕</div>' +
|
54
|
+
'<div id="sibu_center_desc" style="display: none;"><em>Cliquez sur l\'image pour la recentrer sur un point donné (à utiliser lorsque l\'image est tronquée car la zone d\'affichage est trop petite)</em></div>';
|
55
|
+
editPanel.querySelector(".sibu_selected_image > p:first-child").style.display = "none";
|
56
|
+
editPanel.querySelector(".sibu_selected_image .sibu_custom_center").style.display = "block";
|
57
|
+
editPanel.querySelector(".sibu_selected_image .sibu_field").style.display = "";
|
58
|
+
if(customCenter.checked) {
|
59
|
+
customCenter.removeAttribute("checked");
|
60
|
+
document.querySelector("#element_class").value = "";
|
61
|
+
document.querySelector(".sibu_center").setAttribute("style", "");
|
62
|
+
}
|
61
63
|
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
if(editPanel.
|
65
|
-
if(customCenter.
|
64
|
+
})
|
65
|
+
}
|
66
|
+
if(editPanel.querySelectorAll(".sibu_center img").length > 0) {
|
67
|
+
if(customCenter.checked) {
|
66
68
|
initCustomCenter("<%= @element_id %>");
|
67
69
|
}
|
68
70
|
}
|
69
|
-
customCenter.
|
70
|
-
if(
|
71
|
+
customCenter.onchange = function(evt) {
|
72
|
+
if(this.checked) {
|
71
73
|
initCustomCenter("<%= @element_id %>");
|
72
74
|
} else {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
75
|
+
document.querySelector("#element_class").value = "";
|
76
|
+
document.querySelector(".sibu_center").setAttribute("style", "");
|
77
|
+
document.querySelector(".sibu_center > #sibu_center_pos").style.display = "none";
|
78
|
+
document.querySelector(".sibu_center > #sibu_center_desc").style.display = "none";
|
77
79
|
}
|
78
|
-
}
|
80
|
+
};
|
79
81
|
<% when 'link' %>
|
80
|
-
$("input[name='mode']").change(function() {
|
81
|
-
var selected = $(this).val();
|
82
|
-
$("#link_" + selected).find("#element_value, #element_target").removeAttr("disabled");
|
83
|
-
$(".sibu_edit_form").find(".link_mode").each(function() {
|
84
|
-
if($(this).attr("id") !== ("link_" + selected)) {
|
85
|
-
$(this).find("#element_value, #element_target").attr("disabled", "disabled");
|
86
|
-
}
|
87
|
-
});
|
88
|
-
});
|
89
82
|
<% else %>
|
90
83
|
<% end %>
|
91
84
|
|
92
85
|
<% if @repeat %>
|
93
|
-
|
86
|
+
document.querySelector("#clone_elt").style.display = "inline-block";
|
87
|
+
document.querySelector("#duplicate_elt").style.display = "inline-block";
|
94
88
|
<% else %>
|
95
|
-
|
89
|
+
document.querySelector("#clone_elt").remove();
|
90
|
+
document.querySelector("#duplicate_elt").remove();
|
96
91
|
<% end %>
|
97
92
|
|
98
93
|
<% if @children %>
|
99
|
-
|
94
|
+
document.querySelector("#child_elt").style.display = "inline-block";
|
100
95
|
<% else %>
|
101
|
-
|
96
|
+
document.querySelector("#child_elt").remove();
|
102
97
|
<% end %>
|
98
|
+
var formElt = document.querySelector("form.edit_element_form");
|
99
|
+
if (formElt) {
|
100
|
+
formElt.onsubmit = function(evt) {
|
101
|
+
evt.preventDefault();
|
102
|
+
submitForm(formElt);
|
103
|
+
}
|
104
|
+
}
|
103
105
|
sibuCallback("editElement", "<%= @content_type %>");
|
104
|
-
});
|
106
|
+
}, 500);
|
105
107
|
document.body.style.overflow = "hidden";
|
@@ -1,7 +1,8 @@
|
|
1
|
-
var editPanel =
|
2
|
-
editPanel.
|
3
|
-
editPanel.
|
4
|
-
editPanel.
|
1
|
+
var editPanel = document.querySelector("#edit_panel");
|
2
|
+
editPanel.innerHTML = "";
|
3
|
+
editPanel.innerHTML = "<%= j(render conf[:section_form]) %>";
|
4
|
+
editPanel.classList.add("active");
|
5
|
+
setTimeout(function() {
|
5
6
|
sibuCallback("editSection");
|
6
|
-
});
|
7
|
+
}, 500);
|
7
8
|
document.body.style.overflow = "hidden";
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<tr>
|
9
9
|
<th>Nom</th>
|
10
10
|
<th>Chemin d'accès</th>
|
11
|
-
<th>
|
11
|
+
<th>Référence</th>
|
12
12
|
<th>Mise à jour</th>
|
13
13
|
<th></th>
|
14
14
|
</tr>
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<% end %>
|
32
32
|
<% if @pages.empty? %>
|
33
33
|
<tr>
|
34
|
-
<td colspan="
|
34
|
+
<td colspan="5">Aucune page créée pour le moment.</td>
|
35
35
|
</tr>
|
36
36
|
<% end %>
|
37
37
|
</tbody>
|
@@ -1,16 +1,25 @@
|
|
1
|
-
var sectionsPanel =
|
2
|
-
if (sectionsPanel
|
3
|
-
sectionsPanel.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
var sectionsPanel = document.querySelector("#sections_panel");
|
2
|
+
if (sectionsPanel) {
|
3
|
+
sectionsPanel.innerHTML = "<%= j(render 'new_section_panel') %>";
|
4
|
+
try {
|
5
|
+
sibuVan11yAccessibleTabPanelAria(document.querySelector(".sibu_sections_tabs"));
|
6
|
+
} catch (e) {
|
7
|
+
console.log('Sibu sections - Tabs init error : ' + e);
|
8
|
+
}
|
9
|
+
var sections = sectionsPanel.querySelectorAll(".sibu_sections [data-sb-template]");
|
10
|
+
for (var i = 0; i < sections.length; i++) {
|
11
|
+
sections[i].addEventListener("click", function(evt) {
|
12
|
+
if(!evt.currentTarget.classList.contains('selected')) {
|
13
|
+
var selected = sectionsPanel.querySelector(".sibu_sections [data-sb-template].selected");
|
14
|
+
if (selected) {
|
15
|
+
selected.classList.remove('selected');
|
16
|
+
}
|
17
|
+
evt.currentTarget.classList.add('selected');
|
18
|
+
document.querySelector("#section_template").value = evt.currentTarget.getAttribute('data-sb-template');
|
19
|
+
document.querySelector("#section_category").value = evt.currentTarget.getAttribute('data-sb-category');
|
20
|
+
}
|
21
|
+
});
|
22
|
+
}
|
14
23
|
if(typeof initSectionsForm === "function") {
|
15
24
|
initSectionsForm();
|
16
25
|
}
|