jekyll-attendease 0.6.25c → 0.6.25d
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/attendease_plugin/site_page.rb +0 -20
- data/lib/jekyll/attendease_plugin/site_page_blocks_json.rb +42 -0
- data/lib/jekyll/attendease_plugin/site_pages_generator.rb +25 -0
- data/lib/jekyll/attendease_plugin/version.rb +1 -1
- data/spec/lib/jekyll/attendease_plugin/site_pages_generator_spec.rb +7 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2682b13d063e900381c199e06fd1fa3f29e3479
|
4
|
+
data.tar.gz: e8271f92791ca4a8933cb8b0d351bce140c08cbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38cd3072e343f68d7e84c380df2ed6f03c11e4d4e93f036af53f7530b0103d276a535d6747cb9fcb61291f547a396363f8698eb399b86b20cf361b9c52957fc0
|
7
|
+
data.tar.gz: 2dbd99cb83d75e4f2148168416a381e36d496742653113d0cffda84dd58677258346d01fd0662184ea3839832c8d556a005e17076f1ff1c18c1ddc52520fef60
|
@@ -9,31 +9,11 @@ module Jekyll
|
|
9
9
|
|
10
10
|
self.process(@name)
|
11
11
|
|
12
|
-
#require 'pry'
|
13
|
-
#binding.pry
|
14
|
-
#self.read_yaml(File.join(base, '_attendease', 'templates', 'pages'), 'default.html')
|
15
12
|
self.read_yaml(File.join(base, '_layouts'), "#{page['layout']}.html")
|
16
13
|
|
17
14
|
self.data['title'] = page['title']
|
18
15
|
self.data['layout'] = page['layout']
|
19
16
|
|
20
|
-
zones = {}
|
21
|
-
|
22
|
-
# create zone buckets
|
23
|
-
page['widget_instances'].each do |i|
|
24
|
-
zones[i['zone']] = [] if zones[i['zone']].nil?
|
25
|
-
zones[i['zone']] << i
|
26
|
-
end
|
27
|
-
|
28
|
-
# sort each bucket by widget weight
|
29
|
-
zones.each do |k, zone|
|
30
|
-
zone.sort! { |x, y| y['weight'] <=> x['weight'] }
|
31
|
-
self.data[k] = ''
|
32
|
-
zone.each do |i|
|
33
|
-
self.data[k] << i['rendered_html']
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
17
|
self.data['site_page'] = page
|
38
18
|
end
|
39
19
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module AttendeasePlugin
|
3
|
+
class SitePageBlocksJson < StaticFile
|
4
|
+
def initialize(site, base, page)
|
5
|
+
@site = site
|
6
|
+
@base = base
|
7
|
+
@dir = page['slug']
|
8
|
+
@name = 'index.json'
|
9
|
+
|
10
|
+
self.process(@name)
|
11
|
+
|
12
|
+
#require 'pry'
|
13
|
+
#binding.pry
|
14
|
+
#self.read_yaml(File.join(base, '_attendease', 'templates', 'pages'), 'default.html')
|
15
|
+
self.read_yaml(File.join(base, '_layouts'), "#{page['layout']}.html")
|
16
|
+
|
17
|
+
self.data['title'] = page['title']
|
18
|
+
self.data['layout'] = page['layout']
|
19
|
+
|
20
|
+
zones = {}
|
21
|
+
|
22
|
+
# create zone buckets
|
23
|
+
page['block_instances'].each do |i|
|
24
|
+
zones[i['zone']] = [] if zones[i['zone']].nil?
|
25
|
+
zones[i['zone']] << i
|
26
|
+
end
|
27
|
+
|
28
|
+
# sort each bucket by widget weight
|
29
|
+
zones.each do |k, zone|
|
30
|
+
zone.sort! { |x, y| y['weight'] <=> x['weight'] }
|
31
|
+
self.data[k] = ''
|
32
|
+
zone.each do |i|
|
33
|
+
self.data[k] << i['rendered_html']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
self.data['site_page'] = page
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -6,6 +6,31 @@ module Jekyll
|
|
6
6
|
def generate(site)
|
7
7
|
site.config['attendease']['pages'].each do |page|
|
8
8
|
site.pages << SitePage.new(site, site.source, page)
|
9
|
+
|
10
|
+
zones = {}
|
11
|
+
|
12
|
+
if page['block_instances'].length
|
13
|
+
# create zone buckets
|
14
|
+
page['block_instances'].each do |i|
|
15
|
+
zones[i['zone']] = [] if zones[i['zone']].nil?
|
16
|
+
zones[i['zone']] << i
|
17
|
+
end
|
18
|
+
|
19
|
+
# sort each bucket by widget weight
|
20
|
+
zones.each do |k, zone|
|
21
|
+
zone.sort! { |x, y| y['weight'] <=> x['weight'] }
|
22
|
+
end
|
23
|
+
|
24
|
+
page_source_path = File.join(site.source, page['slug'])
|
25
|
+
FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)
|
26
|
+
|
27
|
+
File.open(File.join(page_source_path, 'index.json'), 'w') do |f|
|
28
|
+
f.write zones.to_json
|
29
|
+
f.close
|
30
|
+
end
|
31
|
+
|
32
|
+
site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), 'index.json')
|
33
|
+
end
|
9
34
|
end
|
10
35
|
end
|
11
36
|
end
|
@@ -14,4 +14,11 @@ RSpec.describe Jekyll::AttendeasePlugin::SitePagesGenerator do
|
|
14
14
|
expect(File.exists?(file)).to eq(true)
|
15
15
|
expect(File.file?(file)).to eq(true)
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'creates a block instance json file using the provided slug' do
|
19
|
+
slug = @site.data['pages'].last['slug']
|
20
|
+
file = File.join(@site.config['destination'], slug, 'index.json')
|
21
|
+
expect(File.exists?(file)).to eq(true)
|
22
|
+
expect(File.file?(file)).to eq(true)
|
23
|
+
end
|
17
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-attendease
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.25d
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Wood
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- lib/jekyll/attendease_plugin/schedule_session_page.rb
|
181
181
|
- lib/jekyll/attendease_plugin/schedule_sessions_page.rb
|
182
182
|
- lib/jekyll/attendease_plugin/site_page.rb
|
183
|
+
- lib/jekyll/attendease_plugin/site_page_blocks_json.rb
|
183
184
|
- lib/jekyll/attendease_plugin/site_pages_generator.rb
|
184
185
|
- lib/jekyll/attendease_plugin/sponsor_generator.rb
|
185
186
|
- lib/jekyll/attendease_plugin/sponsors_index_page.rb
|