sibu 0.8.2 → 0.9.2
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/sibu/sibu.js.erb +1 -0
- 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 +71 -29
- data/app/assets/stylesheets/tarteaucitron/tarteaucitron.css +749 -0
- data/app/helpers/sibu/pages_helper.rb +23 -0
- data/app/models/concerns/sibu/user_concern.rb +2 -1
- data/app/views/layouts/sibu/site.html.erb +42 -6
- data/app/views/sibu/pages/_media_edit_panel.html.erb +24 -7
- data/app/views/sibu/pages/edit_element.js.erb +10 -5
- data/config/initializers/assets.rb +1 -0
- data/config/routes.rb +3 -0
- data/lib/sibu/version.rb +1 -1
- metadata +22 -6
@@ -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) || {}))
|
@@ -190,5 +198,20 @@ module Sibu
|
|
190
198
|
def elt_id(elt)
|
191
199
|
elt.is_a?(Hash) ? (elt["data-id"] || elt["id"]) : elt
|
192
200
|
end
|
201
|
+
|
202
|
+
def default_content(type)
|
203
|
+
case type
|
204
|
+
when "text"
|
205
|
+
{"text" => DEFAULT_TEXT}
|
206
|
+
when "link"
|
207
|
+
{"value" => "", "text" => DEFAULT_TEXT}
|
208
|
+
when "paragraph"
|
209
|
+
{"text" => DEFAULT_PARAGRAPH}
|
210
|
+
when "media"
|
211
|
+
{"src" => DEFAULT_IMG}
|
212
|
+
when "embed"
|
213
|
+
{"code" => '<p>Contenu HTML personnalisé (iframe, etc...)</p>'}
|
214
|
+
end
|
215
|
+
end
|
193
216
|
end
|
194
217
|
end
|
@@ -3,7 +3,8 @@ module Sibu
|
|
3
3
|
include ActiveSupport::Concern
|
4
4
|
|
5
5
|
def for_user(usr)
|
6
|
-
Rails.application.config.sibu[:multi_user] ? where(user_id: [nil, usr.id]) : all
|
6
|
+
entities = (Rails.application.config.sibu[:multi_user] ? where(user_id: [nil, usr.id]) : all)
|
7
|
+
entities.order(updated_at: :desc)
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
@@ -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 %>
|
@@ -7,13 +7,29 @@
|
|
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,
|
9
9
|
element_id: @element_id, img_id: @element["id"], size: @size) %> une image</p>
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
<table class="sibu_images">
|
11
|
+
<thead>
|
12
|
+
<tr>
|
13
|
+
<th>Aperçu</th>
|
14
|
+
<th>Descriptif</th>
|
15
|
+
<th>Crédits</th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% site_images.each do |image| %>
|
20
|
+
<tr>
|
21
|
+
<td>
|
22
|
+
<span class="sibu_image" data-img-id="<%= image.id %>">
|
23
|
+
<%= image_tag image.file_url(:small), class: (@element["src"] == image.file_url(@size) ? 'selected' : ''),
|
24
|
+
data: {src: image.file_url(@size), alt: image.alt} %>
|
25
|
+
</span>
|
26
|
+
</td>
|
27
|
+
<td><%= image.alt %></td>
|
28
|
+
<td><%= image.credits %></td>
|
29
|
+
</tr>
|
30
|
+
<% end %>
|
31
|
+
</tbody>
|
32
|
+
</table>
|
17
33
|
</div>
|
18
34
|
<div class="sibu_selected_image">
|
19
35
|
<% if @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
|
@@ -26,6 +42,7 @@
|
|
26
42
|
<div class="sibu_center">
|
27
43
|
<%= image_tag(@element["src"]) unless @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
|
28
44
|
<div id="sibu_center_pos" style="display: none;">✕</div>
|
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>
|
29
46
|
</div>
|
30
47
|
<div class="sibu_field" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
|
31
48
|
<%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
|
@@ -38,15 +38,19 @@ editPanel.slideDown("fast", function() {
|
|
38
38
|
"text-align": wrapper.css("text-align")
|
39
39
|
});
|
40
40
|
<% when 'media' %>
|
41
|
-
var images = editPanel.find(".sibu_image
|
42
|
-
var customCenter = $("#custom_center")
|
41
|
+
var images = editPanel.find(".sibu_image");
|
42
|
+
var customCenter = $("#custom_center");
|
43
43
|
images.click(function() {
|
44
44
|
if(!$(this).hasClass('selected')) {
|
45
45
|
images.removeClass('selected');
|
46
46
|
$(this).addClass('selected');
|
47
|
-
$(
|
48
|
-
$("#
|
49
|
-
|
47
|
+
var imgElt = $(this).find("img");
|
48
|
+
$("#element_src").val(imgElt.data("src"));
|
49
|
+
$("#element_alt").val(imgElt.data("alt"));
|
50
|
+
editPanel.find(".sibu_center").html(
|
51
|
+
'<img src="' + $("#element_src").val() + '"/>' +
|
52
|
+
'<div id="sibu_center_pos" style="display: none;">✕</div>' +
|
53
|
+
'<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>');
|
50
54
|
editPanel.find(".sibu_selected_image > p:first-child").hide();
|
51
55
|
editPanel.find(".sibu_selected_image").find(".sibu_custom_center").show();
|
52
56
|
editPanel.find(".sibu_selected_image").find(".sibu_field").show();
|
@@ -69,6 +73,7 @@ editPanel.slideDown("fast", function() {
|
|
69
73
|
$("#element_class").val("");
|
70
74
|
$(".sibu_center").attr("style", "");
|
71
75
|
$(".sibu_center > #sibu_center_pos").hide();
|
76
|
+
$(".sibu_center > #sibu_center_desc").hide();
|
72
77
|
}
|
73
78
|
});
|
74
79
|
<% when 'link' %>
|
@@ -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.2
|
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: 2019-
|
11
|
+
date: 2019-10-30 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
|