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 +4 -4
- data/app/assets/stylesheets/sibu/defaults.scss +1 -2
- data/app/helpers/sibu/pages_helper.rb +21 -12
- data/app/models/sibu/page.rb +4 -0
- data/app/views/layouts/sibu/edit_content.html.erb +3 -3
- data/app/views/sibu/pages/index.html.erb +5 -2
- data/app/views/sibu/sites/_form.html.erb +2 -2
- data/app/views/sibu/sites/new.html.erb +1 -1
- data/lib/sibu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f747d2d0f30d44d8321ea252994eb72a246743
|
4
|
+
data.tar.gz: 4e422b2041a2e3b8ca5eb86810e5440873c7c85e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22a3a04bb5835e8119274276106e99ab700cd85c55c47aecafd8111c7c7eaa633f1c57a5e35b088a3532de89d7250580e17965f411a974657df642ac3c6b8a3b
|
7
|
+
data.tar.gz: 284b06e15ef29a30528f605d4c7b003781f17cad85be9a5c42daf78fff8520818189128abe907976ace0930b34f5c05d1f80cf3e7d367c523267e45734e9b1b1
|
@@ -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
|
-
|
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:
|
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
|
-
|
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:
|
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
|
-
|
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
|
-
|
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 = {})
|
data/app/models/sibu/page.rb
CHANGED
@@ -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
|
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 '
|
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">
|
data/lib/sibu/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|