sibu 0.8.4 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tarteaucitron/advertising.js +1 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.cs.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.de.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.el.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.en.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.es.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.fr.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.it.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.nl.js +75 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.pl.js +76 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.pt.js +73 -0
- data/app/assets/javascripts/tarteaucitron/lang/tarteaucitron.ru.js +75 -0
- data/app/assets/javascripts/tarteaucitron/tarteaucitron.js.erb +1480 -0
- data/app/assets/javascripts/tarteaucitron/tarteaucitron.services.js +2627 -0
- data/app/assets/stylesheets/sibu/defaults.scss +65 -0
- data/app/assets/stylesheets/tarteaucitron/tarteaucitron.css +749 -0
- data/app/controllers/sibu/sites_controller.rb +3 -0
- data/app/helpers/sibu/pages_helper.rb +23 -8
- data/app/models/sibu/page.rb +3 -2
- data/app/models/sibu/site.rb +8 -1
- data/app/models/sibu/site_template.rb +3 -0
- data/app/views/layouts/sibu/edit_content.html.erb +2 -2
- data/app/views/layouts/sibu/site.html.erb +42 -6
- data/config/initializers/assets.rb +1 -0
- data/config/routes.rb +3 -0
- data/lib/sibu/version.rb +1 -1
- metadata +22 -6
@@ -37,6 +37,9 @@ module Sibu
|
|
37
37
|
if conf[:custom_styles] && @site.previous_changes.has_key?(:custom_data)
|
38
38
|
generate_styles(@site)
|
39
39
|
end
|
40
|
+
if @site.previous_changes.has_key?(:version)
|
41
|
+
@site.update_paths
|
42
|
+
end
|
40
43
|
redirect_to sites_url, notice: "Le site a bien été mis à jour."
|
41
44
|
else
|
42
45
|
flash.now[:alert] = "Une erreur s'est produite lors de l'enregistrement du site."
|
@@ -90,6 +90,14 @@ module Sibu
|
|
90
90
|
content_tag(wrapper, capture(*elts(elt), &block), opts)
|
91
91
|
end
|
92
92
|
|
93
|
+
def empty_tag(elt, tag, type, opts = {})
|
94
|
+
repeat = opts.delete(:repeat)
|
95
|
+
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt}.merge!(default_content(type))
|
96
|
+
opts = defaults.merge(opts)
|
97
|
+
opts.merge!({data: {id: elt_id(elt), type: type, repeat: repeat}}) if action_name != 'show'
|
98
|
+
content_tag(tag, nil, opts)
|
99
|
+
end
|
100
|
+
|
93
101
|
def form_label(elt, html_opts = {}, &block)
|
94
102
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => DEFAULT_TEXT}
|
95
103
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
@@ -131,14 +139,6 @@ module Sibu
|
|
131
139
|
content_tag(tag, capture(self, &block), opts)
|
132
140
|
end
|
133
141
|
|
134
|
-
def sections(id, tag, html_opts = {}, &block)
|
135
|
-
(@sb_entity.find_or_init(id)["elements"].map.with_index do |elt, i|
|
136
|
-
@sb_section = [id, elt["id"]]
|
137
|
-
opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => @sb_section.join('|'), "data-sb-repeat" => true, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
138
|
-
content_tag(tag, capture(self, i, &block), opts)
|
139
|
-
end).join('').html_safe
|
140
|
-
end
|
141
|
-
|
142
142
|
def elts(id)
|
143
143
|
items = []
|
144
144
|
element_id = elt_id(id)
|
@@ -190,5 +190,20 @@ module Sibu
|
|
190
190
|
def elt_id(elt)
|
191
191
|
elt.is_a?(Hash) ? (elt["data-id"] || elt["id"]) : elt
|
192
192
|
end
|
193
|
+
|
194
|
+
def default_content(type)
|
195
|
+
case type
|
196
|
+
when "text"
|
197
|
+
{"text" => DEFAULT_TEXT}
|
198
|
+
when "link"
|
199
|
+
{"value" => "", "text" => DEFAULT_TEXT}
|
200
|
+
when "paragraph"
|
201
|
+
{"text" => DEFAULT_PARAGRAPH}
|
202
|
+
when "media"
|
203
|
+
{"src" => DEFAULT_IMG}
|
204
|
+
when "embed"
|
205
|
+
{"code" => '<p>Contenu HTML personnalisé (iframe, etc...)</p>'}
|
206
|
+
end
|
207
|
+
end
|
193
208
|
end
|
194
209
|
end
|
data/app/models/sibu/page.rb
CHANGED
@@ -30,12 +30,13 @@ module Sibu
|
|
30
30
|
save
|
31
31
|
end
|
32
32
|
|
33
|
-
def update_path
|
33
|
+
def update_path(force_update = false)
|
34
34
|
prefix = site.version == Sibu::Site::DEFAULT_VERSION ? '' : "#{site.version}/"
|
35
35
|
if is_home == 'true'
|
36
|
-
self.path =
|
36
|
+
self.path = prefix
|
37
37
|
else
|
38
38
|
self.path = "#{prefix}#{name.parameterize}" if self.path.blank?
|
39
|
+
self.path = "#{prefix}#{name.parameterize}" if self.path.blank? || force_update
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
data/app/models/sibu/site.rb
CHANGED
@@ -36,7 +36,7 @@ module Sibu
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def section_template(section)
|
39
|
-
|
39
|
+
"#{site_template.path}/#{section["category"]}/#{section["template"]}"
|
40
40
|
end
|
41
41
|
|
42
42
|
def not_found
|
@@ -69,6 +69,13 @@ module Sibu
|
|
69
69
|
Hash[pages.collect {|p| [p.id.to_s, p.path]}]
|
70
70
|
end
|
71
71
|
|
72
|
+
def update_paths
|
73
|
+
pages.each do |p|
|
74
|
+
p.update_path(true)
|
75
|
+
p.save
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
72
79
|
def init_pages(source)
|
73
80
|
site_data = Rails.application.config.sibu[:site_data][source]
|
74
81
|
site_data.pages.each do |p|
|
@@ -16,6 +16,9 @@ module Sibu
|
|
16
16
|
sections_list += Dir.glob(dir + "*.erb").map {|f| f.split('/').last}.
|
17
17
|
map {|f| f[1..-1].gsub('.html.erb', '')}.map {|f| {"id" => "sibu_template_#{f}", "category" => cat, "template" => f}}
|
18
18
|
end
|
19
|
+
if Rails.application.config.sibu[:sections_ordering]
|
20
|
+
sections_list = Rails.application.config.sibu[:sections_ordering].call(sections_list)
|
21
|
+
end
|
19
22
|
sections_list
|
20
23
|
end
|
21
24
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title><%= conf[:title] %></title>
|
5
|
-
<%= stylesheet_link_tag "#{conf[:stylesheet]}-edit", media: 'all' %>
|
6
5
|
<%= stylesheet_link_tag 'sibu/sibu', media: 'all' %>
|
7
|
-
<%=
|
6
|
+
<%= stylesheet_link_tag "#{conf[:stylesheet]}-edit", media: 'all' %>
|
8
7
|
<%= javascript_include_tag 'sibu/sibu' %>
|
8
|
+
<%= javascript_include_tag "#{conf[:javascript]}-edit" %>
|
9
9
|
<% if @site %>
|
10
10
|
<%= stylesheet_link_tag (conf[:custom_styles] ? @site.style_url : @site.site_template.path), media: "all" %>
|
11
11
|
<%= javascript_include_tag "#{@site.site_template.path}-core" %>
|
@@ -10,12 +10,48 @@
|
|
10
10
|
<%= stylesheet_link_tag (conf[:custom_styles] ? @site.style_url : @site.site_template.path), media: "all" %>
|
11
11
|
<%= javascript_include_tag @site.site_template.path %>
|
12
12
|
<% unless @site.analytics_id.blank? %>
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
<%= stylesheet_link_tag 'tarteaucitron/tarteaucitron' %>
|
14
|
+
<%= javascript_include_tag 'tarteaucitron/tarteaucitron' %>
|
15
|
+
<script type="text/javascript">
|
16
|
+
var defaultOpts = {
|
17
|
+
"privacyUrl": "", /* Privacy policy url */
|
18
|
+
"hashtag": "#tarteaucitron", /* Open the panel with this hashtag */
|
19
|
+
"cookieName": "tarteaucitron", /* Cookie name */
|
20
|
+
"orientation": "bottom", /* Banner position (top - bottom) */
|
21
|
+
"showAlertSmall": false, /* Show the small banner on bottom right */
|
22
|
+
"cookieslist": true, /* Show the cookie list */
|
23
|
+
"adblocker": false, /* Show a Warning if an adblocker is detected */
|
24
|
+
"AcceptAllCta": true, /* Show the accept all button when highPrivacy on */
|
25
|
+
"highPrivacy": false, /* Disable auto consent */
|
26
|
+
"handleBrowserDNTRequest": false, /* If Do Not Track == 1, disallow all */
|
27
|
+
"removeCredit": false, /* Remove credit link */
|
28
|
+
"moreInfoLink": true, /* Show more info link */
|
29
|
+
"useExternalCss": true, /* If false, the tarteaucitron.css file will be loaded */
|
30
|
+
"readmoreLink": "/cookiespolicy" /* Change the default readmore link */
|
31
|
+
};
|
32
|
+
if (typeof tarteaucitronOpts === 'undefined') {
|
33
|
+
var tarteaucitronOpts = defaultOpts;
|
34
|
+
} else {
|
35
|
+
tarteaucitronOpts["hashtag"] = "#tarteaucitron";
|
36
|
+
tarteaucitronOpts["cookieName"] = "tarteaucitron";
|
37
|
+
tarteaucitronOpts["orientation"] = tarteaucitronOpts["orientation"] || "top";
|
38
|
+
tarteaucitronOpts["showAlertSmall"] = !(tarteaucitronOpts["showAlertSmall"] === false);
|
39
|
+
tarteaucitronOpts["cookieslist"] = !(tarteaucitronOpts["cookieslist"] === false);
|
40
|
+
tarteaucitronOpts["adblocker"] = tarteaucitronOpts["adblocker"] === true;
|
41
|
+
tarteaucitronOpts["AcceptAllCta"] = tarteaucitronOpts["AcceptAllCta"] === true;
|
42
|
+
tarteaucitronOpts["highPrivacy"] = !(tarteaucitronOpts["AcceptAllCta"] === false);
|
43
|
+
tarteaucitronOpts["handleBrowserDNTRequest"] = !(tarteaucitronOpts["handleBrowserDNTRequest"] === false);
|
44
|
+
tarteaucitronOpts["removeCredit"] = !(tarteaucitronOpts["removeCredit"] === false);
|
45
|
+
tarteaucitronOpts["moreInfoLink"] = tarteaucitronOpts["moreInfoLink"] === true;
|
46
|
+
tarteaucitronOpts["useExternalCss"] = !(tarteaucitronOpts["useExternalCss"] === false);
|
47
|
+
tarteaucitronOpts["cookieDomain"] = "<%= @site.domain %>";
|
48
|
+
}
|
49
|
+
tarteaucitron.init(tarteaucitronOpts);
|
50
|
+
</script>
|
51
|
+
<script type="text/javascript">
|
52
|
+
tarteaucitron.user.analyticsUa = '<%= @site.analytics_id %>';
|
53
|
+
tarteaucitron.user.analyticsMore = function () { };
|
54
|
+
(tarteaucitron.job = tarteaucitron.job || []).push('analytics');
|
19
55
|
</script>
|
20
56
|
<% end %>
|
21
57
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.assets.precompile += %w( tarteaucitron/tarteaucitron.css tarteaucitron/tarteaucitron.js )
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
Sibu::Engine.routes.draw do
|
2
2
|
|
3
|
+
scope format: true, constraints: { format: /jpg|png|gif|svg/ } do
|
4
|
+
get '/*missed', to: proc { [404, {}, ['']] }
|
5
|
+
end
|
3
6
|
get '/', to: 'pages#show', constraints: lambda {|req| req.host != Rails.application.config.sibu[:host]}
|
4
7
|
get '*path', to: 'pages#show', constraints: lambda {|req| req.host != Rails.application.config.sibu[:host]}
|
5
8
|
|
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.9.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:
|
11
|
+
date: 2020-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: shrine
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,11 +130,26 @@ files:
|
|
130
130
|
- app/assets/javascripts/sibu/common.js
|
131
131
|
- app/assets/javascripts/sibu/sibu.js.erb
|
132
132
|
- app/assets/javascripts/tabs/van11y-accessible-tab-panel-aria.js
|
133
|
+
- app/assets/javascripts/tarteaucitron/advertising.js
|
134
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.cs.js
|
135
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.de.js
|
136
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.el.js
|
137
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.en.js
|
138
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.es.js
|
139
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.fr.js
|
140
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.it.js
|
141
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.nl.js
|
142
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.pl.js
|
143
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.pt.js
|
144
|
+
- app/assets/javascripts/tarteaucitron/lang/tarteaucitron.ru.js
|
145
|
+
- app/assets/javascripts/tarteaucitron/tarteaucitron.js.erb
|
146
|
+
- app/assets/javascripts/tarteaucitron/tarteaucitron.services.js
|
133
147
|
- app/assets/stylesheets/cropper/cropper.css
|
134
148
|
- app/assets/stylesheets/quill/quill.snow.css
|
135
149
|
- app/assets/stylesheets/sibu/defaults.scss
|
136
150
|
- app/assets/stylesheets/sibu/icons.scss
|
137
151
|
- app/assets/stylesheets/sibu/sibu.css
|
152
|
+
- app/assets/stylesheets/tarteaucitron/tarteaucitron.css
|
138
153
|
- app/controllers/sibu/application_controller.rb
|
139
154
|
- app/controllers/sibu/documents_controller.rb
|
140
155
|
- app/controllers/sibu/images_controller.rb
|
@@ -207,6 +222,7 @@ files:
|
|
207
222
|
- app/views/sibu/sites/new.html.erb
|
208
223
|
- app/views/sibu/sites/show.html.erb
|
209
224
|
- app/views/sibu/sites/update.html.erb
|
225
|
+
- config/initializers/assets.rb
|
210
226
|
- config/initializers/constants.rb
|
211
227
|
- config/initializers/shrine.rb
|
212
228
|
- config/routes.rb
|