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 +4 -4
- data/app/helpers/sibu/pages_helper.rb +4 -3
- data/app/models/sibu/dynamic_style.rb +1 -1
- data/app/views/sibu/documents/index.html.erb +1 -1
- data/app/views/sibu/pages/_link_edit_panel.html.erb +6 -0
- data/app/views/sibu/pages/update_element.js.erb +1 -19
- data/lib/sibu/engine.rb +8 -0
- data/lib/sibu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23580168267b70a604f22863c33d73268eed7967
|
4
|
+
data.tar.gz: 0cac86156e41ebd512473aa887fab6fd02fb5b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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")
|
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)
|
@@ -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
|
-
|
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
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.
|
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
|
11
|
+
date: 2018-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|