sibu 0.9.4 → 0.9.5

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: 16fcabca38cde95976db8beeee9af23a7f2a98bd
4
- data.tar.gz: 834031726d3d44f99b416a5a7500e6c381487434
3
+ metadata.gz: ed61a8ed060882bc3f4eaa48e90e2e91193e0af6
4
+ data.tar.gz: ff7bcbcb03080feee6786bfafdc8c26dac35373f
5
5
  SHA512:
6
- metadata.gz: '06682819d589f5619ec8214cf293942a97d533280f6e29ad895da7353032e98ae7559cc208b0d5f5058794ae8665d88867fe4bb3e4291b0fd79ea852c1309f10'
7
- data.tar.gz: 03ce9e5e3d4fc9df431391fb61edad5f965d47404cd8cfc1de16cd2687d263f97fe4bb82b0a901b863cc9d995f06dbf96fe2ce69b810d3874c2934d38bcf2112
6
+ metadata.gz: a9c9f0cc63ef7b0df355d5dc02f3be1031b91e8f929c36b8c41cbbe80e5b969456a8a6f4c8718fef02f04db0d89f429e65695adf2906563e904b4e0050c33a4d
7
+ data.tar.gz: 9306934fc10e73c5f02960fe4d40bc0c2c9d148f542066dd27deff6e82ac54690dae7d051273056602c8f715076c7214d1a748d0d84d568a825f02314a10c8ec
@@ -1,5 +1,5 @@
1
+ //= require rails-ujs
1
2
  //= require jquery
2
- //= require jquery_ujs
3
3
  //= require sibu/common
4
4
  //= require ../quill/quill
5
5
  //= require ../tabs/van11y-accessible-tab-panel-aria
@@ -37,7 +37,7 @@ module Sibu
37
37
 
38
38
  [:h1, :h2, :h3, :h4, :h5, :h6, :span].each do |t|
39
39
  define_method(t) do |elt, html_opts = {}|
40
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => DEFAULT_TEXT}
40
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => Sibu::DEFAULT_TEXT}
41
41
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
42
42
  html_opts.merge!({data: {id: elt_id(elt), type: "text"}}) if action_name != 'show'
43
43
  content_tag(t, raw(content["text"]).html_safe, html_opts)
@@ -46,7 +46,7 @@ module Sibu
46
46
 
47
47
  def p(elt, opts = {})
48
48
  repeat = opts.delete(:repeat)
49
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => DEFAULT_PARAGRAPH}
49
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => Sibu::DEFAULT_PARAGRAPH}
50
50
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
51
51
  opts.merge!({data: {id: elt_id(elt), repeat: repeat, type: "paragraph"}}) if action_name != 'show'
52
52
  content_tag(:div, content_tag(:p, raw(content["text"]).html_safe), opts)
@@ -69,7 +69,7 @@ module Sibu
69
69
  wrapper = opts.delete(:wrapper)
70
70
  repeat = opts.delete(:repeat)
71
71
  size = opts.delete(:size)
72
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => DEFAULT_IMG}
72
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => Sibu::DEFAULT_IMG}
73
73
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
74
74
  if action_name == 'show'
75
75
  content["src"] = ("/#{conf[:deployment_path]}" + content["src"]) if @online && conf[:deployment_path]
@@ -99,7 +99,7 @@ module Sibu
99
99
  end
100
100
 
101
101
  def form_label(elt, html_opts = {}, &block)
102
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => DEFAULT_TEXT}
102
+ defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => Sibu::DEFAULT_TEXT}
103
103
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
104
104
  html_opts.merge!({data: {id: elt_id(elt), type: "text"}}) if action_name != 'show'
105
105
  content_tag(:label, raw(content["text"]).html_safe, html_opts)
@@ -155,7 +155,7 @@ module Sibu
155
155
  def link(elt, html_opts = {}, &block)
156
156
  repeat = html_opts.delete(:repeat)
157
157
  children = html_opts.delete(:children)
158
- defaults = {"id" => elt_id(elt), "value" => "", "text" => DEFAULT_TEXT}
158
+ defaults = {"id" => elt_id(elt), "value" => "", "text" => Sibu::DEFAULT_TEXT}
159
159
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
160
160
  val = content.delete("value") || ""
161
161
  text = content.delete("text")
@@ -181,7 +181,7 @@ module Sibu
181
181
  end
182
182
 
183
183
  def interactive_map(elt, html_opts = {})
184
- defaults = {"data-lat" => "45.68854", "data-lng" => "5.91587", "data-title" => DEFAULT_TEXT}
184
+ defaults = {"data-lat" => "45.68854", "data-lng" => "5.91587", "data-title" => Sibu::DEFAULT_TEXT}
185
185
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {"id" => elt}))
186
186
  html_opts.merge!({data: {id: elt_id(elt), type: "map"}}) if action_name != 'show'
187
187
  content_tag(:div, nil, content.merge(html_opts))
@@ -194,13 +194,13 @@ module Sibu
194
194
  def default_content(type)
195
195
  case type
196
196
  when "text"
197
- {"text" => DEFAULT_TEXT}
197
+ {"text" => Sibu::DEFAULT_TEXT}
198
198
  when "link"
199
- {"value" => "", "text" => DEFAULT_TEXT}
199
+ {"value" => "", "text" => Sibu::DEFAULT_TEXT}
200
200
  when "paragraph"
201
- {"text" => DEFAULT_PARAGRAPH}
201
+ {"text" => Sibu::DEFAULT_PARAGRAPH}
202
202
  when "media"
203
- {"src" => DEFAULT_IMG}
203
+ {"src" => Sibu::DEFAULT_IMG}
204
204
  when "embed"
205
205
  {"code" => '<p>Contenu HTML personnalisé (iframe, etc...)</p>'}
206
206
  end
@@ -123,55 +123,40 @@
123
123
  function deleteSection() {
124
124
  if (window.confirm("Supprimer la section ?")) {
125
125
  var section = $(".sb-editing").first();
126
- $.ajax({
126
+ Rails.ajax({
127
127
  url: "<%= delete_section_site_page_path(@site.id, @page.id) %>",
128
- method: "DELETE",
129
- data: {
130
- section_id: section.data("sb-id"),
131
- entity: section.data("sb-entity")
132
- }
128
+ type: "DELETE",
129
+ data: new URLSearchParams({section_id: section.data("sb-id"), entity: section.data("sb-entity")}).toString()
133
130
  })
134
131
  }
135
132
  }
136
133
 
137
134
  function cloneElement(entity, sectionId, elementId) {
138
135
  if (window.confirm("Dupliquer l'élément ?")) {
139
- $.ajax({
136
+ Rails.ajax({
140
137
  url: "<%= clone_element_site_page_path(@site.id, @page.id) %>",
141
- method: "POST",
142
- data: {
143
- section_id: sectionId,
144
- element_id: elementId,
145
- entity: entity
146
- }
138
+ type: "POST",
139
+ data: new URLSearchParams({section_id: sectionId, element_id: elementId, entity: entity})
147
140
  })
148
141
  }
149
142
  }
150
143
 
151
144
  function deleteElement(entity, sectionId, elementId) {
152
145
  if (window.confirm("Supprimer l'élément ?")) {
153
- $.ajax({
146
+ Rails.ajax({
154
147
  url: "<%= delete_element_site_page_path(@site.id, @page.id) %>",
155
- method: "DELETE",
156
- data: {
157
- section_id: sectionId,
158
- element_id: elementId,
159
- entity: entity
160
- }
148
+ type: "DELETE",
149
+ data: new URLSearchParams({section_id: sectionId, element_id: elementId, entity: entity})
161
150
  })
162
151
  }
163
152
  }
164
153
 
165
154
  function addChildElement(entity, sectionId, elementId) {
166
155
  if (window.confirm("Ajouter un sous-menu ?")) {
167
- $.ajax({
156
+ Rails.ajax({
168
157
  url: "<%= child_element_site_page_path(@site.id, @page.id) %>",
169
- method: "POST",
170
- data: {
171
- section_id: sectionId,
172
- element_id: elementId,
173
- entity: entity
174
- }
158
+ type: "POST",
159
+ data: new URLSearchParams({section_id: sectionId, element_id: elementId, entity: entity})
175
160
  })
176
161
  }
177
162
  }
@@ -32,19 +32,19 @@
32
32
  </table>
33
33
  </div>
34
34
  <div class="sibu_selected_image">
35
- <% if @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
35
+ <% if @element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank? %>
36
36
  <p>Veuillez sélectionner une image.</p>
37
37
  <% end %>
38
- <div class="sibu_custom_center" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
38
+ <div class="sibu_custom_center" style="display: <%= (@element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
39
39
  <%= check_box_tag('custom_center', true, (!@element["class"].blank? && @element["class"].include?('posx')), id: 'custom_center', class: 'checkbox') %>
40
40
  <%= label_tag 'custom_center', "Recentrer l'image" %>
41
41
  </div>
42
42
  <div class="sibu_center">
43
- <%= image_tag(@element["src"]) unless @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
43
+ <%= image_tag(@element["src"]) unless @element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank? %>
44
44
  <div id="sibu_center_pos" style="display: none;">✕</div>
45
45
  <div id="sibu_center_desc" style="display: none;"><em>Cliquez sur l'image pour la recentrer sur un point donné (à utiliser lorsque l'image est tronquée car la zone d'affichage est trop petite).</em></div>
46
46
  </div>
47
- <div class="sibu_field" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
47
+ <div class="sibu_field" style="display: <%= (@element["src"] == Sibu::DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
48
48
  <%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
49
49
  <%= text_field_tag 'element[alt]', @element["alt"] %>
50
50
  </div>
@@ -1,3 +1,5 @@
1
- DEFAULT_TEXT = "Lorem ipsum"
2
- DEFAULT_PARAGRAPH = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut."
3
- DEFAULT_IMG = "/default.jpg"
1
+ module Sibu
2
+ DEFAULT_TEXT = "Lorem ipsum"
3
+ DEFAULT_PARAGRAPH = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut."
4
+ DEFAULT_IMG = "/default.jpg"
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.9.4'
2
+ VERSION = '0.9.5'
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.9.4
4
+ version: 0.9.5
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: 2020-03-23 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails