sibu 1.0.4 → 1.0.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: 48f219f6b806e3d5d5fbd7ce2df9224fd2e65b8a
4
- data.tar.gz: 56fcfd81852d1cb3a11f4c0b4a3754cbf0f261c7
3
+ metadata.gz: 83f747d2d0f30d44d8321ea252994eb72a246743
4
+ data.tar.gz: 4e422b2041a2e3b8ca5eb86810e5440873c7c85e
5
5
  SHA512:
6
- metadata.gz: 10d19792d46338bd0bd7a3be61bad6547562e8e55edf252ee311727b7f02dfad823c95e66667f3e314ad6d3be30ca51a688028b0a1628f7d6ecfda46caf2e12d
7
- data.tar.gz: 92ecb493f7f4f5986cb0c8f5936add93dd5d962fa7618c5eba06cbd40638bc73837ba0f9e94a6673968c3ec044685ac25fa5d2e37eb21cbd20c8e5b0eb41bad3
6
+ metadata.gz: 22a3a04bb5835e8119274276106e99ab700cd85c55c47aecafd8111c7c7eaa633f1c57a5e35b088a3532de89d7250580e17965f411a974657df642ac3c6b8a3b
7
+ data.tar.gz: 284b06e15ef29a30528f605d4c7b003781f17cad85be9a5c42daf78fff8520818189128abe907976ace0930b34f5c05d1f80cf3e7d367c523267e45734e9b1b1
@@ -229,8 +229,7 @@ $sibu-color3 : #333 !default;
229
229
  padding: 2rem;
230
230
 
231
231
  img {
232
- padding-top: 2rem;
233
- padding-bottom: 2rem;
232
+ margin-bottom: 2rem;
234
233
  border-top: 2px solid $sibu-color1;
235
234
  box-shadow: 0 0 5px #ccc;
236
235
  }
@@ -124,25 +124,33 @@ module Sibu
124
124
  wrapper = opts.delete(:wrapper)
125
125
  repeat = opts.delete(:repeat)
126
126
  size = opts.delete(:size)
127
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => Sibu::DEFAULT_IMG}
127
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
128
+ defaults = {"id" => t_id, "src" => Sibu::DEFAULT_IMG}
128
129
  content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
130
+ @sb_section = (@sb_section || []) + [t_id]
129
131
  if action_name == 'show'
130
132
  content["src"] = ("/#{conf[:deployment_path]}" + content["src"]) if @online && conf[:deployment_path]
131
133
  else
132
- opts.merge!({data: {id: elt_id(elt), type: "media", repeat: repeat, size: size}})
134
+ opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "media", repeat: repeat, size: size}})
133
135
  end
134
- wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts)
136
+ html_output = wrapper ? content_tag(wrapper, content_tag(:img, nil, content.except("id")), opts)
135
137
  : content_tag(:img, nil, content.except("id").merge(opts.stringify_keys) {|k, old, new| k == 'class' ? [old, new].join(' ') : new})
138
+ @sb_section -= [t_id]
139
+ html_output
136
140
  end
137
141
 
138
142
  def grp(elt, opts = {}, &block)
139
143
  wrapper = opts.delete(:wrapper) || :div
140
144
  repeat = opts.delete(:repeat)
141
145
  children = opts.delete(:children)
142
- defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt}
146
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
147
+ @sb_section = (@sb_section || []) + [t_id]
148
+ defaults = {"id" => t_id}
143
149
  opts = defaults.merge(opts)
144
- opts.merge!({data: {id: elt_id(elt), type: "group", repeat: repeat, children: children}}) if action_name != 'show'
145
- content_tag(wrapper, capture(*elts(elt), &block), opts)
150
+ opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "group", repeat: repeat, children: children}}) if action_name != 'show'
151
+ html_output = content_tag(wrapper, capture(*elts(elt), &block), opts)
152
+ @sb_section -= [t_id]
153
+ html_output
146
154
  end
147
155
 
148
156
  def empty_tag(elt, tag, type, opts = {})
@@ -229,12 +237,14 @@ module Sibu
229
237
  def link(elt, html_opts = {}, &block)
230
238
  repeat = html_opts.delete(:repeat)
231
239
  children = html_opts.delete(:children)
232
- defaults = {"id" => elt_id(elt), "value" => "", "text" => Sibu::DEFAULT_TEXT}
240
+ t_id = elt.is_a?(Hash) ? elt["id"] : elt
241
+ defaults = {"id" => t_id, "value" => "", "text" => Sibu::DEFAULT_TEXT}
233
242
  link_elt = current_elt(elt)
234
243
  content = defaults.merge(link_elt)
235
244
  val = content.delete("value") || ""
236
245
  text = content.delete("text")
237
- html_opts.merge!({data: {id: elt_id(elt), type: "link", repeat: repeat, children: children}}) if action_name != 'show'
246
+ @sb_section = (@sb_section || []) + [t_id]
247
+ html_opts.merge!({data: {id: @sb_section[1..-1].join('|'), type: "link", repeat: repeat, children: children}}) if action_name != 'show'
238
248
  if val.to_s.start_with?('http')
239
249
  content["href"] = val
240
250
  elsif val.to_s.start_with?('#')
@@ -248,13 +258,12 @@ module Sibu
248
258
  content["href"] = @links.keys.include?(val.to_s) ? (action_name == 'show' ? link_path(val) : site_page_edit_content_path(@site.id, val)) : '#'
249
259
  end
250
260
  if block_given?
251
- @sb_section = (@sb_section || []) + [elt_id(elt)]
252
261
  html_output = content_tag(:a, capture(link_elt, elts(elt), &block), content.merge(html_opts).except("elements"))
253
- @sb_section -= [elt_id(elt)]
254
- html_output
255
262
  else
256
- content_tag(:a, raw(text), content.merge(html_opts).except("elements"))
263
+ html_output = content_tag(:a, raw(text), content.merge(html_opts).except("elements"))
257
264
  end
265
+ @sb_section -= [t_id]
266
+ html_output
258
267
  end
259
268
 
260
269
  def interactive_map(elt, html_opts = {})
@@ -62,5 +62,9 @@ module Sibu
62
62
  save
63
63
  end
64
64
  end
65
+
66
+ def home?
67
+ is_home == 'true' || is_home == '1'
68
+ end
65
69
  end
66
70
  end
@@ -2,13 +2,13 @@
2
2
  <html>
3
3
  <head>
4
4
  <title><%= conf[:title] %></title>
5
+ <%= stylesheet_link_tag 'sibu/sibu', media: 'all' %>
6
+ <%= stylesheet_link_tag "#{conf[:stylesheet]}-edit", media: 'all' %>
7
+ <%= javascript_include_tag "#{conf[:javascript]}-edit" %>
5
8
  <% if @site %>
6
9
  <%= stylesheet_link_tag (conf[:custom_styles] ? @site.style_url : @site.site_template.path), media: "all" %>
7
10
  <%= javascript_include_tag @site.site_template.path %>
8
11
  <% end %>
9
- <%= stylesheet_link_tag 'sibu/sibu', media: 'all' %>
10
- <%= stylesheet_link_tag "#{conf[:stylesheet]}-edit", media: 'all' %>
11
- <%= javascript_include_tag "#{conf[:javascript]}-edit" %>
12
12
  <%= csrf_meta_tags %>
13
13
  <%= yield :styles %>
14
14
  </head>
@@ -1,6 +1,9 @@
1
1
  <div id="pages" class="sibu_view">
2
2
  <div class="actions">
3
- <%= link_to 'Créer une page', new_site_page_path(@site.id) %> <%= link_to 'Retour', :back %>
3
+ <%= link_to "Bibliothèque d'images", images_path %>
4
+ <%= link_to "Documents", documents_path %>
5
+ <%= link_to 'Créer une page', new_site_page_path(@site.id) %>
6
+ <%= link_to 'Retour', :back %>
4
7
  </div>
5
8
  <h2>Pages du site "<%= @site.name %>"</h2>
6
9
  <table>
@@ -24,7 +27,7 @@
24
27
  <%= link_to 'Voir', site_page_path(@site.id, p), target: '_blank' %> |
25
28
  <%= link_to 'Editer', site_page_edit_content_path(site_id: @site.id, page_id: p.id) %> |
26
29
  <%= link_to 'Copier', duplicate_site_page_path(@site.id, p), method: :post, data: {confirm: "Copier la page \"#{p.name}\" ?"} %> |
27
- <%= link_to 'Réglages', edit_site_page_path(@site.id, p) %> |
30
+ <%= link_to 'Paramétrer cette page', edit_site_page_path(@site.id, p) %> |
28
31
  <%= link_to 'Supprimer', site_page_path(@site.id, p), method: :delete, data: {confirm: "Supprimer la page \"#{p.name}\" ?"} %>
29
32
  </td>
30
33
  </tr>
@@ -16,8 +16,8 @@
16
16
  <div class="sibu_field">
17
17
  <%= f.label :site_template_id, 'Modèle' %>
18
18
  <div>
19
- <%= f.collection_select(:site_template_id, Sibu::SiteTemplate.all, :id, :name, {prompt: 'Sélectionnez un modèle de site'}, disabled: @site.persisted?) %>
20
- <small>Choisissez le gabarit qui servira de modèle pour votre site (non modifiable après création)</small>
19
+ <%= f.collection_select(:site_template_id, Sibu::SiteTemplate.all.order(:name), :id, :name, {prompt: 'Sélectionnez un modèle de site'}, disabled: @site.persisted?) %>
20
+ <small>Choisissez le gabarit qui servira de modèle pour votre site (voir exemples ci-dessous - non modifiable après création)</small>
21
21
  </div>
22
22
  </div>
23
23
  <div class="sibu_field">
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
  <h2>Aperçu des modèles</h2>
10
10
  <div>
11
- <% Sibu::SiteTemplate.all.each do |st| %>
11
+ <% Sibu::SiteTemplate.all.order(:name).each do |st| %>
12
12
  <div class="sibu_template">
13
13
  <h3><%= st.name %></h3>
14
14
  <%= image_tag "#{st.path}1.jpg" %>
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.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: 1.0.4
4
+ version: 1.0.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-07-23 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails