sibu 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de8d62d4237579055ee7beb1d2444f26a3ef5029
4
- data.tar.gz: 738a04d070723936adb20d39df2c10cd3fbc0f75
3
+ metadata.gz: db5c9e53e7af3a3a4a93b78aedd5fba7a6a88a1c
4
+ data.tar.gz: cb0cfcbd86d03a876ea3ff875a530a19ea49dac1
5
5
  SHA512:
6
- metadata.gz: 8cabf4bcc31acdf588aabea0ce004a82343abeecd1c1741f0c6cc6ba0bd881087774a252834977f8d6819b8ec5704d566e5335b4b408474b5180a0ab6d7b7190
7
- data.tar.gz: bba89e84090cd9505ff62e2cec96061bf68c8c6fd128b2eed06c999eaaa0997a5b05e7093b099e77135a565aea37de21a596985a220275ba69f5c4db17f3e3f1
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";
@@ -21,7 +21,7 @@ module Sibu
21
21
  end
22
22
 
23
23
  def destroy
24
- @document = @document.find(params[:id])
24
+ @document = Sibu::Document.find(params[:id])
25
25
  @document.destroy
26
26
  redirect_to documents_url, notice: "Le document a bien été supprimé."
27
27
  end
@@ -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
- else
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="link_document" class="sibu_field">
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
- $("#link_" + other).find("#element_value, #element_target").attr("disabled", "disabled");
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
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.6.5'
2
+ VERSION = '0.6.6'
3
3
  end
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.5
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-20 00:00:00.000000000 Z
11
+ date: 2018-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails