sibu 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/sibu/sibu.css +31 -20
- data/app/controllers/sibu/pages_controller.rb +5 -4
- data/app/helpers/sibu/pages_helper.rb +51 -25
- data/app/helpers/sibu/sites_helper.rb +2 -2
- data/app/views/layouts/sibu/edit_content.html.erb +86 -50
- data/app/views/layouts/sibu/site.html.erb +6 -0
- data/app/views/sibu/pages/_link_edit_panel.html.erb +1 -0
- data/app/views/sibu/pages/_media_edit_panel.html.erb +2 -1
- data/app/views/sibu/pages/_text_edit_panel.html.erb +1 -0
- data/app/views/sibu/pages/clone_element.js.erb +1 -1
- data/app/views/sibu/pages/edit_content.html.erb +0 -1
- data/app/views/sibu/pages/edit_element.js.erb +7 -3
- data/app/views/sibu/pages/show.html.erb +0 -1
- data/app/views/sibu/pages/update_element.js.erb +7 -2
- data/app/views/sibu/sites/_form.html.erb +2 -2
- 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: c61f2f2905326da60f6cd60d7a4288fda6c788b4
|
4
|
+
data.tar.gz: ff7bb3dc20761e3919071963598eca29ad12fb61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0d470dac9b1215dd9d27e59b21e278c40beae5abbaed2dde2718348945dd9e42411c1e9ccef307e9cec56de5736cdc90d23684621e2a2574c1ace95861d8c28
|
7
|
+
data.tar.gz: 9d7896645eb2ae46714c8f60acf0e379a93738ad159f075a986a79d5ff979e4d4b8f3b792e4628db91b1be897366901913024bf2e25cef084d18c7523d364a10
|
@@ -7,29 +7,29 @@
|
|
7
7
|
position: relative
|
8
8
|
}
|
9
9
|
|
10
|
-
sb-edit {
|
11
|
-
position: relative
|
12
|
-
display: inherit
|
13
|
-
width: 100
|
14
|
-
}
|
10
|
+
/*sb-edit {*/
|
11
|
+
/*position: relative;*/
|
12
|
+
/*display: inherit;*/
|
13
|
+
/*width: 100%;*/
|
14
|
+
/*}*/
|
15
15
|
|
16
|
-
sb-edit div.sb-overlay {
|
17
|
-
position: absolute
|
18
|
-
z-index: 999
|
19
|
-
opacity: 0
|
20
|
-
background-color: rgba(0, 0, 0, 0.5)
|
21
|
-
cursor: pointer
|
22
|
-
top: 0
|
23
|
-
left: 0
|
24
|
-
}
|
16
|
+
/*sb-edit div.sb-overlay {*/
|
17
|
+
/*position: absolute;*/
|
18
|
+
/*z-index: 999;*/
|
19
|
+
/*opacity: 0;*/
|
20
|
+
/*background-color: rgba(0, 0, 0, 0.5);*/
|
21
|
+
/*cursor: pointer;*/
|
22
|
+
/*top: 0;*/
|
23
|
+
/*left: 0;*/
|
24
|
+
/*}*/
|
25
25
|
|
26
|
-
sb-edit div.sb-overlay a {
|
27
|
-
display: inline-block
|
28
|
-
width: 100
|
29
|
-
height: 100
|
30
|
-
}
|
26
|
+
/*sb-edit div.sb-overlay a {*/
|
27
|
+
/*display: inline-block;*/
|
28
|
+
/*width: 100%;*/
|
29
|
+
/*height: 100%;*/
|
30
|
+
/*}*/
|
31
31
|
|
32
|
-
|
32
|
+
.sb-editable {
|
33
33
|
cursor: pointer;
|
34
34
|
outline: dashed rgba(94, 219, 255, 0.8) 2px;
|
35
35
|
outline-offset: -3px;
|
@@ -81,6 +81,17 @@ sb-edit .sb-editable {
|
|
81
81
|
background-color: white;
|
82
82
|
}
|
83
83
|
|
84
|
+
#edit_overlays > * {
|
85
|
+
position: absolute;
|
86
|
+
z-index: 999;
|
87
|
+
background-color: rgba(94, 219, 255, 0.5);
|
88
|
+
opacity: 0;
|
89
|
+
display: flex;
|
90
|
+
justify-content: center;
|
91
|
+
align-items: center;
|
92
|
+
cursor: pointer;
|
93
|
+
}
|
94
|
+
|
84
95
|
.trix-button-group--block-tools {
|
85
96
|
display: none !important;
|
86
97
|
}
|
@@ -72,19 +72,20 @@ module Sibu
|
|
72
72
|
def edit_element
|
73
73
|
@content_type = params[:content_type]
|
74
74
|
@links = @site.pages_path_by_id if @site
|
75
|
-
@element = @entity.element(*@section_id.split('|'),
|
75
|
+
@element = @entity.element(*@section_id.split('|'), *@element_id.split('|'))
|
76
76
|
end
|
77
77
|
|
78
78
|
def update_element
|
79
|
-
|
79
|
+
ids = (@section_id.split('|') + @element_id.split('|')).uniq[0...-1]
|
80
|
+
@updated = @entity.update_element(*ids, element_params)
|
80
81
|
end
|
81
82
|
|
82
83
|
def clone_element
|
83
|
-
@cloned = @entity.clone_element(*@section_id.split('|'),
|
84
|
+
@cloned = @entity.clone_element(*@section_id.split('|'), *@element_id.split('|'))
|
84
85
|
end
|
85
86
|
|
86
87
|
def delete_element
|
87
|
-
@deleted = @entity.delete_element(*@section_id.split('|'),
|
88
|
+
@deleted = @entity.delete_element(*@section_id.split('|'), *@element_id.split('|'))
|
88
89
|
end
|
89
90
|
|
90
91
|
def edit_section
|
@@ -21,7 +21,7 @@ module Sibu
|
|
21
21
|
define_method(t) do |elt, html_opts = {}|
|
22
22
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => "Texte à modifier"}
|
23
23
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
24
|
-
html_opts.merge!({class: "sb-#{t} #{html_opts[:class]}", data: {id:
|
24
|
+
html_opts.merge!({class: "sb-#{t} #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
|
25
25
|
content_tag(t, raw(content["text"]).html_safe, html_opts)
|
26
26
|
end
|
27
27
|
end
|
@@ -100,7 +100,7 @@ module Sibu
|
|
100
100
|
wrapper = opts.delete(:wrapper)
|
101
101
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => "/default.jpg"}
|
102
102
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
103
|
-
opts.merge!({class: "sb-img #{opts[:class]}", data: {id: elt
|
103
|
+
opts.merge!({class: "sb-img #{opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
|
104
104
|
wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts) : content_tag(:img, nil, content.except("id").merge(opts))
|
105
105
|
end
|
106
106
|
|
@@ -117,31 +117,53 @@ module Sibu
|
|
117
117
|
end
|
118
118
|
alias site sb_site
|
119
119
|
|
120
|
-
def repeat(&block)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
@sb_section = id
|
128
|
-
if block_given?
|
129
|
-
if current_action != 'show'
|
130
|
-
"<sb-edit data-id='#{@sb_section}' data-entity='#{@sb_entity == @site ? 'site' : 'page'}'>#{capture(self, &block)}</sb-edit>".html_safe
|
131
|
-
else
|
132
|
-
capture(self, &block)
|
133
|
-
end
|
134
|
-
else
|
135
|
-
self
|
136
|
-
end
|
137
|
-
end
|
120
|
+
# def repeat(id, tag, html_opts = {}, &block)
|
121
|
+
# @sb_section = [id]
|
122
|
+
# opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => id, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
123
|
+
# ((action_name != 'show' ? "<sb-edit data-id='#{@sb_section}' data-entity='#{@sb_entity == @site ? 'site' : 'page'}'>" : '') +
|
124
|
+
# @sb_entity.section(@sb_section).map {|elt| capture(elt, &block)}.join('') +
|
125
|
+
# (action_name != 'show' ? "</sb-edit>" : '')).html_safe
|
126
|
+
# end
|
138
127
|
|
139
|
-
def
|
128
|
+
# def secsion(id)
|
129
|
+
# @sb_section = id
|
130
|
+
# if block_given?
|
131
|
+
# if current_action != 'show'
|
132
|
+
# "<sb-edit data-id='#{@sb_section}' data-entity='#{@sb_entity == @site ? 'site' : 'page'}'>#{capture(self, &block)}</sb-edit>".html_safe
|
133
|
+
# else
|
134
|
+
# capture(self, &block)
|
135
|
+
# end
|
136
|
+
# else
|
137
|
+
# self
|
138
|
+
# end
|
139
|
+
# end
|
140
|
+
#
|
141
|
+
# def secsions(id)
|
142
|
+
#
|
143
|
+
# end
|
140
144
|
|
145
|
+
def secsion(id, tag, html_opts = {}, &block)
|
146
|
+
@sb_section = [id]
|
147
|
+
opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => id, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
148
|
+
content_tag(tag, capture(self, &block), opts)
|
141
149
|
end
|
142
150
|
|
143
|
-
def
|
151
|
+
def secsions(id, tag, html_opts = {}, &block)
|
152
|
+
(@sb_entity.section(id).map.with_index do |elt, i|
|
153
|
+
@sb_section = [id, elt["id"]]
|
154
|
+
opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => @sb_section.join('|'), "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
155
|
+
content_tag(tag, capture(self, i, &block), opts)
|
156
|
+
end).join('').html_safe
|
157
|
+
end
|
144
158
|
|
159
|
+
# Note : could work well - set the ids hierarchy in elements retrieved from the db
|
160
|
+
def elts(id)
|
161
|
+
items = []
|
162
|
+
@sb_entity.section(*@sb_section, id).each do |item|
|
163
|
+
item["id"] = [id, item["id"]].join("|")
|
164
|
+
items << item
|
165
|
+
end
|
166
|
+
items
|
145
167
|
end
|
146
168
|
|
147
169
|
# def bg_img(elt, html_opts = {})
|
@@ -154,7 +176,7 @@ module Sibu
|
|
154
176
|
def link(elt, html_opts = {}, &block)
|
155
177
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "value" => "", "text" => "Nouveau lien"}
|
156
178
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
157
|
-
html_opts.merge!({class: "sb-link #{html_opts[:class]}", data: {id: elt
|
179
|
+
html_opts.merge!({class: "sb-link #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
|
158
180
|
val = content["value"] || ""
|
159
181
|
if val.to_s.include?('http')
|
160
182
|
href = val
|
@@ -171,15 +193,19 @@ module Sibu
|
|
171
193
|
def form_label(elt, html_opts = {}, &block)
|
172
194
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => "Texte à modifier"}
|
173
195
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
174
|
-
html_opts.merge!({class: "sb-label #{html_opts[:class]}", data: {id:
|
196
|
+
html_opts.merge!({class: "sb-label #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
|
175
197
|
content_tag(:label, raw(content["text"]).html_safe, html_opts)
|
176
198
|
end
|
177
199
|
|
178
200
|
def interactive_map(elt, html_opts = {}, &block)
|
179
201
|
defaults = {"data-lat" => "45.68854", "data-lng" => "5.91587", "data-title" => "Titre marqueur"}
|
180
202
|
content = elt.is_a?(Hash) ? defaults.merge(elt) : (select_element(elt) || {"id" => elt}).merge(defaults)
|
181
|
-
html_opts.merge!({class: "sb-map #{html_opts[:class]}", data: {id: elt
|
203
|
+
html_opts.merge!({class: "sb-map #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
|
182
204
|
content_tag(:div, nil, content.merge(html_opts))
|
183
205
|
end
|
206
|
+
|
207
|
+
def elt_id(elt)
|
208
|
+
elt.is_a?(Hash) ? elt["id"] : elt
|
209
|
+
end
|
184
210
|
end
|
185
211
|
end
|
@@ -9,11 +9,11 @@ module Sibu
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def primary_fonts
|
12
|
-
Rails.application.config.sibu[:primary_fonts]
|
12
|
+
[''] + Rails.application.config.sibu[:primary_fonts]
|
13
13
|
end
|
14
14
|
|
15
15
|
def secondary_fonts
|
16
|
-
Rails.application.config.sibu[:secondary_fonts]
|
16
|
+
[''] + Rails.application.config.sibu[:secondary_fonts]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -10,6 +10,12 @@
|
|
10
10
|
<%= stylesheet_link_tag @site.site_template.path, media: "all" %>
|
11
11
|
<%= javascript_include_tag "#{@site.site_template.path}-core" %>
|
12
12
|
<% end %>
|
13
|
+
<% unless @site.primary_font.blank? %>
|
14
|
+
<%= stylesheet_link_tag "fonts/#{@site.primary_font.downcase}", media: "all" %>
|
15
|
+
<% end %>
|
16
|
+
<% unless @site.secondary_font.blank? %>
|
17
|
+
<%= stylesheet_link_tag "fonts/#{@site.secondary_font.downcase}", media: "all" %>
|
18
|
+
<% end %>
|
13
19
|
<%= csrf_meta_tags %>
|
14
20
|
<%= yield :styles %>
|
15
21
|
</head>
|
@@ -29,10 +35,11 @@
|
|
29
35
|
<p id="edit_section_msg">Modifier la section</p>
|
30
36
|
<button id="clone_section" onclick="cloneSection()">Dupliquer</button>
|
31
37
|
<button id="delete_section" onclick="deleteSection()">Supprimer</button>
|
32
|
-
<button onclick="cancelEditMode()">
|
38
|
+
<button onclick="cancelEditMode()">Fermer</button>
|
33
39
|
</div>
|
34
40
|
</div>
|
35
|
-
|
41
|
+
<div id="edit_overlays"></div>
|
42
|
+
<% end %>
|
36
43
|
</div>
|
37
44
|
<% end %>
|
38
45
|
<% end %>
|
@@ -45,48 +52,48 @@
|
|
45
52
|
initOverlays();
|
46
53
|
});
|
47
54
|
|
48
|
-
function setEditMode(
|
49
|
-
var offset = elt.offset();
|
50
|
-
var width = elt.width(), height = elt.height();
|
51
|
-
var
|
52
|
-
var yPosition = offset.top - $(".sibu_content_panel").offset().top;
|
53
|
-
var section = elt.parents("sb-edit").first();
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
55
|
+
function setEditMode(section, overlay, left, top, width, height) {
|
56
|
+
// var offset = elt.offset();
|
57
|
+
// var width = elt.width(), height = elt.height();
|
58
|
+
var editMode = $("#edit_mode_overlay");
|
59
|
+
// var yPosition = offset.top - $(".sibu_content_panel").offset().top;
|
60
|
+
// var section = elt.parents("sb-edit").first();
|
61
|
+
editMode.find(".overlay_top").css("height", top);
|
62
|
+
editMode.find(".overlay_bottom").css("top", top + height);
|
63
|
+
editMode.find(".overlay_left").css({"height": height, "width": left, "top": top});
|
64
|
+
editMode.find(".overlay_right").css({"height": height, "left": left + width, "top": top});
|
65
|
+
editMode.find(".edit_mode_actions").css({"top": (top <= 40 ? (top + height) : (top - 40)), left: left, width: width});
|
66
|
+
editMode.find("#edit_section_msg").text("Modifier la section");
|
67
|
+
editMode.show();
|
61
68
|
if(!section.data('duplicate')) {
|
62
|
-
|
63
|
-
|
69
|
+
editMode.find("#clone_section").hide();
|
70
|
+
editMode.find("#delete_section").hide();
|
64
71
|
} else {
|
65
|
-
|
66
|
-
|
72
|
+
editMode.find("#clone_section").show();
|
73
|
+
editMode.find("#delete_section").show();
|
67
74
|
}
|
68
|
-
window.scrollTo(0,
|
75
|
+
window.scrollTo(0, top);
|
69
76
|
section.addClass('sb-editing');
|
70
|
-
initInnerOverlays(
|
71
|
-
|
77
|
+
initInnerOverlays(section);
|
78
|
+
$("#edit_overlays").html("");
|
72
79
|
}
|
73
80
|
|
74
81
|
function cancelEditMode() {
|
75
82
|
$("#edit_mode_overlay").hide();
|
76
83
|
cancelEdit();
|
77
|
-
$("
|
84
|
+
$(".sb-editing").removeClass("sb-editing");
|
78
85
|
initOverlays();
|
79
86
|
}
|
80
87
|
|
81
88
|
function cloneSection() {
|
82
89
|
if (window.confirm("Dupliquer la section ?")) {
|
83
|
-
var section = $("
|
90
|
+
var section = $(".sb-editing").first();
|
84
91
|
$.ajax({
|
85
92
|
url: "<%= clone_section_site_page_path(@site.id, @page.id) %>",
|
86
93
|
method: "POST",
|
87
94
|
data: {
|
88
|
-
section_id: section.data("id"),
|
89
|
-
entity: section.data("entity")
|
95
|
+
section_id: section.data("sb-id"),
|
96
|
+
entity: section.data("sb-entity")
|
90
97
|
}
|
91
98
|
})
|
92
99
|
}
|
@@ -94,13 +101,13 @@
|
|
94
101
|
|
95
102
|
function deleteSection() {
|
96
103
|
if (window.confirm("Supprimer la section ?")) {
|
97
|
-
var section = $("
|
104
|
+
var section = $(".sb-editing").first();
|
98
105
|
$.ajax({
|
99
106
|
url: "<%= delete_section_site_page_path(@site.id, @page.id) %>",
|
100
107
|
method: "DELETE",
|
101
108
|
data: {
|
102
|
-
section_id: section.data("id"),
|
103
|
-
entity: section.data("entity")
|
109
|
+
section_id: section.data("sb-id"),
|
110
|
+
entity: section.data("sb-entity")
|
104
111
|
}
|
105
112
|
})
|
106
113
|
}
|
@@ -123,8 +130,8 @@
|
|
123
130
|
})
|
124
131
|
}
|
125
132
|
|
126
|
-
function initInnerOverlays(
|
127
|
-
var editables =
|
133
|
+
function initInnerOverlays(section) {
|
134
|
+
var editables = section.find("[class*='sb-']");
|
128
135
|
editables.off();
|
129
136
|
editables.hover(function() {
|
130
137
|
$(this).addClass("sb-editable");
|
@@ -134,8 +141,7 @@
|
|
134
141
|
editables.click(function(evt) {
|
135
142
|
evt.preventDefault();
|
136
143
|
var elt = $(this), tag = elt.prop("tagName").toLowerCase();
|
137
|
-
var
|
138
|
-
var eltId = elt.data("id"), sectionId = section.data("id"), entity = section.data("entity");
|
144
|
+
var eltId = elt.data("id"), sectionId = section.data("sb-id"), entity = section.data("sb-entity");
|
139
145
|
if (TEXT_TAGS.indexOf(tag) !== -1) {
|
140
146
|
editContent(eltId, sectionId, entity, 'text');
|
141
147
|
} else if (IMG_TAGS.indexOf(tag) !== -1 || elt.hasClass('sb-img')) {
|
@@ -149,25 +155,55 @@
|
|
149
155
|
}
|
150
156
|
|
151
157
|
function initOverlays() {
|
152
|
-
$("div.sb-overlay").remove();
|
153
|
-
$("sb-edit").each(function() {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
// $("div.sb-overlay").remove();
|
159
|
+
// $("sb-edit").each(function() {
|
160
|
+
// var elt = $(this);
|
161
|
+
// elt.prepend("<div class='sb-overlay'><a>Modifier</a></div>");
|
162
|
+
// var overlay = elt.find(".sb-overlay");
|
163
|
+
// var dimensions = overlayDimensions(overlay, elt);
|
164
|
+
// overlay.width(dimensions.width);
|
165
|
+
// overlay.height(dimensions.height);
|
166
|
+
//
|
167
|
+
// elt.hover(function() {
|
168
|
+
// overlay.css("opacity", 1);
|
169
|
+
// }, function() {
|
170
|
+
// overlay.css("opacity", 0);
|
171
|
+
// });
|
172
|
+
//
|
173
|
+
// overlay.click(function() {
|
174
|
+
// setEditMode($(this));
|
175
|
+
// })
|
176
|
+
// });
|
177
|
+
var container = $("#edit_overlays");
|
178
|
+
container.html("");
|
179
|
+
$("[data-sb-id]").each(function() {
|
180
|
+
var section = $(this);
|
181
|
+
var offset = section.offset();
|
182
|
+
var yOffset = offset.top - $(".sibu_content_panel").offset().top;
|
183
|
+
var width = section.outerWidth(), height = (section.outerHeight() === 0 ? childrenHeight(section) : section.outerHeight());
|
184
|
+
var overlay = $("<div>Modifier</div>");
|
185
|
+
container.append(overlay);
|
186
|
+
overlay.css({top: yOffset, left: offset.left, width: width, height: height});
|
187
|
+
overlay.hover(function() {
|
188
|
+
$(this).css("opacity", 1);
|
189
|
+
}, function() {
|
190
|
+
$(this).css("opacity", 0);
|
191
|
+
});
|
192
|
+
overlay.click(function() {
|
193
|
+
setEditMode(section, $(this), offset.left, yOffset, width, height);
|
194
|
+
})
|
195
|
+
});
|
196
|
+
}
|
166
197
|
|
167
|
-
|
168
|
-
|
169
|
-
|
198
|
+
function childrenHeight(parentElt) {
|
199
|
+
var height = 0;
|
200
|
+
parentElt.find("*").each(function() {
|
201
|
+
var childHeight = $(this).height();
|
202
|
+
if(childHeight > height) {
|
203
|
+
height = childHeight;
|
204
|
+
}
|
170
205
|
});
|
206
|
+
return height;
|
171
207
|
}
|
172
208
|
|
173
209
|
function overlayDimensions(overlay, element) {
|
@@ -10,6 +10,12 @@
|
|
10
10
|
<%= stylesheet_link_tag @site.site_template.path, media: "all" %>
|
11
11
|
<%= javascript_include_tag @site.site_template.path %>
|
12
12
|
<% end %>
|
13
|
+
<% unless @site.primary_font.blank? %>
|
14
|
+
<%= stylesheet_link_tag "fonts/#{@site.primary_font.downcase}", media: "all" %>
|
15
|
+
<% end %>
|
16
|
+
<% unless @site.secondary_font.blank? %>
|
17
|
+
<%= stylesheet_link_tag "fonts/#{@site.secondary_font.downcase}", media: "all" %>
|
18
|
+
<% end %>
|
13
19
|
<%= csrf_meta_tags %>
|
14
20
|
<%= yield :styles %>
|
15
21
|
</head>
|
@@ -12,6 +12,7 @@
|
|
12
12
|
{prompt: 'Sélectionnez une page'} %>
|
13
13
|
</div>
|
14
14
|
<%= hidden_field_tag 'element[id]', @element["id"] %>
|
15
|
+
<%= hidden_field_tag :element_id, @element_id %>
|
15
16
|
<%= hidden_field_tag :section_id, @section_id %>
|
16
17
|
<%= hidden_field_tag :entity, @entity_type %>
|
17
18
|
<div class="sibu_actions">
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<p>Sélectionnez ou <%= link_to 'téléchargez', new_site_image_path(@site.id, page_id: @page.id) %> une image</p>
|
8
8
|
<% @site.images.each do |image| %>
|
9
9
|
<div class="sibu_image">
|
10
|
-
<%= image_tag image.file_url(:
|
10
|
+
<%= image_tag image.file_url(:medium), class: (@element["src"] == image.file_url(:medium) ? 'selected' : '') %>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
13
|
</div>
|
@@ -17,6 +17,7 @@
|
|
17
17
|
</div>
|
18
18
|
<%= hidden_field_tag 'element[id]', @element["id"] %>
|
19
19
|
<%= hidden_field_tag 'element[src]', @element["src"] %>
|
20
|
+
<%= hidden_field_tag :element_id, @element_id %>
|
20
21
|
<%= hidden_field_tag :section_id, @section_id %>
|
21
22
|
<%= hidden_field_tag :entity, @entity_type %>
|
22
23
|
<div class="sibu_actions">
|
@@ -4,6 +4,7 @@
|
|
4
4
|
<%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
|
5
5
|
<%= trix_editor_tag 'element[text]', '', input: 'element_text' %>
|
6
6
|
<%= hidden_field_tag 'element[id]', @element["id"] %>
|
7
|
+
<%= hidden_field_tag :element_id, @element_id %>
|
7
8
|
<%= hidden_field_tag :section_id, @section_id %>
|
8
9
|
<%= hidden_field_tag :entity, @entity_type %>
|
9
10
|
<div class="sibu_actions">
|
@@ -2,7 +2,7 @@
|
|
2
2
|
$("#edit_panel #edit_msg").html("<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>");
|
3
3
|
<% else %>
|
4
4
|
$("#edit_panel").slideUp();
|
5
|
-
var clonedElt = $("
|
5
|
+
var clonedElt = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']").first();
|
6
6
|
var newElt = clonedElt.clone();
|
7
7
|
newElt.data("id", "<%= @cloned["id"] %>");
|
8
8
|
clonedElt.after(newElt);
|
@@ -7,9 +7,13 @@ editPanel.html("");
|
|
7
7
|
editorElt.editor.loadHTML("<%= j(raw(text_value.gsub("\n", "<br/>"))) %>");
|
8
8
|
<% elsif @content_type == 'media' %>
|
9
9
|
editPanel.html("<%= j(render 'media_edit_panel') %>");
|
10
|
-
editPanel.find(".sibu_image img")
|
11
|
-
|
12
|
-
|
10
|
+
var images = editPanel.find(".sibu_image img");
|
11
|
+
images.click(function() {
|
12
|
+
if(!$(this).hasClass('selected')) {
|
13
|
+
images.removeClass('selected');
|
14
|
+
$(this).addClass('selected');
|
15
|
+
$("#element_src").val($(this).attr("src"));
|
16
|
+
}
|
13
17
|
});
|
14
18
|
<% elsif @content_type == 'link' %>
|
15
19
|
editPanel.html("<%= j(render 'link_edit_panel') %>");
|
@@ -2,13 +2,18 @@
|
|
2
2
|
$("#edit_panel #edit_msg").html("<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>");
|
3
3
|
<% else %>
|
4
4
|
$("#edit_panel").slideUp();
|
5
|
-
var updatedElt = $("
|
5
|
+
var updatedElt = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']");
|
6
6
|
<% if @updated["text"] %>
|
7
7
|
updatedElt.html("<%= j(raw @updated["text"]) %>");
|
8
8
|
<% end %>
|
9
9
|
<% unless @updated.except("id", "text").blank? %>
|
10
|
+
var tag = updatedElt.prop("tagName").toLowerCase();
|
10
11
|
<% @updated.except("id", "text").each_pair do |attr, val| %>
|
11
|
-
|
12
|
+
if(("<%= attr %>" === 'src' || "<%= attr %>" === 'alt') && tag !== 'img') {
|
13
|
+
updatedElt.find("img").attr("<%= attr %>", "<%= val %>");
|
14
|
+
} else {
|
15
|
+
updatedElt.attr("<%= attr %>", "<%= val %>");
|
16
|
+
}
|
12
17
|
<% end %>
|
13
18
|
<% end %>
|
14
19
|
<% end %>
|
@@ -31,11 +31,11 @@
|
|
31
31
|
</div>
|
32
32
|
<div class="sibu_field">
|
33
33
|
<%= f.label :name, 'Police de caractères (titres)' %>
|
34
|
-
|
34
|
+
<%= f.select :primary_font, primary_fonts, {prompt: 'Police par défaut'} %>
|
35
35
|
</div>
|
36
36
|
<div class="sibu_field">
|
37
37
|
<%= f.label :name, 'Police de caractères (corps)' %>
|
38
|
-
|
38
|
+
<%= f.select :secondary_font, secondary_fonts, {prompt: 'Police par défaut'} %>
|
39
39
|
</div>
|
40
40
|
<%= f.hidden_field :user_id %>
|
41
41
|
<div class="sibu_actions">
|
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.1.
|
4
|
+
version: 0.1.14
|
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-02-
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|