sibu 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/sibu/pages_helper.rb +6 -92
- 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: 10981cb214e2ab904bd23d643a9c86174dd1e1b5
|
4
|
+
data.tar.gz: 0b93791e67459e9f6adae5bffaa3c40d242739be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ffc08c26fcc86c0c148eb10baf897ab72020c2cfcafd99da5976bfbf356e1c5f24ac4e02ce10851fb9900d3d71497086f65730a537665296fc1ccc75f01c6e0
|
7
|
+
data.tar.gz: 0b8b350b7fd7e7b8bb2c6f7c01b10e6705cd7d4bcf40994240762beaea1ab590d7fc42de0d30c4654d1e2dee3ed68cbd329559c8f92235515e15578f314cca6c
|
@@ -34,68 +34,10 @@ module Sibu
|
|
34
34
|
@sb_entity.section(*@sb_section).select {|elt| elt["id"] == id}.first
|
35
35
|
end
|
36
36
|
|
37
|
-
def site_section(id, sub_id = nil, &block)
|
38
|
-
@sb_entity = @site
|
39
|
-
@sb_section = sub_id ? [id, sub_id] : [id]
|
40
|
-
if block_given?
|
41
|
-
if action_name != 'show'
|
42
|
-
"<sb-edit data-id='#{@sb_section.join('|')}' data-entity='site'>#{capture(self, &block)}</sb-edit>".html_safe
|
43
|
-
else
|
44
|
-
capture(self, &block)
|
45
|
-
end
|
46
|
-
else
|
47
|
-
self
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def section(id, sub_id = nil, &block)
|
52
|
-
@sb_entity = @page
|
53
|
-
@sb_section = sub_id ? [id, sub_id] : [id]
|
54
|
-
if action_name != 'show'
|
55
|
-
"<sb-edit data-id='#{@sb_section.join('|')}' data-entity='page' data-duplicate='#{!sub_id.nil?}'>#{capture(self, &block)}</sb-edit>".html_safe
|
56
|
-
else
|
57
|
-
capture(self, &block)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# def site_sections(id, &block)
|
62
|
-
# @site.section(id).map {|s| s["id"]}.each do |s|
|
63
|
-
# site_section(id, sub_id, &block)
|
64
|
-
# end
|
65
|
-
# out = ''
|
66
|
-
# @sb_entity = @site
|
67
|
-
# @site.section(id).map do |s|
|
68
|
-
# @sb_section = [id, s["id"]]
|
69
|
-
# out += "<sb-edit data-id='#{@sb_section.join('|')}' data-entity='site' data-duplicate='true'>#{capture(self, &block)}</sb-edit>".html_safe
|
70
|
-
# end
|
71
|
-
# out.html_safe
|
72
|
-
# end
|
73
|
-
|
74
|
-
def site_sections(id)
|
75
|
-
@site.section(id).map {|s| s["id"]}
|
76
|
-
end
|
77
|
-
|
78
|
-
def sections(id)
|
79
|
-
@page.section(id).map {|s| s["id"]}
|
80
|
-
end
|
81
|
-
|
82
37
|
def elements(id = nil)
|
83
38
|
id ? select_element(id)["elements"] : @sb_entity.section(*@sb_section)
|
84
39
|
end
|
85
40
|
|
86
|
-
def each
|
87
|
-
# Todo : init array when empty
|
88
|
-
@sb_entity.section(*@sb_section).each do |elt|
|
89
|
-
yield(elt.except("elements"), elt["elements"])
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def each_elements
|
94
|
-
@sb_entity.section(*@sb_section).each do |elt|
|
95
|
-
yield(*elt["elements"])
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
41
|
def img(elt, opts = {})
|
100
42
|
wrapper = opts.delete(:wrapper)
|
101
43
|
repeat = opts.delete(:repeat)
|
@@ -118,39 +60,14 @@ module Sibu
|
|
118
60
|
end
|
119
61
|
alias site sb_site
|
120
62
|
|
121
|
-
|
122
|
-
# @sb_section = [id]
|
123
|
-
# opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => id, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
124
|
-
# ((action_name != 'show' ? "<sb-edit data-id='#{@sb_section}' data-entity='#{@sb_entity == @site ? 'site' : 'page'}'>" : '') +
|
125
|
-
# @sb_entity.section(@sb_section).map {|elt| capture(elt, &block)}.join('') +
|
126
|
-
# (action_name != 'show' ? "</sb-edit>" : '')).html_safe
|
127
|
-
# end
|
128
|
-
|
129
|
-
# def secsion(id)
|
130
|
-
# @sb_section = id
|
131
|
-
# if block_given?
|
132
|
-
# if current_action != 'show'
|
133
|
-
# "<sb-edit data-id='#{@sb_section}' data-entity='#{@sb_entity == @site ? 'site' : 'page'}'>#{capture(self, &block)}</sb-edit>".html_safe
|
134
|
-
# else
|
135
|
-
# capture(self, &block)
|
136
|
-
# end
|
137
|
-
# else
|
138
|
-
# self
|
139
|
-
# end
|
140
|
-
# end
|
141
|
-
#
|
142
|
-
# def secsions(id)
|
143
|
-
#
|
144
|
-
# end
|
145
|
-
|
146
|
-
def secsion(id, tag, html_opts = {}, &block)
|
63
|
+
def section(id, tag, html_opts = {}, &block)
|
147
64
|
@sb_section = [id]
|
148
65
|
rpt = html_opts.delete(:repeat)
|
149
66
|
opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => id, "data-sb-repeat" => rpt, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
150
67
|
content_tag(tag, capture(self, &block), opts)
|
151
68
|
end
|
152
69
|
|
153
|
-
def
|
70
|
+
def sections(id, tag, html_opts = {}, &block)
|
154
71
|
(@sb_entity.section(id).map.with_index do |elt, i|
|
155
72
|
@sb_section = [id, elt["id"]]
|
156
73
|
opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => @sb_section.join('|'), "data-sb-repeat" => true, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
|
@@ -158,6 +75,10 @@ module Sibu
|
|
158
75
|
end).join('').html_safe
|
159
76
|
end
|
160
77
|
|
78
|
+
def elt(id)
|
79
|
+
select_element(id)
|
80
|
+
end
|
81
|
+
|
161
82
|
# Note : could work well - set the ids hierarchy in elements retrieved from the db
|
162
83
|
def elts(id)
|
163
84
|
items = []
|
@@ -168,13 +89,6 @@ module Sibu
|
|
168
89
|
items
|
169
90
|
end
|
170
91
|
|
171
|
-
# def bg_img(elt, html_opts = {})
|
172
|
-
# defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "src" => "/default.jpg"}
|
173
|
-
# content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
174
|
-
# html_opts.merge!({class: "sb-img #{html_opts[:class]}", data: {id: elt.is_a?(Hash) ? elt["id"] : elt}}) if action_name != 'show'
|
175
|
-
# content_tag(:div, content_tag(:img, nil, content.except("id")), html_opts)
|
176
|
-
# end
|
177
|
-
|
178
92
|
def link(elt, html_opts = {}, &block)
|
179
93
|
repeat = html_opts.delete(:repeat)
|
180
94
|
defaults = {"id" => elt_id(elt), "value" => "", "text" => "Nouveau lien"}
|
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: 0.1.
|
4
|
+
version: 0.1.17
|
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-
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|