sibu 0.1.22 → 0.1.23

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: 3bd4c7f3ddac097c6e3ff1718357d64f3769f886
4
- data.tar.gz: c45772f2d3851da0c553d0fb7b76a427fc6fdea6
3
+ metadata.gz: cf0a50b455e8b126a684c7e873aab00e81d81c5b
4
+ data.tar.gz: 92a49e130dcfb15a8d4d468f9477ea688621b184
5
5
  SHA512:
6
- metadata.gz: 02475b5b1707ec2f4807be144549aa06234050e9f2c34e600d34fcb807c29858a698d4b64697719763911b857aa4087b14ed29b9b62a51441205e418709a39eb
7
- data.tar.gz: d9383148391ef403d4cc9de8ec3203853eb7870bc9c6de18ddd6b623d8277e9b505cff40ac738cbe668188175867189a7232eed49532f8c26d72a87e578cfda4
6
+ metadata.gz: ff2da9127eb7226336125f793ec6f174c5745b163f93e3e4d18e603033d206f1bfeb07231561fd1a2c485d69996cf55a425b8db808bec2c3cf8895f10cb46b1c
7
+ data.tar.gz: ad09d978727300f5c30bb1f3f21d7aa8d5151428f787db9c3004bccceb2af187eab3b77011e1354d4b18621f3fc581478a46b44d3c7d24dd845d4c159eb21f03
@@ -102,6 +102,10 @@ module Sibu
102
102
  @page.sections << {"id" => "sibu_template_free_text", "elements" => [{"id" => "paragraph0"}]}
103
103
  @page.sections << {"id" => "sibu_template_gallery",
104
104
  "elements" => [{"id" => "slide0", "elements" => [{"id" => "slide0"}, {"id" => "slide1"}, {"id" => "slide2"}]}]}
105
+ @page.sections << {"id" => "sibu_template_table", "elements" => [
106
+ {"id" => "col0", "elements" => [{"id" => "row1"}, {"id" => "row2"}]},
107
+ {"id" => "col1", "elements" => [{"id" => "row1"}, {"id" => "row2"}]},
108
+ ]}
105
109
  end
106
110
 
107
111
  def create_section
@@ -41,11 +41,12 @@ module Sibu
41
41
  end
42
42
  end
43
43
 
44
- def p(elt, html_opts = {})
44
+ def p(elt, opts = {})
45
+ repeat = opts.delete(:repeat)
45
46
  defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => DEFAULT_PARAGRAPH}
46
47
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
47
- html_opts.merge!({data: {id: elt_id(elt), type: "paragraph"}}) if action_name != 'show'
48
- content_tag(:div, content_tag(:p, raw(content["text"]).html_safe), html_opts)
48
+ opts.merge!({data: {id: elt_id(elt), repeat: repeat, type: "paragraph"}}) if action_name != 'show'
49
+ content_tag(:div, content_tag(:p, raw(content["text"]).html_safe), opts)
49
50
  end
50
51
 
51
52
  def sb
@@ -58,7 +59,7 @@ module Sibu
58
59
 
59
60
  def elements(id = nil)
60
61
  items = id ? select_element(id)["elements"] : @sb_entity.find_or_init(*@sb_section)["elements"]
61
- items.blank? ? [{"id" => ""}] : items
62
+ items.blank? ? [{"id" => "#{@sb_section.last}*"}] : items
62
63
  end
63
64
 
64
65
  def img(elt, opts = {})
@@ -71,6 +72,16 @@ module Sibu
71
72
  wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts) : content_tag(:img, nil, content.except("id").merge(opts))
72
73
  end
73
74
 
75
+ def grp(elt, opts = {}, &block)
76
+ wrapper = opts.delete(:wrapper) || :div
77
+ repeat = opts.delete(:repeat)
78
+ children = opts.delete(:children)
79
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt}
80
+ opts = defaults.merge(opts)
81
+ opts.merge!({data: {id: elt_id(elt), type: "group", repeat: repeat, children: children}}) if action_name != 'show'
82
+ content_tag(wrapper, capture(self, &block), opts)
83
+ end
84
+
74
85
  # Note : see ActionView::OutputBuffer
75
86
  def sb_page
76
87
  @sb_entity = @page
@@ -109,7 +120,7 @@ module Sibu
109
120
  items << e
110
121
  end
111
122
  end
112
- items.blank? ? [{"id" => element_id.split("|").last, "data-id" => [element_id, "#{id}0"].join("|")}] : items
123
+ items.blank? ? [{"id" => element_id.split("|").last, "data-id" => [element_id, "#{element_id}0"].join("|")}] : items
113
124
  end
114
125
 
115
126
  def link(elt, html_opts = {}, &block)
@@ -179,12 +179,14 @@
179
179
  function initInnerOverlays(section) {
180
180
  var editables = section.find("[data-type]");
181
181
  editables.off();
182
- editables.hover(function() {
182
+ editables.hover(function(evt) {
183
+ evt.stopPropagation();
183
184
  $(this).addClass("sb-editable");
184
185
  }, function() {
185
186
  $(this).removeClass("sb-editable");
186
187
  });
187
188
  editables.click(function(evt) {
189
+ evt.stopPropagation();
188
190
  evt.preventDefault();
189
191
  var elt = $(this), eltId = elt.data("id"), repeat = elt.data("repeat"), type = elt.data("type"),
190
192
  size = elt.data("size"), children = elt.data("children");
@@ -0,0 +1,3 @@
1
+ <h2>Modifier le groupe</h2>
2
+ <div id="edit_msg"></div>
3
+ <%= render 'element_actions' %>
@@ -12,7 +12,7 @@
12
12
  <% end %>
13
13
  </div>
14
14
  <div class="sibu_field">
15
- <%= label_tag 'element[alt]', 'Texte alternatif' %>
15
+ <%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
16
16
  <%= text_field_tag 'element[alt]', @element["alt"] %>
17
17
  </div>
18
18
  <%= hidden_field_tag 'element[id]', @element["id"] %>
@@ -35,6 +35,8 @@ editPanel.html("");
35
35
  $("#link_" + selected).find("#element_value, #element_target").removeAttr("disabled");
36
36
  $("#link_" + other).find("#element_value, #element_target").attr("disabled", "disabled");
37
37
  });
38
+ <% when 'group' %>
39
+ editPanel.html("<%= j(render 'group_edit_panel') %>");
38
40
  <% else %>
39
41
  editPanel.html("<%= j(render 'error_panel') %>");
40
42
  <% end %>
data/lib/sibu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.1.22'
2
+ VERSION = '0.1.23'
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.22
4
+ version: 0.1.23
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-26 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -139,6 +139,7 @@ files:
139
139
  - app/views/sibu/pages/_element_actions.html.erb
140
140
  - app/views/sibu/pages/_error_panel.html.erb
141
141
  - app/views/sibu/pages/_form.html.erb
142
+ - app/views/sibu/pages/_group_edit_panel.html.erb
142
143
  - app/views/sibu/pages/_link_edit_panel.html.erb
143
144
  - app/views/sibu/pages/_media_edit_panel.html.erb
144
145
  - app/views/sibu/pages/_new_section_panel.html.erb