sibu 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/sibu/pages_controller.rb +1 -0
- data/app/helpers/sibu/pages_helper.rb +2 -1
- data/app/views/layouts/sibu/edit_content.html.erb +5 -38
- data/app/views/sibu/pages/_media_edit_panel.html.erb +1 -1
- data/app/views/sibu/pages/edit_element.js.erb +1 -1
- data/lib/sibu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4506dd1c2b0f1f720045ba1bddd840a03ec19945
|
4
|
+
data.tar.gz: 2e028cfdf5c22480d37186397402d1dc7b3551b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b38dbbe585fd82607bcb2d459b7262fb6b1302a104f06101d547038af567dda790dbeab16d2fc1fc8546653ebc4607c6c5d353a50d02dd3ed3d64b5d0772f53a
|
7
|
+
data.tar.gz: a03b06e0164de60a92a0e3c24071c1a4bb126260ab25fbb288951372884354e539108d666bb9110592707d5bc289e0ef25b5317f47669a027cc3538f7496a8ae
|
@@ -58,9 +58,10 @@ module Sibu
|
|
58
58
|
def img(elt, opts = {})
|
59
59
|
wrapper = opts.delete(:wrapper)
|
60
60
|
repeat = opts.delete(:repeat)
|
61
|
+
size = opts.delete(:size)
|
61
62
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => "/default.jpg"}
|
62
63
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
63
|
-
opts.merge!({data: {id: elt_id(elt), type: "media", repeat: repeat}}) if action_name != 'show'
|
64
|
+
opts.merge!({data: {id: elt_id(elt), type: "media", repeat: repeat, size: size}}) if action_name != 'show'
|
64
65
|
wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts) : content_tag(:img, nil, content.except("id").merge(opts))
|
65
66
|
end
|
66
67
|
|
@@ -51,11 +51,7 @@
|
|
51
51
|
});
|
52
52
|
|
53
53
|
function setEditMode(section, overlay, left, top, width, height) {
|
54
|
-
// var offset = elt.offset();
|
55
|
-
// var width = elt.width(), height = elt.height();
|
56
54
|
var editMode = $("#edit_mode_overlay");
|
57
|
-
// var yPosition = offset.top - $(".sibu_content_panel").offset().top;
|
58
|
-
// var section = elt.parents("sb-edit").first();
|
59
55
|
editMode.find(".overlay_top").css("height", top);
|
60
56
|
editMode.find(".overlay_bottom").css("top", top + height);
|
61
57
|
editMode.find(".overlay_left").css({"height": height, "width": left, "top": top});
|
@@ -146,7 +142,7 @@
|
|
146
142
|
$("#edit_panel").slideUp("fast");
|
147
143
|
}
|
148
144
|
|
149
|
-
function editContent(eltId, sectionId, entity, repeat, contentType) {
|
145
|
+
function editContent(eltId, sectionId, entity, repeat, contentType, size) {
|
150
146
|
$.ajax({
|
151
147
|
url: "<%= edit_element_site_page_path(@site.id, @page.id) %>",
|
152
148
|
method: "GET",
|
@@ -155,7 +151,8 @@
|
|
155
151
|
section_id: sectionId,
|
156
152
|
entity: entity,
|
157
153
|
repeat: repeat,
|
158
|
-
content_type: contentType
|
154
|
+
content_type: contentType,
|
155
|
+
size: size
|
159
156
|
}
|
160
157
|
})
|
161
158
|
}
|
@@ -170,32 +167,13 @@
|
|
170
167
|
});
|
171
168
|
editables.click(function(evt) {
|
172
169
|
evt.preventDefault();
|
173
|
-
var elt = $(this), eltId = elt.data("id"), repeat = elt.data("repeat"), type = elt.data("type");
|
170
|
+
var elt = $(this), eltId = elt.data("id"), repeat = elt.data("repeat"), type = elt.data("type"), size = elt.data("size");
|
174
171
|
var sectionId = section.data("sb-id"), entity = section.data("sb-entity");
|
175
|
-
editContent(eltId, sectionId, entity, repeat, type);
|
172
|
+
editContent(eltId, sectionId, entity, repeat, type, size);
|
176
173
|
})
|
177
174
|
}
|
178
175
|
|
179
176
|
function initOverlays() {
|
180
|
-
// $("div.sb-overlay").remove();
|
181
|
-
// $("sb-edit").each(function() {
|
182
|
-
// var elt = $(this);
|
183
|
-
// elt.prepend("<div class='sb-overlay'><a>Modifier</a></div>");
|
184
|
-
// var overlay = elt.find(".sb-overlay");
|
185
|
-
// var dimensions = overlayDimensions(overlay, elt);
|
186
|
-
// overlay.width(dimensions.width);
|
187
|
-
// overlay.height(dimensions.height);
|
188
|
-
//
|
189
|
-
// elt.hover(function() {
|
190
|
-
// overlay.css("opacity", 1);
|
191
|
-
// }, function() {
|
192
|
-
// overlay.css("opacity", 0);
|
193
|
-
// });
|
194
|
-
//
|
195
|
-
// overlay.click(function() {
|
196
|
-
// setEditMode($(this));
|
197
|
-
// })
|
198
|
-
// });
|
199
177
|
var container = $("#edit_overlays");
|
200
178
|
container.html("");
|
201
179
|
$("[data-sb-id]").each(function() {
|
@@ -227,17 +205,6 @@
|
|
227
205
|
});
|
228
206
|
return height;
|
229
207
|
}
|
230
|
-
|
231
|
-
function overlayDimensions(overlay, element) {
|
232
|
-
var children = element.find("> *:not(.sb-overlay)");
|
233
|
-
var width = - +children.first().css("margin-left").replace("px", ""), height = - +children.first().css("margin-top").replace("px", "");
|
234
|
-
var maxWidth = element.parent().outerWidth(true), maxHeight = element.parent().outerHeight(true);
|
235
|
-
element.find("> *:not(.sb-overlay)").each(function() {
|
236
|
-
width = width + $(this).outerWidth(true);
|
237
|
-
height = height + $(this).outerHeight(true);
|
238
|
-
});
|
239
|
-
return {width: Math.min(width, maxWidth), height: Math.min(height, maxHeight)};
|
240
|
-
}
|
241
208
|
</script>
|
242
209
|
<%= yield :scripts %>
|
243
210
|
</body>
|
@@ -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" data-img-id="<%= image.id %>">
|
10
|
-
<%= image_tag image.file_url(:
|
10
|
+
<%= image_tag image.file_url(:small), class: (@element["src"] == image.file_url(@size) ? 'selected' : ''), data: {src: image.file_url(@size)} %>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
13
|
</div>
|
data/lib/sibu/version.rb
CHANGED