sibu 0.6.5 → 0.6.6
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/javascripts/sibu/sibu.js.erb +16 -0
- data/app/controllers/sibu/documents_controller.rb +1 -1
- data/app/helpers/sibu/pages_helper.rb +6 -2
- data/app/views/sibu/pages/_link_edit_panel.html.erb +9 -3
- data/app/views/sibu/pages/edit_element.js.erb +5 -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: db5c9e53e7af3a3a4a93b78aedd5fba7a6a88a1c
|
4
|
+
data.tar.gz: cb0cfcbd86d03a876ea3ff875a530a19ea49dac1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4b53790db656a48e262d9371428618488c0687426ee3e520b6eebe613c0056be8585e9772ab6c57696b6dc5c91af613c7fb036183c222e041e22eeae399a220
|
7
|
+
data.tar.gz: 342daebed0d022723f72679935da515e87dd2d83442a2e4014b295ab3fbf0f2f576ab1251044cb1e1f4bafad13246148940ba35fdf20fa4ab4aefbeeb1ede912
|
@@ -31,6 +31,22 @@ IconBlot.tagName = 'a';
|
|
31
31
|
Quill.register(IconBlot);
|
32
32
|
Quill.register(Quill.import('attributors/style/align'), true);
|
33
33
|
|
34
|
+
var Link = Quill.import('formats/link');
|
35
|
+
|
36
|
+
class CustomLink extends Link {
|
37
|
+
static create(value) {
|
38
|
+
let node = super.create(value);
|
39
|
+
value = this.sanitize(value);
|
40
|
+
node.setAttribute('href', value);
|
41
|
+
if(value.startsWith("/")) {
|
42
|
+
node.removeAttribute('target');
|
43
|
+
}
|
44
|
+
return node;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
Quill.register(CustomLink);
|
49
|
+
|
34
50
|
function initQuillEditor(container) {
|
35
51
|
var quillModules;
|
36
52
|
var modulesCallback = "sibuEditorModules";
|
@@ -28,8 +28,10 @@ module Sibu
|
|
28
28
|
'internal'
|
29
29
|
elsif Sibu::Document.for_user(sibu_user).map {|d| d.file_url}.include?(val)
|
30
30
|
'document'
|
31
|
-
|
31
|
+
elsif val.to_s.include?('/')
|
32
32
|
'external'
|
33
|
+
else
|
34
|
+
'email'
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
@@ -155,8 +157,10 @@ module Sibu
|
|
155
157
|
val = content.delete("value") || ""
|
156
158
|
text = content.delete("text")
|
157
159
|
html_opts.merge!({data: {id: elt_id(elt), type: "link", repeat: repeat, children: children}}) if action_name != 'show'
|
158
|
-
if val.to_s.include?('/')
|
160
|
+
if val.to_s.include?('/') || val.to_s.include?('#')
|
159
161
|
content["href"] = val
|
162
|
+
elsif val.to_s.include?('@')
|
163
|
+
content["href"] = 'mailto:'+val
|
160
164
|
else
|
161
165
|
content["href"] = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
|
162
166
|
end
|
@@ -8,19 +8,25 @@
|
|
8
8
|
<%= label_tag 'element[text]', 'Libellé' %>
|
9
9
|
<%= text_field_tag 'element[text]', @element["text"] %>
|
10
10
|
</div>
|
11
|
-
<div id="link_internal" class="sibu_field">
|
11
|
+
<div id="link_internal" class="sibu_field link_mode">
|
12
12
|
<%= radio_button_tag :mode, 'internal', current_type == 'internal', class: 'radio' %>
|
13
13
|
<%= label_tag 'mode_internal', 'Lien vers une page du site' %>
|
14
14
|
<%= select_tag 'element[value]', available_links, prompt: 'Sélectionnez une page', disabled: current_type != 'internal' %>
|
15
15
|
<%= hidden_field_tag 'element[target]', '_self', disabled: current_type != 'internal' %>
|
16
16
|
</div>
|
17
|
-
<div id="link_external" class="sibu_field">
|
17
|
+
<div id="link_external" class="sibu_field link_mode">
|
18
18
|
<%= radio_button_tag :mode, 'external', current_type == 'external', class: 'radio' %>
|
19
19
|
<%= label_tag 'mode_external', 'Lien vers un autre site' %>
|
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>
|
23
|
-
<div id="
|
23
|
+
<div id="link_email" class="sibu_field link_mode">
|
24
|
+
<%= radio_button_tag :mode, 'email', current_type == 'email', class: 'radio' %>
|
25
|
+
<%= label_tag 'mode_external', 'Lien vers un Email' %>
|
26
|
+
<%= text_field_tag 'element[value]', (@element["value"] if current_type == 'email'), placeholder: 'Ex : email@exemple.fr', disabled: current_type != 'email' %>
|
27
|
+
<%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'email' %>
|
28
|
+
</div>
|
29
|
+
<div id="link_document" class="sibu_field link_mode">
|
24
30
|
<%= radio_button_tag :mode, 'document', current_type == 'document', class: 'radio' %>
|
25
31
|
<%= label_tag 'mode_document', 'Lien vers un document' %>
|
26
32
|
<%= select_tag 'element[value]', available_docs, prompt: 'Sélectionnez un document', disabled: current_type != 'document' %>
|
@@ -74,9 +74,12 @@ editPanel.slideDown("fast", function() {
|
|
74
74
|
<% when 'link' %>
|
75
75
|
$("input[name='mode']").change(function() {
|
76
76
|
var selected = $(this).val();
|
77
|
-
var other = selected === 'internal' ? 'external' : 'internal';
|
78
77
|
$("#link_" + selected).find("#element_value, #element_target").removeAttr("disabled");
|
79
|
-
$("
|
78
|
+
$(".sibu_edit_form").find(".link_mode").each(function() {
|
79
|
+
if($(this).attr("id") !== ("link_" + selected)) {
|
80
|
+
$(this).find("#element_value, #element_target").attr("disabled", "disabled");
|
81
|
+
}
|
82
|
+
});
|
80
83
|
});
|
81
84
|
<% else %>
|
82
85
|
<% end %>
|
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.6
|
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-09
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|