sibu 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*
2
- *= require trix
2
+ *= require ../quill/quill.snow
3
3
  *= require_self
4
4
  */
5
5
 
@@ -7,28 +7,6 @@
7
7
  position: relative
8
8
  }
9
9
 
10
- /*sb-edit {*/
11
- /*position: relative;*/
12
- /*display: inherit;*/
13
- /*width: 100%;*/
14
- /*}*/
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
- /*}*/
25
-
26
- /*sb-edit div.sb-overlay a {*/
27
- /*display: inline-block;*/
28
- /*width: 100%;*/
29
- /*height: 100%;*/
30
- /*}*/
31
-
32
10
  .sb-editable {
33
11
  cursor: pointer;
34
12
  outline: dashed rgba(94, 219, 255, 0.8) 2px;
@@ -95,7 +73,3 @@
95
73
  align-items: center;
96
74
  cursor: pointer;
97
75
  }
98
-
99
- .trix-button-group--block-tools {
100
- display: none !important;
101
- }
@@ -1,8 +1,6 @@
1
1
  module Sibu
2
2
  module PagesHelper
3
3
  include Sibu::Engine.routes.url_helpers
4
- include TrixEditorHelper
5
-
6
4
 
7
5
  def link_path(page_id)
8
6
  p = @site.page_by_id(page_id)
@@ -10,22 +8,41 @@ module Sibu
10
8
  end
11
9
 
12
10
  def page_templates
13
- [['Accueil', 'home'], ['Offre', 'offer'], ['Galerie', 'gallery'], ['Destination', 'destination']]
11
+ [['Accueil', 'home'], ['Offre', 'offer'], ['Galerie', 'gallery'], ['Destination', 'destination'], ['Mentions légales', 'text']]
14
12
  end
15
13
 
16
14
  def page_languages
17
15
  [['Français', 'fr'], ['Anglais', 'en']]
18
16
  end
19
17
 
20
- [:h1, :h2, :h3, :h4, :h5, :h6, :p, :span, :div].each do |t|
18
+ def site_images
19
+ @site.images + Sibu::Image.shared
20
+ end
21
+
22
+ def available_links
23
+ options_from_collection_for_select(@site.pages, :id, :name, @element["value"])
24
+ end
25
+
26
+ def is_internal(val)
27
+ val.blank? || val == '#' || /^\d{1,3}$/.match(val.to_s)
28
+ end
29
+
30
+ [:h1, :h2, :h3, :h4, :h5, :h6, :span].each do |t|
21
31
  define_method(t) do |elt, html_opts = {}|
22
32
  defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => "Texte à modifier"}
23
33
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
24
- html_opts.merge!({class: "sb-#{t} #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
34
+ html_opts.merge!({data: {id: elt_id(elt), type: "text"}}) if action_name != 'show'
25
35
  content_tag(t, raw(content["text"]).html_safe, html_opts)
26
36
  end
27
37
  end
28
38
 
39
+ def p(elt, html_opts = {})
40
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => "Texte à modifier"}
41
+ content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
42
+ html_opts.merge!({data: {id: elt_id(elt), type: "paragraph"}}) if action_name != 'show'
43
+ content_tag(:div, content_tag(:p, raw(content["text"]).html_safe), html_opts)
44
+ end
45
+
29
46
  def sb
30
47
  self
31
48
  end
@@ -43,7 +60,7 @@ module Sibu
43
60
  repeat = opts.delete(:repeat)
44
61
  defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => "/default.jpg"}
45
62
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
46
- opts.merge!({class: "sb-img #{opts[:class]}", data: {id: elt_id(elt), repeat: repeat}}) if action_name != 'show'
63
+ opts.merge!({data: {id: elt_id(elt), type: "media", repeat: repeat}}) if action_name != 'show'
47
64
  wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts) : content_tag(:img, nil, content.except("id").merge(opts))
48
65
  end
49
66
 
@@ -93,31 +110,25 @@ module Sibu
93
110
  repeat = html_opts.delete(:repeat)
94
111
  defaults = {"id" => elt_id(elt), "value" => "", "text" => "Nouveau lien"}
95
112
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
96
- html_opts.merge!({class: "sb-link #{html_opts[:class]}", data: {id: elt_id(elt), repeat: repeat}}) if action_name != 'show'
97
- val = content["value"] || ""
113
+ val = content.delete("value") || ""
114
+ text = content.delete("text");
115
+ html_opts.merge!({data: {id: elt_id(elt), type: "link", repeat: repeat}}) if action_name != 'show'
98
116
  if val.to_s.include?('http')
99
- href = val
117
+ content["href"] = val
100
118
  else
101
- href = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
119
+ content["href"] = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
102
120
  end
103
121
  if block_given?
104
- content_tag(:a, {href: href}.merge(html_opts), &block)
122
+ content_tag(:a, content.merge(html_opts), &block)
105
123
  else
106
- content_tag(:a, content["text"], {href: href}.merge(html_opts))
124
+ content_tag(:a, text, content.merge(html_opts))
107
125
  end
108
126
  end
109
127
 
110
- def form_label(elt, html_opts = {}, &block)
111
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => "Texte à modifier"}
112
- content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
113
- html_opts.merge!({class: "sb-label #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
114
- content_tag(:label, raw(content["text"]).html_safe, html_opts)
115
- end
116
-
117
128
  def interactive_map(elt, html_opts = {}, &block)
118
129
  defaults = {"data-lat" => "45.68854", "data-lng" => "5.91587", "data-title" => "Titre marqueur"}
119
130
  content = elt.is_a?(Hash) ? defaults.merge(elt) : (select_element(elt) || {"id" => elt}).merge(defaults)
120
- html_opts.merge!({class: "sb-map #{html_opts[:class]}", data: {id: elt_id(elt)}}) if action_name != 'show'
131
+ html_opts.merge!({data: {id: elt_id(elt), type: "map"}}) if action_name != 'show'
121
132
  content_tag(:div, nil, content.merge(html_opts))
122
133
  end
123
134
 
@@ -3,7 +3,6 @@ module Sibu
3
3
  include ActiveSupport::Concern
4
4
 
5
5
  def section(*ids)
6
- # elts = nil
7
6
  if ids.length == 1
8
7
  s = nil
9
8
  if sections.blank?
@@ -33,7 +32,6 @@ module Sibu
33
32
  if sub_idx
34
33
  sub = s[sub_idx]
35
34
  else
36
- logger.debug("init section #{subid}")
37
35
  sub = {"id" => subid, "elements" => []}
38
36
  self.sections[id] << sub
39
37
  save
@@ -75,9 +73,13 @@ module Sibu
75
73
 
76
74
  def delete_element(*ids, element_id)
77
75
  siblings = section(*ids)
78
- ref_index = siblings.index {|s| s["id"] == element_id}
79
- siblings.delete_at(ref_index)
80
- save
76
+ if siblings.length > 1
77
+ ref_index = siblings.index {|s| s["id"] == element_id}
78
+ siblings.delete_at(ref_index)
79
+ save
80
+ else
81
+ nil
82
+ end
81
83
  end
82
84
 
83
85
  def clone_section(*ids)
@@ -101,9 +103,9 @@ module Sibu
101
103
  end
102
104
 
103
105
  def sanitize_value(value)
104
- unless value["text"].blank?
105
- value["text"].gsub!(/<\/?(div|p|ul|li)>/, '')
106
- end
106
+ # unless value["text"].blank?
107
+ # value["text"].gsub!(/<\/?(div|p|ul|li)>/, '')
108
+ # end
107
109
  end
108
110
  end
109
111
  end
@@ -2,6 +2,10 @@ module Sibu
2
2
  class Image < ApplicationRecord
3
3
  include ImageUploader::Attachment.new(:file)
4
4
 
5
- belongs_to :site, :class_name => 'Sibu::Site'
5
+ belongs_to :site, :class_name => 'Sibu::Site', optional: true
6
+
7
+ def self.shared
8
+ where(site_id: nil)
9
+ end
6
10
  end
7
11
  end
@@ -4,8 +4,9 @@ module Sibu
4
4
 
5
5
  belongs_to :site, :class_name => 'Sibu::Site'
6
6
 
7
- store :metadata, accessors: [:title, :description], coder: JSON
7
+ store :metadata, accessors: [:title, :description, :keywords], coder: JSON
8
8
 
9
+ before_save :init_path
9
10
  validates_presence_of :name, :site, :language, :template
10
11
 
11
12
  def save_and_init
@@ -15,5 +16,9 @@ module Sibu
15
16
  end
16
17
  save
17
18
  end
19
+
20
+ def init_path
21
+ self.path = template if self.path.blank? && template != 'home'
22
+ end
18
23
  end
19
24
  end
@@ -44,10 +44,6 @@
44
44
  <% end %>
45
45
  <% end %>
46
46
  <script>
47
- const TEXT_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span'];
48
- const IMG_TAGS = ['img'];
49
- const LINK_TAGS = ['a'];
50
-
51
47
  var rootElt = $('html, body');
52
48
 
53
49
  $(function () {
@@ -165,7 +161,7 @@
165
161
  }
166
162
 
167
163
  function initInnerOverlays(section) {
168
- var editables = section.find("[class*='sb-']");
164
+ var editables = section.find("[data-type]");
169
165
  editables.off();
170
166
  editables.hover(function() {
171
167
  $(this).addClass("sb-editable");
@@ -174,17 +170,9 @@
174
170
  });
175
171
  editables.click(function(evt) {
176
172
  evt.preventDefault();
177
- var elt = $(this), tag = elt.prop("tagName").toLowerCase(), eltId = elt.data("id"), repeat = elt.data("repeat");
173
+ var elt = $(this), eltId = elt.data("id"), repeat = elt.data("repeat"), type = elt.data("type");
178
174
  var sectionId = section.data("sb-id"), entity = section.data("sb-entity");
179
- if (TEXT_TAGS.indexOf(tag) !== -1) {
180
- editContent(eltId, sectionId, entity, repeat, 'text');
181
- } else if (IMG_TAGS.indexOf(tag) !== -1 || elt.hasClass('sb-img')) {
182
- editContent(eltId, sectionId, entity, repeat, 'media');
183
- } else if (LINK_TAGS.indexOf(tag) !== -1) {
184
- editContent(eltId, sectionId, entity, repeat, 'link');
185
- } else {
186
- console.log('Sibu - Unsupported tag type : ' + tag);
187
- }
175
+ editContent(eltId, sectionId, entity, repeat, type);
188
176
  })
189
177
  }
190
178
 
@@ -0,0 +1,4 @@
1
+ <div class="sibu_edit_form">
2
+ <p>Une erreur s'est produite lors de l'édition de cet élément.</p>
3
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
4
+ </div>
@@ -1,27 +1,52 @@
1
1
  <%= form_for([@site, @page]) do |f| %>
2
2
  <div class="sibu_field">
3
3
  <%= f.label :name, 'Nom de la page' %>
4
- <%= f.text_field :name, placeholder: "Ex : Accueil, contact..." %>
4
+ <div>
5
+ <%= f.text_field :name, placeholder: "Ex: Accueil, contact..." %>
6
+ <small>Libellé utilisé dans l'outil d'administration (non utilisé dans le site)</small>
7
+ </div>
5
8
  </div>
6
9
  <div class="sibu_field">
7
10
  <%= f.label :template, 'Modèle' %>
8
- <%= f.select(:template, page_templates, {prompt: 'Sélectionnez un modèle de page'}) %>
11
+ <div>
12
+ <%= f.select(:template, page_templates, {prompt: 'Sélectionnez un modèle de page'}) %>
13
+ <small>Le gabarit utilisé pour créer la page</small>
14
+ </div>
9
15
  </div>
10
16
  <div class="sibu_field">
11
17
  <%= f.label :path, "Chemin d'accès" %>
12
- <%= f.text_field :path, placeholder: "Adresse de la page" %>
18
+ <div>
19
+ <%= f.text_field :path, placeholder: "Laisser vide pour le générer automatiquement" %>
20
+ <small>L'adresse (ou URL) de la page, utilisée par les navigateurs web pour y accéder</small>
21
+ </div>
13
22
  </div>
14
23
  <div class="sibu_field">
15
24
  <%= f.label :language, "Langue" %>
16
- <%= f.select(:language, page_languages, {prompt: 'Sélectionnez une langue'}) %>
25
+ <div>
26
+ <%= f.select(:language, page_languages, {prompt: 'Sélectionnez une langue'}) %>
27
+ <small>La langue d'affichage de la page</small>
28
+ </div>
17
29
  </div>
18
30
  <div class="sibu_field">
19
31
  <%= f.label :title, 'Titre' %>
20
- <%= f.text_field :title, placeholder: "Titre de la page" %>
32
+ <div>
33
+ <%= f.text_field :title, placeholder: "Maximum 80 caractères", maxlength: 80 %>
34
+ <small>Le titre sera affiché dans les résultats des moteurs de recherche et dans les onglets des navigateurs</small>
35
+ </div>
21
36
  </div>
22
37
  <div class="sibu_field">
23
38
  <%= f.label :description, 'Description' %>
24
- <%= f.text_area :description, placeholder: "Description de la page" %>
39
+ <div>
40
+ <%= f.text_area :description, placeholder: "Maximum 300 caractères", maxlength: 300 %>
41
+ <small>La description est affichée dans les résultats des moteurs de recherche</small>
42
+ </div>
43
+ </div>
44
+ <div class="sibu_field">
45
+ <%= f.label :keywords, 'Mots-clé' %>
46
+ <div>
47
+ <%= f.text_area :keywords, placeholder: "Mots-clé utilisés dans votre site" %>
48
+ <small>Une liste de mots-clé décrivant le contenu de votre site (optionnelle)</small>
49
+ </div>
25
50
  </div>
26
51
  <%= f.hidden_field :site_id %>
27
52
  <div class="sibu_actions">
@@ -3,14 +3,23 @@
3
3
  <%= render 'element_actions' %>
4
4
  <div class="sibu_edit_form">
5
5
  <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
+ <% internal = is_internal(@element["value"]) %>
6
7
  <div class="sibu_field">
7
8
  <%= label_tag 'element[text]', 'Libellé' %>
8
9
  <%= text_field_tag 'element[text]', @element["text"] %>
9
10
  </div>
10
- <div class="sibu_field">
11
- <%= label_tag 'element[value]', 'Lien' %>
12
- <%= select_tag 'element[value]', options_from_collection_for_select(@site.pages, :id, :name, @element["value"]),
13
- {prompt: 'Sélectionnez une page'} %>
11
+ <div id="link_internal" class="sibu_field">
12
+ <%= radio_button_tag :mode, 'internal', internal, class: 'radio' %>
13
+ <%= label_tag 'mode_internal', 'Lien vers une page du site' %>
14
+ <%= select_tag 'element[value]', options_from_collection_for_select(@site.pages.order(:name), :id, :name, @element["value"]),
15
+ prompt: 'Sélectionnez une page', disabled: !internal %>
16
+ <%= hidden_field_tag 'element[target]', '_self', disabled: !internal %>
17
+ </div>
18
+ <div id="link_external" class="sibu_field">
19
+ <%= radio_button_tag :mode, 'external', !internal, class: 'radio' %>
20
+ <%= label_tag 'mode_external', 'Lien vers un autre site' %>
21
+ <%= text_field_tag 'element[value]', (@element["value"] unless internal), placeholder: 'Ex : http://www.un-site.com', disabled: internal %>
22
+ <%= hidden_field_tag 'element[target]', '_blank', disabled: internal %>
14
23
  </div>
15
24
  <%= hidden_field_tag 'element[id]', @element["id"] %>
16
25
  <%= hidden_field_tag :element_id, @element_id %>
@@ -5,8 +5,8 @@
5
5
  <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
6
  <div class="sibu_select_images sibu_field">
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
- <% @site.images.each do |image| %>
9
- <div class="sibu_image">
8
+ <% site_images.each do |image| %>
9
+ <div class="sibu_image" data-img-id="<%= image.id %>">
10
10
  <%= image_tag image.file_url(:medium), class: (@element["src"] == image.file_url(:medium) ? 'selected' : '') %>
11
11
  </div>
12
12
  <% end %>
@@ -0,0 +1,18 @@
1
+ <h2>Modifier le texte</h2>
2
+ <div id="edit_msg"></div>
3
+ <%= render 'element_actions' %>
4
+ <div class="sibu_edit_form">
5
+ <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
+ <div id="editor-container"></div>
7
+
8
+ <%= hidden_field_tag 'element[text]' %>
9
+ <%= hidden_field_tag 'element[id]', @element["id"] %>
10
+ <%= hidden_field_tag :element_id, @element_id %>
11
+ <%= hidden_field_tag :section_id, @section_id %>
12
+ <%= hidden_field_tag :entity, @entity_type %>
13
+ <div class="sibu_actions">
14
+ <%= submit_tag 'Valider' %>
15
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
16
+ </div>
17
+ <% end %>
18
+ </div>
@@ -3,7 +3,10 @@
3
3
  <%= render 'element_actions' %>
4
4
  <div class="sibu_edit_form">
5
5
  <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
- <%= trix_editor_tag 'element[text]', '', input: 'element_text' %>
6
+ <div class="sibu_field">
7
+ <%= label_tag 'element[text]', 'Texte' %>
8
+ <%= text_field_tag 'element[text]', @element["text"] %>
9
+ </div>
7
10
  <%= hidden_field_tag 'element[id]', @element["id"] %>
8
11
  <%= hidden_field_tag :element_id, @element_id %>
9
12
  <%= hidden_field_tag :section_id, @section_id %>
@@ -2,9 +2,5 @@
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 = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']").first();
6
- var newElt = clonedElt.clone();
7
- newElt.data("id", "<%= @cloned["id"] %>");
8
- clonedElt.after(newElt);
9
- cancelEditMode();
5
+ location.reload(true);
10
6
  <% end %>
@@ -1,9 +1,5 @@
1
1
  <% if @cloned %>
2
- var section = $(".sibu_content_panel").find("[data-sb-id='<%= @section_id %>']").first();
3
- var newSection = section.clone();
4
- newSection.data("sb-id", "<%= [@section_id.split('|')[0], @cloned["id"]].join('|') %>");
5
- section.after(newSection);
6
- cancelEditMode();
2
+ location.reload(true);
7
3
  <% else %>
8
4
  $("#edit_section_msg").html("<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>");
9
5
  <% end %>
@@ -1,7 +1,6 @@
1
1
  <% if @deleted %>
2
- $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']").first().remove();
3
- cancelEditMode();
2
+ location.reload(true);
4
3
  <% else %>
5
- $("#edit_section_msg").text("Une erreur s'est produite lors de la suppression.");
4
+ $("#edit_section_msg").text("La suppression n'a pas pu être effectuée.");
6
5
  <% end %>
7
6
 
@@ -1,6 +1,5 @@
1
1
  <% if @deleted %>
2
- $(".sibu_content_panel").find("[data-sb-id='<%= @section_id %>']").first().remove();
3
- cancelEditMode();
2
+ location.reload(true);
4
3
  <% else %>
5
4
  $("#edit_section_msg").text("Une erreur s'est produite lors de la suppression.");
6
5
  <% end %>
@@ -1,11 +1,23 @@
1
1
  var editPanel = $("#edit_panel");
2
2
  editPanel.html("");
3
- <% if @content_type == 'text' %>
4
- <% text_value = @element["text"] || 'Texte à modifier' %>
3
+ <% case @content_type %>
4
+ <% when 'text' %>
5
5
  editPanel.html("<%= j(render 'text_edit_panel') %>");
6
- var editorElt = editPanel.find("trix-editor")[0];
7
- editorElt.editor.loadHTML("<%= j(raw(text_value.gsub("\n", "<br/>"))) %>");
8
- <% elsif @content_type == 'media' %>
6
+ <% when 'paragraph' %>
7
+ editPanel.html("<%= j(render 'paragraph_edit_panel') %>");
8
+ var quill = initQuillEditor('#editor-container');
9
+ quill.root.innerHTML = "<%= j(raw(@element["text"] || 'Texte à modifier')) %>";
10
+ quill.on('text-change', function() {
11
+ $("#element_text").val(quill.root.innerHTML);
12
+ });
13
+ var wrapper = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']");
14
+ editPanel.find(".ql-editor").css({
15
+ "font-family": wrapper.css("font-family"),
16
+ "font-size": wrapper.css("font-size"),
17
+ "color": wrapper.css("color"),
18
+ "text-align": wrapper.css("text-align")
19
+ });
20
+ <% when 'media' %>
9
21
  editPanel.html("<%= j(render 'media_edit_panel') %>");
10
22
  var images = editPanel.find(".sibu_image img");
11
23
  images.click(function() {
@@ -15,9 +27,18 @@ editPanel.html("");
15
27
  $("#element_src").val($(this).attr("src"));
16
28
  }
17
29
  });
18
- <% elsif @content_type == 'link' %>
30
+ <% when 'link' %>
19
31
  editPanel.html("<%= j(render 'link_edit_panel') %>");
32
+ $("input[name='mode']").change(function() {
33
+ var selected = $(this).val();
34
+ var other = selected === 'internal' ? 'external' : 'internal';
35
+ $("#link_" + selected).find("#element_value, #element_target").removeAttr("disabled");
36
+ $("#link_" + other).find("#element_value, #element_target").attr("disabled", "disabled");
37
+ });
38
+ <% else %>
39
+ editPanel.html("<%= j(render 'error_panel') %>");
20
40
  <% end %>
41
+
21
42
  <% if @repeat %>
22
43
  $("#element_actions").show();
23
44
  <% else %>
@@ -6,9 +6,9 @@
6
6
  <% if @updated["text"] %>
7
7
  updatedElt.html("<%= j(raw @updated["text"]) %>");
8
8
  <% end %>
9
- <% unless @updated.except("id", "text").blank? %>
9
+ <% unless @updated.except("id", "text", "value").blank? %>
10
10
  var tag = updatedElt.prop("tagName").toLowerCase();
11
- <% @updated.except("id", "text").each_pair do |attr, val| %>
11
+ <% @updated.except("id", "text", "value").each_pair do |attr, val| %>
12
12
  if(("<%= attr %>" === 'src' || "<%= attr %>" === 'alt') && tag !== 'img') {
13
13
  updatedElt.find("img").attr("<%= attr %>", "<%= val %>");
14
14
  } else {
data/lib/sibu/engine.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'jquery-rails'
2
- require 'trix'
3
2
 
4
3
  module Sibu
5
4
  class Engine < ::Rails::Engine
data/lib/sibu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.1.18'
2
+ VERSION = '0.1.19'
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.1.18
4
+ version: 0.1.19
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-16 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '4.3'
97
- - !ruby/object:Gem::Dependency
98
- name: trix
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.11'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.11'
111
97
  description: Sibu is an engine for Ruby on Rails that enables creation of static websites
112
98
  in a simple & wysiwyg way.
113
99
  email:
@@ -120,7 +106,9 @@ files:
120
106
  - README.md
121
107
  - Rakefile
122
108
  - app/assets/config/sibu_manifest.js
109
+ - app/assets/javascripts/quill/quill.js
123
110
  - app/assets/javascripts/sibu/sibu.js.erb
111
+ - app/assets/stylesheets/quill/quill.snow.css
124
112
  - app/assets/stylesheets/sibu/sibu.css
125
113
  - app/controllers/sibu/application_controller.rb
126
114
  - app/controllers/sibu/images_controller.rb
@@ -149,9 +137,11 @@ files:
149
137
  - app/views/sibu/images/show.html.erb
150
138
  - app/views/sibu/pages/_custom_styles.html.erb
151
139
  - app/views/sibu/pages/_element_actions.html.erb
140
+ - app/views/sibu/pages/_error_panel.html.erb
152
141
  - app/views/sibu/pages/_form.html.erb
153
142
  - app/views/sibu/pages/_link_edit_panel.html.erb
154
143
  - app/views/sibu/pages/_media_edit_panel.html.erb
144
+ - app/views/sibu/pages/_paragraph_edit_panel.html.erb
155
145
  - app/views/sibu/pages/_text_edit_panel.html.erb
156
146
  - app/views/sibu/pages/clone_element.js.erb
157
147
  - app/views/sibu/pages/clone_section.js.erb