sibu 1.0.4 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48f219f6b806e3d5d5fbd7ce2df9224fd2e65b8a
4
- data.tar.gz: 56fcfd81852d1cb3a11f4c0b4a3754cbf0f261c7
3
+ metadata.gz: a342b61a67c0e4b5181984f617ab47635611dd6a
4
+ data.tar.gz: 545735764452344e08b8c66845e948d4d569447f
5
5
  SHA512:
6
- metadata.gz: 10d19792d46338bd0bd7a3be61bad6547562e8e55edf252ee311727b7f02dfad823c95e66667f3e314ad6d3be30ca51a688028b0a1628f7d6ecfda46caf2e12d
7
- data.tar.gz: 92ecb493f7f4f5986cb0c8f5936add93dd5d962fa7618c5eba06cbd40638bc73837ba0f9e94a6673968c3ec044685ac25fa5d2e37eb21cbd20c8e5b0eb41bad3
6
+ metadata.gz: 18fddf4a252bf6243e3020c4082c10da885f343881dc4abbc4c0c05d894dc4885c0ad21970bc002eba918c73a25029fec34cc863df165530303dfbca512b1633
7
+ data.tar.gz: 48d28a56d1a239fda2b8ea17ba654ebff2f2ec5c6dd4181c7080ffda0bdc58d6102b198c2c024ce9e80e58b17dfbf01b6f50cc9f454eff99196a397c770d50f4
@@ -229,8 +229,7 @@ $sibu-color3 : #333 !default;
229
229
  padding: 2rem;
230
230
 
231
231
  img {
232
- padding-top: 2rem;
233
- padding-bottom: 2rem;
232
+ margin-bottom: 2rem;
234
233
  border-top: 2px solid $sibu-color1;
235
234
  box-shadow: 0 0 5px #ccc;
236
235
  }
@@ -0,0 +1,4 @@
1
+ module Sibu
2
+ module ExtendableHelper
3
+ end
4
+ end
@@ -27,6 +27,13 @@ module Sibu
27
27
  options_from_collection_for_select(Sibu::Document.for_user(sibu_user), :file_url, :file_name, @element["value"])
28
28
  end
29
29
 
30
+ def input_categories
31
+ options_for_select([['Nom', 'name'], ['Adresse', 'address'], ['Email', 'email'], ['Téléphone', 'telephone'],
32
+ ['Arrivée', 'arrival_date'], ['Départ', 'departure_date'], ['Nombre de personnes', 'people'],
33
+ ['Message (texte libre)', 'message'], ['Inscription à la newsletter', 'newsletter']],
34
+ @element["field_name"])
35
+ end
36
+
30
37
  def link_type(val)
31
38
  if val.blank? || /^\d+$/.match(val.to_s)
32
39
  'internal'
@@ -124,25 +131,33 @@ module Sibu
124
131
  wrapper = opts.delete(:wrapper)
125
132
  repeat = opts.delete(:repeat)
126
133
  size = opts.delete(:size)
127
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => Sibu::DEFAULT_IMG}
134
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
135
+ defaults = {"id" => t_id, "src" => Sibu::DEFAULT_IMG}
128
136
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
137
+ @sb_section = (@sb_section || []) + [t_id]
129
138
  if action_name == 'show'
130
139
  content["src"] = ("/#{conf[:deployment_path]}" + content["src"]) if @online && conf[:deployment_path]
131
140
  else
132
- opts.merge!({data: {id: elt_id(elt), type: "media", repeat: repeat, size: size}})
141
+ opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "media", repeat: repeat, size: size}})
133
142
  end
134
- wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts)
143
+ html_output = wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts)
135
144
  : content_tag(:img, nil, content.except("id").merge(opts.stringify_keys) {|k, old, new| k == 'class' ? [old, new].join(' ') : new})
145
+ @sb_section -= [t_id]
146
+ html_output
136
147
  end
137
148
 
138
149
  def grp(elt, opts = {}, &block)
139
150
  wrapper = opts.delete(:wrapper) || :div
140
151
  repeat = opts.delete(:repeat)
141
152
  children = opts.delete(:children)
142
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt}
153
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
154
+ @sb_section = (@sb_section || []) + [t_id]
155
+ defaults = {"id" => t_id}
143
156
  opts = defaults.merge(opts)
144
- opts.merge!({data: {id: elt_id(elt), type: "group", repeat: repeat, children: children}}) if action_name != 'show'
145
- content_tag(wrapper, capture(*elts(elt), &block), opts)
157
+ opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "group", repeat: repeat, children: children}}) if action_name != 'show'
158
+ html_output = content_tag(wrapper, capture(*elts(elt), &block), opts)
159
+ @sb_section -= [t_id]
160
+ html_output
146
161
  end
147
162
 
148
163
  def empty_tag(elt, tag, type, opts = {})
@@ -154,10 +169,49 @@ module Sibu
154
169
  end
155
170
 
156
171
  def form_label(elt, html_opts = {}, &block)
157
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => Sibu::DEFAULT_TEXT}
172
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
173
+ defaults = {"id" => t_id, "text" => Sibu::DEFAULT_TEXT}
158
174
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
159
- html_opts.merge!({data: {id: elt_id(elt), type: "text"}}) if action_name != 'show'
160
- content_tag(:label, raw(content["text"]).html_safe, html_opts)
175
+ @sb_section = (@sb_section || []) + [t_id]
176
+ html_opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "text"}}) if action_name != 'show'
177
+ html_output = content_tag(:label, raw(content["text"]).html_safe, html_opts)
178
+ @sb_section -= [t_id]
179
+ html_output
180
+ end
181
+
182
+ def form_input(elt, html_opts = {})
183
+ repeat = html_opts.delete(:repeat)
184
+ children = html_opts.delete(:children)
185
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
186
+ opts = {"id" => t_id}.merge(html_opts.stringify_keys).merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
187
+ form_name = opts.delete('form_name') || 'contact'
188
+ field_name = opts.delete('field_name') || 'name'
189
+ name_attr = "#{form_name}[#{field_name}]"
190
+
191
+ @sb_section = (@sb_section || []) + [t_id]
192
+ opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "input", repeat: repeat, children: children}}) if action_name != 'show'
193
+
194
+ case field_name
195
+ when 'name', 'address'
196
+ html_output = content_tag(:input, nil, opts.merge('type' => 'text', 'name' => name_attr))
197
+ when 'email'
198
+ html_output = content_tag(:input, nil, opts.merge('type' => 'email', 'name' => name_attr))
199
+ when 'telephone'
200
+ html_output = content_tag(:input, nil, opts.merge('type' => 'tel', 'name' => name_attr))
201
+ when 'arrival_date', 'departure_date'
202
+ html_output = content_tag(:input, nil, opts.merge('type' => 'date', 'name' => name_attr))
203
+ when 'people'
204
+ html_output = content_tag(:input, nil, opts.merge('type' => 'number', 'name' => name_attr))
205
+ when 'message'
206
+ html_output = content_tag(:textarea, nil, opts.merge('name' => name_attr))
207
+ when 'newsletter'
208
+ html_output = content_tag(:input, nil, opts.merge('type' => 'checkbox', 'name' => name_attr))
209
+ else
210
+ html_output = content_tag(:input, nil, opts.merge('type' => 'text', 'name' => name_attr))
211
+ end
212
+
213
+ @sb_section -= [t_id]
214
+ html_output
161
215
  end
162
216
 
163
217
  def widget(elt, widget_type, opts = {}, &block)
@@ -229,12 +283,14 @@ module Sibu
229
283
  def link(elt, html_opts = {}, &block)
230
284
  repeat = html_opts.delete(:repeat)
231
285
  children = html_opts.delete(:children)
232
- defaults = {"id" => elt_id(elt), "value" => "", "text" => Sibu::DEFAULT_TEXT}
286
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
287
+ defaults = {"id" => t_id, "value" => "", "text" => Sibu::DEFAULT_TEXT}
233
288
  link_elt = current_elt(elt)
234
289
  content = defaults.merge(link_elt)
235
290
  val = content.delete("value") || ""
236
291
  text = content.delete("text")
237
- html_opts.merge!({data: {id: elt_id(elt), type: "link", repeat: repeat, children: children}}) if action_name != 'show'
292
+ @sb_section = (@sb_section || []) + [t_id]
293
+ html_opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "link", repeat: repeat, children: children}}) if action_name != 'show'
238
294
  if val.to_s.start_with?('http')
239
295
  content["href"] = val
240
296
  elsif val.to_s.start_with?('#')
@@ -248,20 +304,19 @@ module Sibu
248
304
  content["href"] = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
249
305
  end
250
306
  if block_given?
251
- @sb_section = (@sb_section || []) + [elt_id(elt)]
252
- html_output = content_tag(:a, capture(link_elt, elts(elt), &block), content.merge(html_opts).except("elements"))
253
- @sb_section -= [elt_id(elt)]
254
- html_output
307
+ html_output = content_tag(:a, capture(link_elt, nested_elements(elt), &block), content.merge(html_opts).except("elements"))
255
308
  else
256
- content_tag(:a, raw(text), content.merge(html_opts).except("elements"))
309
+ html_output = content_tag(:a, raw(text), content.merge(html_opts).except("elements"))
257
310
  end
311
+ @sb_section -= [t_id]
312
+ html_output
258
313
  end
259
314
 
260
315
  def interactive_map(elt, html_opts = {})
261
- defaults = {"data-lat" => "46.1988027", "data-lng" => "5.1748288", "data-title" => Sibu::DEFAULT_TEXT}
316
+ defaults = {"data-lat" => "46.1988027", "data-lng" => "5.1748288"}
262
317
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {"id" => elt}))
263
318
  html_opts.merge!({data: {id: elt_id(elt), type: "map"}}) if action_name != 'show'
264
- content_tag(:div, nil, content.merge(html_opts))
319
+ content_tag(:div, nil, content.merge(html_opts.stringify_keys))
265
320
  end
266
321
 
267
322
  def elt_id(elt)
@@ -1,31 +1,36 @@
1
1
  module Sibu
2
2
  class DynamicStyle
3
3
 
4
- attr_reader :site, :body, :env, :filename, :scss_file
4
+ attr_reader :site, :body, :env, :filename, :scss_file, :styles_changed
5
5
 
6
6
  def initialize(site_id)
7
7
  @site = Sibu::Site.find(site_id)
8
- @filename = "#{site_id}_#{Time.current.to_i}"
9
- @scss_file = File.new(scss_file_path, 'w')
10
- @body = ERB.new(File.read(template_file_path)).result(binding)
11
- @env = Rails.application.assets
8
+ @styles_changed = styles_changed?(@site.style_url)
9
+ if @styles_changed
10
+ @filename = "#{site_id}_#{Time.current.to_i}"
11
+ @scss_file = File.new(scss_file_path, 'w')
12
+ @body = ERB.new(File.read(template_file_path)).result(binding)
13
+ @env = Rails.application.assets
14
+ end
12
15
  end
13
16
 
14
17
  def compile
15
- find_or_create_scss
18
+ if @styles_changed
19
+ find_or_create_scss
16
20
 
17
- begin
18
- scss_file.write generate_css
19
- scss_file.flush
20
- scss_file.close
21
- css_file_path = scss_file_path.gsub('scss', 'css')
22
- File.rename(scss_file_path, css_file_path)
23
- site.update(style: File.new(css_file_path))
24
- rescue Exception => ex
25
- Rails.logger.error(ex)
26
- ensure
27
- File.delete(scss_file_path) if scss_file_path && File.exist?(scss_file_path)
28
- File.delete(css_file_path) if css_file_path && File.exist?(css_file_path)
21
+ begin
22
+ scss_file.write generate_css
23
+ scss_file.flush
24
+ scss_file.close
25
+ css_file_path = scss_file_path.gsub('scss', 'css')
26
+ File.rename(scss_file_path, css_file_path)
27
+ site.update(style: File.new(css_file_path))
28
+ rescue Exception => ex
29
+ Rails.logger.error(ex)
30
+ ensure
31
+ File.delete(scss_file_path) if scss_file_path && File.exist?(scss_file_path)
32
+ File.delete(css_file_path) if css_file_path && File.exist?(css_file_path)
33
+ end
29
34
  end
30
35
  end
31
36
 
@@ -73,5 +78,16 @@ module Sibu
73
78
  env.load(asset.uri).source
74
79
  end
75
80
  end
81
+
82
+ def styles_changed?(site_style_url)
83
+ templates_styles_path = File.join(Rails.root, 'app', 'assets', 'stylesheets', 'templates', '**/*')
84
+ style_updated_at = File.new(File.join(Rails.root, 'public', site_style_url)).mtime
85
+ Dir.glob(templates_styles_path) do |style_file|
86
+ if File.new(style_file).mtime > style_updated_at
87
+ return true
88
+ end
89
+ end
90
+ false
91
+ end
76
92
  end
77
93
  end
@@ -62,5 +62,9 @@ module Sibu
62
62
  save
63
63
  end
64
64
  end
65
+
66
+ def home?
67
+ is_home == 'true' || is_home == '1'
68
+ end
65
69
  end
66
70
  end
@@ -51,13 +51,6 @@ module Sibu
51
51
  pages.where(id: page_id).select(:id, :path).first
52
52
  end
53
53
 
54
- def update_paths
55
- pages.each do |p|
56
- p.update_path(true)
57
- p.save
58
- end
59
- end
60
-
61
54
  def save_and_init
62
55
  if valid?
63
56
  self.sections = site_template.sections
@@ -2,12 +2,15 @@
2
2
  <html>
3
3
  <head>
4
4
  <title><%= conf[:title] %></title>
5
+ <%= stylesheet_link_tag 'sibu/sibu', media: 'all' %>
6
+ <%= stylesheet_link_tag "#{conf[:stylesheet]}-edit", media: 'all' %>
5
7
  <% if @site %>
6
8
  <%= stylesheet_link_tag (conf[:custom_styles] ? @site.style_url : @site.site_template.path), media: "all" %>
9
+ <% end %>
10
+
11
+ <% if @site %>
7
12
  <%= javascript_include_tag @site.site_template.path %>
8
13
  <% end %>
9
- <%= stylesheet_link_tag 'sibu/sibu', media: 'all' %>
10
- <%= stylesheet_link_tag "#{conf[:stylesheet]}-edit", media: 'all' %>
11
14
  <%= javascript_include_tag "#{conf[:javascript]}-edit" %>
12
15
  <%= csrf_meta_tags %>
13
16
  <%= yield :styles %>
@@ -43,6 +46,8 @@
43
46
  <% end %>
44
47
  <%= javascript_include_tag 'sibu/sibu' %>
45
48
  <script>
49
+ var sectionsState = {};
50
+
46
51
  document.addEventListener("DOMContentLoaded", function() {
47
52
  initOverlays("<%= @edit_section || '' %>");
48
53
  sibuCallback("editContent");
@@ -208,25 +213,29 @@
208
213
  }
209
214
 
210
215
  function initInnerOverlays(section) {
211
- var editables = section.querySelectorAll("[data-type]");
212
- for (var i = 0; i < editables.length; i++) {
213
- if (editables[i].getAttribute("data-type") !== 'group' || editables[i].getAttribute("data-repeat") === 'true' || editables[i].getAttribute("data-children") === 'true') {
214
- editables[i].addEventListener("mouseenter", function(evt) {
215
- evt.stopPropagation();
216
- evt.currentTarget.classList.add("sb-editable");
217
- });
218
- editables[i].addEventListener("mouseleave", function(evt) {
219
- evt.currentTarget.classList.remove("sb-editable");
220
- });
221
- editables[i].addEventListener("click", function(evt) {
222
- evt.stopPropagation();
223
- evt.preventDefault();
224
- var elt = evt.currentTarget, eltId = elt.getAttribute("data-id"), repeat = elt.getAttribute("data-repeat"),
225
- type = elt.getAttribute("data-type"), size = elt.getAttribute("data-size"), children = elt.getAttribute("data-children");
226
- var sectionId = section.getAttribute("data-sb-id"), entity = section.getAttribute("data-sb-entity");
227
- editContent(eltId, sectionId, entity, repeat, type, size, children);
228
- });
216
+ var sectionId = section.getAttribute('data-sb-id');
217
+ if (!sectionsState[sectionId]) {
218
+ var editables = section.querySelectorAll("[data-type]");
219
+ for (var i = 0; i < editables.length; i++) {
220
+ if (editables[i].getAttribute("data-type") !== 'group' || editables[i].getAttribute("data-repeat") === 'true' || editables[i].getAttribute("data-children") === 'true') {
221
+ editables[i].addEventListener("mouseenter", function(evt) {
222
+ evt.stopPropagation();
223
+ evt.currentTarget.classList.add("sb-editable");
224
+ });
225
+ editables[i].addEventListener("mouseleave", function(evt) {
226
+ evt.currentTarget.classList.remove("sb-editable");
227
+ });
228
+ editables[i].addEventListener("click", function(evt) {
229
+ evt.stopPropagation();
230
+ evt.preventDefault();
231
+ var elt = evt.currentTarget, eltId = elt.getAttribute("data-id"), repeat = elt.getAttribute("data-repeat"),
232
+ type = elt.getAttribute("data-type"), size = elt.getAttribute("data-size"), children = elt.getAttribute("data-children");
233
+ var sectionId = section.getAttribute("data-sb-id"), entity = section.getAttribute("data-sb-entity");
234
+ editContent(eltId, sectionId, entity, repeat, type, size, children);
235
+ });
236
+ }
229
237
  }
238
+ sectionsState[sectionId] = 'ready';
230
239
  }
231
240
  }
232
241
 
@@ -253,7 +262,7 @@
253
262
  };
254
263
  })(sections[i], sectionBox.left, yOffset, width, height));
255
264
  }
256
- if (activeSection) {
265
+ if (activeSection && document.querySelector("[data-sb-overlay='" + activeSection + "']")) {
257
266
  document.querySelector("[data-sb-overlay='" + activeSection + "']").click();
258
267
  }
259
268
  }, 800);
@@ -0,0 +1,24 @@
1
+ <h2>Modifier le champ de saisie</h2>
2
+ <div id="edit_msg"></div>
3
+ <%= render 'element_actions' %>
4
+ <div class="sibu_edit_form">
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
+ <div class="sibu_field">
7
+ <%= label_tag 'element[field_name]', 'Type de champ' %>
8
+ <%= select_tag 'element[field_name]', input_categories, prompt: 'Sélectionnez un type de champ' %>
9
+ </div>
10
+ <div class="sibu_field">
11
+ <%= label_tag 'element[placeholder]', "Texte d'aide (optionnel)" %>
12
+ <%= text_field_tag 'element[placeholder]', @element["placeholder"] %>
13
+ </div>
14
+
15
+ <%= hidden_field_tag 'element[id]', @element["id"] %>
16
+ <%= hidden_field_tag :element_id, @element_id %>
17
+ <%= hidden_field_tag :section_id, @section_id %>
18
+ <%= hidden_field_tag :entity, @entity_type %>
19
+ <div class="sibu_actions">
20
+ <%= submit_tag 'Valider' %>
21
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
22
+ </div>
23
+ </form>
24
+ </div>
@@ -18,6 +18,8 @@ editPanel.innerHTML = "";
18
18
  editPanel.innerHTML = "<%= j(render 'map_edit_panel') %>";
19
19
  <% when /^widget/ %>
20
20
  editPanel.innerHTML = "<%= j(render "shared/sibu/#{@content_type}_panel") %>";
21
+ <% when 'input' %>
22
+ editPanel.innerHTML = "<%= j(render 'input_edit_panel') %>";
21
23
  <% else %>
22
24
  editPanel.innerHTML = "<%= j(render 'error_panel') %>";
23
25
  <% end %>
@@ -43,7 +45,9 @@ setTimeout(function() {
43
45
  for (var i = 0; i < images.length; i++) {
44
46
  images[i].addEventListener("click", function(evt) {
45
47
  if(!evt.currentTarget.classList.contains('selected')) {
46
- evt.currentTarget.classList.remove('selected');
48
+ if (editPanel.querySelector('.sibu_image.selected')) {
49
+ editPanel.querySelector('.sibu_image.selected').classList.remove('selected');
50
+ }
47
51
  evt.currentTarget.classList.add('selected');
48
52
  var imgElt = evt.currentTarget.querySelector("img");
49
53
  document.querySelector("#element_src").value = imgElt.getAttribute("data-src");
@@ -52,7 +56,9 @@ setTimeout(function() {
52
56
  '<img src="' + $("#element_src").val() + '"/>' +
53
57
  '<div id="sibu_center_pos" style="display: none;">✕</div>' +
54
58
  '<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";
59
+ if (editPanel.querySelector(".sibu_selected_image > p:first-child")) {
60
+ editPanel.querySelector(".sibu_selected_image > p:first-child").style.display = "none";
61
+ }
56
62
  editPanel.querySelector(".sibu_selected_image .sibu_custom_center").style.display = "block";
57
63
  editPanel.querySelector(".sibu_selected_image .sibu_field").style.display = "";
58
64
  if(customCenter.checked) {
@@ -93,7 +99,7 @@ setTimeout(function() {
93
99
  <% if @children %>
94
100
  document.querySelector("#child_elt").style.display = "inline-block";
95
101
  <% else %>
96
- document.querySelector("#child_elt").remove();
102
+ if (document.querySelector("#child_elt")) document.querySelector("#child_elt").remove();
97
103
  <% end %>
98
104
  var formElt = document.querySelector("form.edit_element_form");
99
105
  if (formElt) {
@@ -1,6 +1,9 @@
1
1
  <div id="pages" class="sibu_view">
2
2
  <div class="actions">
3
- <%= link_to 'Créer une page', new_site_page_path(@site.id) %> <%= link_to 'Retour', :back %>
3
+ <%= link_to "Bibliothèque d'images", images_path %>
4
+ <%= link_to "Documents", documents_path %>
5
+ <%= link_to 'Créer une page', new_site_page_path(@site.id) %>
6
+ <%= link_to 'Retour', :back %>
4
7
  </div>
5
8
  <h2>Pages du site "<%= @site.name %>"</h2>
6
9
  <table>
@@ -24,7 +27,7 @@
24
27
  <%= link_to 'Voir', site_page_path(@site.id, p), target: '_blank' %> |
25
28
  <%= link_to 'Editer', site_page_edit_content_path(site_id: @site.id, page_id: p.id) %> |
26
29
  <%= link_to 'Copier', duplicate_site_page_path(@site.id, p), method: :post, data: {confirm: "Copier la page \"#{p.name}\" ?"} %> |
27
- <%= link_to 'Réglages', edit_site_page_path(@site.id, p) %> |
30
+ <%= link_to 'Paramétrer cette page', edit_site_page_path(@site.id, p) %> |
28
31
  <%= link_to 'Supprimer', site_page_path(@site.id, p), method: :delete, data: {confirm: "Supprimer la page \"#{p.name}\" ?"} %>
29
32
  </td>
30
33
  </tr>
@@ -20,9 +20,14 @@ if (sectionsPanel) {
20
20
  }
21
21
  });
22
22
  }
23
- if(typeof initSectionsForm === "function") {
24
- initSectionsForm();
23
+
24
+ var tabs = sectionsPanel.querySelectorAll(".sibu_sections a.tabs__link");
25
+ for (var j = 0; j < tabs.length; j++) {
26
+ tabs[j].addEventListener("click", function(evt) {
27
+ sibuCallback("selectSectionsTab", evt.currentTarget.getAttribute('aria-controls'));
28
+ });
25
29
  }
30
+
26
31
  document.body.style.overflow = "hidden";
27
32
  sibuCallback("newSection");
28
33
  }
@@ -16,8 +16,8 @@
16
16
  <div class="sibu_field">
17
17
  <%= f.label :site_template_id, 'Modèle' %>
18
18
  <div>
19
- <%= f.collection_select(:site_template_id, Sibu::SiteTemplate.all, :id, :name, {prompt: 'Sélectionnez un modèle de site'}, disabled: @site.persisted?) %>
20
- <small>Choisissez le gabarit qui servira de modèle pour votre site (non modifiable après création)</small>
19
+ <%= f.collection_select(:site_template_id, Sibu::SiteTemplate.all.order(:name), :id, :name, {prompt: 'Sélectionnez un modèle de site'}, disabled: @site.persisted?) %>
20
+ <small>Choisissez le gabarit qui servira de modèle pour votre site (voir exemples ci-dessous - non modifiable après création)</small>
21
21
  </div>
22
22
  </div>
23
23
  <div class="sibu_field">
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
  <h2>Aperçu des modèles</h2>
10
10
  <div>
11
- <% Sibu::SiteTemplate.all.each do |st| %>
11
+ <% Sibu::SiteTemplate.all.order(:name).each do |st| %>
12
12
  <div class="sibu_template">
13
13
  <h3><%= st.name %></h3>
14
14
  <%= image_tag "#{st.path}1.jpg" %>
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.9'
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.4
4
+ version: 1.0.9
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-07-23 00:00:00.000000000 Z
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -143,6 +143,7 @@ files:
143
143
  - app/controllers/sibu/sites_controller.rb
144
144
  - app/helpers/sibu/application_helper.rb
145
145
  - app/helpers/sibu/documents_helper.rb
146
+ - app/helpers/sibu/extendable_helper.rb
146
147
  - app/helpers/sibu/images_helper.rb
147
148
  - app/helpers/sibu/pages_helper.rb
148
149
  - app/helpers/sibu/sites_helper.rb
@@ -177,6 +178,7 @@ files:
177
178
  - app/views/sibu/pages/_error_panel.html.erb
178
179
  - app/views/sibu/pages/_form.html.erb
179
180
  - app/views/sibu/pages/_group_edit_panel.html.erb
181
+ - app/views/sibu/pages/_input_edit_panel.html.erb
180
182
  - app/views/sibu/pages/_link_edit_panel.html.erb
181
183
  - app/views/sibu/pages/_map_edit_panel.html.erb
182
184
  - app/views/sibu/pages/_media_edit_panel.html.erb