sibu 0.3.9 → 0.4.0

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: 2ed2b94d1a87f438fc6eb718059f642276236c2c
4
- data.tar.gz: 89102521337f1dadae87a2a54ca97f8e197ccdfc
3
+ metadata.gz: 23580168267b70a604f22863c33d73268eed7967
4
+ data.tar.gz: 0cac86156e41ebd512473aa887fab6fd02fb5b1b
5
5
  SHA512:
6
- metadata.gz: 7bd12440bb6c524396acd5358bf0d9d7c719e349301ef755dd060674e8beb34cbc72eddd9adadc6ee2d7de9bfd4387f7b8e23f9e46a1b596aff7415cd1eaab05
7
- data.tar.gz: 2b5c1829b6fead0c43eff2b5051d71603a40b535a62646c8d8b7abdec1c355716f686ff93dbd47329ad744d657a4906f9ae2d177e64b0f499124bb648c119454
6
+ metadata.gz: a48297363054e2ec96bcc07821a45395ef9a3e56e72f2c3edcaa4c28cf05612ec1d6b3b7dd046f67f5ccfd1e564f2c6564467383f2c8ea5e9a417fe17e551ac7
7
+ data.tar.gz: abd171b04e211b2b22d3d2136ee35101bb48f7e0d40b93377c377e6ab3e5c47372ddfdf0578594eb8d7591814ce93923b4659f3846f868c0529df465cc068fd6
@@ -80,7 +80,7 @@ module Sibu
80
80
  defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt}
81
81
  opts = defaults.merge(opts)
82
82
  opts.merge!({data: {id: elt_id(elt), type: "group", repeat: repeat, children: children}}) if action_name != 'show'
83
- content_tag(wrapper, capture(self, &block), opts)
83
+ content_tag(wrapper, capture(*elts(elt), &block), opts)
84
84
  end
85
85
 
86
86
  def form_label(elt, html_opts = {}, &block)
@@ -156,10 +156,11 @@ module Sibu
156
156
  else
157
157
  content["href"] = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
158
158
  end
159
+ # Note : sends elts in given order
159
160
  if block_given?
160
- content_tag(:a, content.merge(html_opts).except("elements"), &block)
161
+ content_tag(:a, capture(*([raw(text)] + elts(elt)), &block), content.merge(html_opts).except("elements"))
161
162
  else
162
- content_tag(:a, text, content.merge(html_opts).except("elements"))
163
+ content_tag(:a, raw(text), content.merge(html_opts).except("elements"))
163
164
  end
164
165
  end
165
166
 
@@ -22,7 +22,7 @@ module Sibu
22
22
  File.rename(scss_file_path, css_file_path)
23
23
  site.update(style: File.new(css_file_path))
24
24
  rescue Exception => ex
25
- logger.error(ex)
25
+ Rails.logger.error(ex)
26
26
  ensure
27
27
  File.delete(scss_file_path) if scss_file_path && File.exist?(scss_file_path)
28
28
  File.delete(css_file_path) if css_file_path && File.exist?(css_file_path)
@@ -28,7 +28,7 @@
28
28
  <% end %>
29
29
  <% if @documents.empty? %>
30
30
  <tr>
31
- <td colspan="4">Aucun document téléchargé pour le moment.</td>
31
+ <td colspan="5">Aucun document téléchargé pour le moment.</td>
32
32
  </tr>
33
33
  <% end %>
34
34
  </tbody>
@@ -27,6 +27,12 @@
27
27
  <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'document' %>
28
28
  </div>
29
29
  <%= hidden_field_tag 'element[id]', @element["id"] %>
30
+ <!-- Note : to be tested on multiple nested elements -->
31
+ <% (@element["elements"] || []).each do |e| %>
32
+ <% e.each_pair do |k, v| %>
33
+ <%= hidden_field_tag "element[elements][][#{k}]", v %>
34
+ <% end %>
35
+ <% end %>
30
36
  <%= hidden_field_tag :element_id, @element_id %>
31
37
  <%= hidden_field_tag :section_id, @section_id %>
32
38
  <%= hidden_field_tag :entity, @entity_type %>
@@ -1,24 +1,6 @@
1
1
  <% if @updated.nil? %>
2
2
  $("#edit_panel #edit_msg").html("<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>");
3
- <% elsif @refresh %>
4
- $("#edit_panel").slideUp();
5
- location.reload(true);
6
3
  <% else %>
7
4
  $("#edit_panel").slideUp();
8
- var updatedElt = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']");
9
- <% if @updated["text"] %>
10
- updatedElt.html("<%= j(raw @updated["text"]) %>");
11
- <% elsif @updated["code"] %>
12
- updatedElt.html("<%= j(raw @updated["code"]) %>");
13
- <% end %>
14
- <% unless @updated.except("id", "text", "value").blank? %>
15
- var tag = updatedElt.prop("tagName").toLowerCase();
16
- <% @updated.except("id", "text", "value").each_pair do |attr, val| %>
17
- if(("<%= attr %>" === 'src' || "<%= attr %>" === 'alt' || "<%= attr %>" === 'style') && tag !== 'img') {
18
- updatedElt.find("img").attr("<%= attr %>", "<%= val %>");
19
- } else {
20
- updatedElt.attr("<%= attr %>", "<%= val %>");
21
- }
22
- <% end %>
23
- <% end %>
5
+ refreshAfterEdit(true, '<%= @section_id %>');
24
6
  <% end %>
data/lib/sibu/engine.rb CHANGED
@@ -4,5 +4,13 @@ module Sibu
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace Sibu
6
6
  config.assets.paths << File.expand_path("../../assets/fonts", __FILE__)
7
+ config.to_prepare do
8
+ begin
9
+ # Load custom helper if defined
10
+ ApplicationController.helper(SibuCustomHelper)
11
+ rescue
12
+ Rails.logger.info("Sibu custom helper is not available - skipping")
13
+ end
14
+ end
7
15
  end
8
16
  end
data/lib/sibu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.3.9'
2
+ VERSION = '0.4.0'
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: 0.3.9
4
+ version: 0.4.0
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: 2018-07-09 00:00:00.000000000 Z
11
+ date: 2018-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails