sibu 0.3.6 → 0.3.7

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: 0f17889c285411b415b5437dd974bd0731e9b5f2
4
- data.tar.gz: 687b8c0f5eff9bf46250bbe81f8e80583e730bac
3
+ metadata.gz: 8f0fc7bd3a2d8875fbef8b262138177995ddaf60
4
+ data.tar.gz: a7e217c76b663623b83544e2d795b5de6d6c608d
5
5
  SHA512:
6
- metadata.gz: b58c092b6062a412a1062b54374e17af37316c919dcd9da98fdddf17630256f04d6034007e79f749e36f994a71240568d710b2fb93922170450c942e2faf1363
7
- data.tar.gz: 533b5e9e098e8ca680e3123092860e1bc79e228cd1ce278367a2a74e46840ee60bc3b71685189c233f86d0c688796b90cf1bcb521590986603993de8dc166ad0
6
+ metadata.gz: 651272394d1ea49918f25186a0bcc59eb5aa1bb2b73f7acd6108fa306a065e59dad20ce4c9c66993d4b6f14143119c7a4c3817ebd392f88cb44e4d92f66b0ba4
7
+ data.tar.gz: f2b7299c8b124e0ca763c873f8f9f81a1fd8009d16564a4b31e57bbffa64be4550cadd2889334063c77e6eebac448f48027e71e34b5336f353dc649a7a9427b6
@@ -96,6 +96,13 @@ module Sibu
96
96
  content_tag(:div, capture(widget_type.new(content), &block), opts)
97
97
  end
98
98
 
99
+ def embed(elt, opts = {})
100
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "code" => '<p>Contenu HTML personnalisé (iframe, etc...)</p>'}
101
+ content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
102
+ opts.merge!({data: {id: elt_id(elt), type: "embed"}}) if action_name != 'show'
103
+ content_tag(:div, content_tag(:p, raw(content["code"]).html_safe), opts)
104
+ end
105
+
99
106
  # Note : see ActionView::OutputBuffer
100
107
  def sb_page
101
108
  @sb_entity = @page
@@ -0,0 +1,18 @@
1
+ <h2>Modifier le contenu</h2>
2
+ <div id="edit_msg"></div>
3
+ <div class="sibu_edit_form">
4
+ <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
5
+ <div class="sibu_field">
6
+ <%= label_tag 'element[code]', "Code d'intégration du contenu" %>
7
+ <%= text_area_tag 'element[code]', @element["code"], placeholder: ' ex: <iframe src="..."></iframe>' %>
8
+ </div>
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,6 +3,8 @@ editPanel.html("");
3
3
  <% case @content_type %>
4
4
  <% when 'text' %>
5
5
  editPanel.html("<%= j(render 'text_edit_panel') %>");
6
+ <% when 'embed' %>
7
+ editPanel.html("<%= j(render 'code_edit_panel') %>");
6
8
  <% when 'paragraph' %>
7
9
  editPanel.html("<%= j(render 'paragraph_edit_panel') %>");
8
10
  <% when 'media' %>
@@ -8,6 +8,8 @@
8
8
  var updatedElt = $("[data-sb-id='<%= @section_id %>']").find("[data-id='<%= @element_id %>']");
9
9
  <% if @updated["text"] %>
10
10
  updatedElt.html("<%= j(raw @updated["text"]) %>");
11
+ <% elsif @updated["code"] %>
12
+ updatedElt.html("<%= j(raw @updated["code"]) %>");
11
13
  <% end %>
12
14
  <% unless @updated.except("id", "text", "value").blank? %>
13
15
  var tag = updatedElt.prop("tagName").toLowerCase();
data/lib/sibu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.3.6'
2
+ VERSION = '0.3.7'
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.3.6
4
+ version: 0.3.7
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-05-31 00:00:00.000000000 Z
11
+ date: 2018-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -169,6 +169,7 @@ files:
169
169
  - app/views/sibu/images/index.html.erb
170
170
  - app/views/sibu/images/new.html.erb
171
171
  - app/views/sibu/images/show.html.erb
172
+ - app/views/sibu/pages/_code_edit_panel.html.erb
172
173
  - app/views/sibu/pages/_element_actions.html.erb
173
174
  - app/views/sibu/pages/_error_panel.html.erb
174
175
  - app/views/sibu/pages/_form.html.erb