sibu 0.6.7 → 0.6.8
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f71d0ed5ea931e10b3ac298b61719f4e90781c84
|
4
|
+
data.tar.gz: 86c5c7c355cb751903633f5f8548bef66a6877d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 103b62d79ad05287ce1b1d7096cffdc394fb65368209f4b8eb9cb785bc8f86cda3be9b642fa80695c83791b97a1963a1eae9ffb1005bd006362449a849c79275
|
7
|
+
data.tar.gz: 373113cd05d72a79f389273730eb8f3697898ed8417242c8858ac83803ea91aa4ff591bd9b6a38a0360b8a9998f66e0fb76f10b6111895e68219fe90939c7b88
|
@@ -24,11 +24,11 @@ module Sibu
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def link_type(val)
|
27
|
-
if val.blank? ||
|
27
|
+
if val.blank? || /^\d+$/.match(val.to_s)
|
28
28
|
'internal'
|
29
29
|
elsif Sibu::Document.for_user(sibu_user).map {|d| d.file_url}.include?(val)
|
30
30
|
'document'
|
31
|
-
elsif val.to_s.
|
31
|
+
elsif val.to_s.start_with?('http', '#', '/')
|
32
32
|
'external'
|
33
33
|
else
|
34
34
|
'email'
|
@@ -114,12 +114,14 @@ module Sibu
|
|
114
114
|
@sb_entity = @page
|
115
115
|
self
|
116
116
|
end
|
117
|
+
|
117
118
|
alias page sb_page
|
118
119
|
|
119
120
|
def sb_site
|
120
121
|
@sb_entity = @site
|
121
122
|
self
|
122
123
|
end
|
124
|
+
|
123
125
|
alias site sb_site
|
124
126
|
|
125
127
|
def section(id, tag, html_opts = {}, &block)
|
@@ -157,10 +159,15 @@ module Sibu
|
|
157
159
|
val = content.delete("value") || ""
|
158
160
|
text = content.delete("text")
|
159
161
|
html_opts.merge!({data: {id: elt_id(elt), type: "link", repeat: repeat, children: children}}) if action_name != 'show'
|
160
|
-
if val.to_s.
|
162
|
+
if val.to_s.start_with?('http')
|
163
|
+
content["href"] = val
|
164
|
+
elsif val.to_s.start_with?('#')
|
165
|
+
content["href"] = val
|
166
|
+
content.delete("target")
|
167
|
+
elsif val.to_s.start_with?('/')
|
161
168
|
content["href"] = val
|
162
169
|
elsif val.to_s.include?('@')
|
163
|
-
content["href"] = 'mailto:'+val
|
170
|
+
content["href"] = 'mailto:' + val
|
164
171
|
else
|
165
172
|
content["href"] = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
|
166
173
|
end
|
@@ -9,18 +9,25 @@ class Sibu::ImageUploader < Shrine
|
|
9
9
|
process(:store) do |io, context|
|
10
10
|
original = io.download
|
11
11
|
images_config = Rails.application.config.sibu[:images]
|
12
|
+
image_type = io.mime_type
|
12
13
|
|
13
|
-
|
14
|
-
medium = resize_to_limit(large, images_config[:medium], images_config[:medium])
|
15
|
-
small = resize_to_limit(medium, images_config[:small], images_config[:small])
|
14
|
+
if image_type == "image/svg+xml"
|
16
15
|
|
17
|
-
|
16
|
+
{original: io, large: io.download, medium: io.download, small: io.download}
|
17
|
+
|
18
|
+
else
|
19
|
+
large = resize_to_limit!(original, images_config[:large], images_config[:large]) {|cmd| cmd.auto_orient}
|
20
|
+
medium = resize_to_limit(large, images_config[:medium], images_config[:medium])
|
21
|
+
small = resize_to_limit(medium, images_config[:small], images_config[:small])
|
22
|
+
|
23
|
+
{original: io, large: large, medium: medium, small: small}
|
24
|
+
end
|
18
25
|
end
|
19
26
|
|
20
27
|
def generate_location(io, context)
|
21
|
-
user_id
|
28
|
+
user_id = context[:record].user_id
|
22
29
|
style = context[:version] != :original ? "resized" : "originals"
|
23
|
-
name
|
30
|
+
name = super
|
24
31
|
|
25
32
|
[user_id, style, name].compact.join("/")
|
26
33
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
</div>
|
17
17
|
<div id="link_external" class="sibu_field link_mode">
|
18
18
|
<%= radio_button_tag :mode, 'external', current_type == 'external', class: 'radio' %>
|
19
|
-
<%= label_tag 'mode_external', 'Lien
|
19
|
+
<%= label_tag 'mode_external', 'Lien personnalisé' %>
|
20
20
|
<%= text_field_tag 'element[value]', (@element["value"] if current_type == 'external'), placeholder: 'Ex : http://www.un-site.com', disabled: current_type != 'external' %>
|
21
21
|
<%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'external' %>
|
22
22
|
</div>
|
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.6.
|
4
|
+
version: 0.6.8
|
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-
|
11
|
+
date: 2018-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|