jekyll-attendease 0.6.43.3 → 0.6.44b
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/helpers.rb +21 -1
- data/lib/jekyll/attendease_plugin/tags.rb +2 -36
- data/lib/jekyll/attendease_plugin/version.rb +1 -1
- data/spec/lib/jekyll/attendease_plugin/helpers_spec.rb +44 -1
- data/spec/lib/jekyll/attendease_plugin/tags_spec.rb +16 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e03d31c7ddea1090c096541f92f9a3689449431a
|
4
|
+
data.tar.gz: 3016f4e2680178023dbcc678ea14e5b583c750f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ca2980db60b358afb8e18fef67b2983e64e86b0827401584a2a261a3bee3549beece2cf06eb470dc2ad3b527f2d5e64477a68f6876e5a6c679c49460a6eb8da
|
7
|
+
data.tar.gz: 4aa473baa8f564fec7085feaa28e467f1a3cc8f0914c5121ff0454d5f30d6c5e9ff4d628323f2f65d8d246ae3385253c9161ad63617cc0aa24373e9f9b00bc2d
|
@@ -35,7 +35,27 @@ module Jekyll
|
|
35
35
|
'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u',
|
36
36
|
'ý' => 'y', 'ÿ' => 'y' }
|
37
37
|
s.encode('ASCII',
|
38
|
-
|
38
|
+
fallback: lambda { |c| fallback.key?(c) ? fallback[c] : undefined })
|
39
|
+
end
|
40
|
+
|
41
|
+
PAGE_KEYS = %w[id name href weight root children parent].freeze
|
42
|
+
|
43
|
+
# filter the raw pages for what's safe to make public
|
44
|
+
def self.public_pages(pages)
|
45
|
+
pages
|
46
|
+
.select { |p| p['root'] }
|
47
|
+
.reject { |p| p['hidden'] && (p['slug'] != '' || p['external'] == true) }
|
48
|
+
.map do |page|
|
49
|
+
page = page.select { |key| PAGE_KEYS.include?(key) }
|
50
|
+
|
51
|
+
page['children'] = page['children']
|
52
|
+
.reject { |p| p['hidden'] }
|
53
|
+
.map { |child| child.select { |key| PAGE_KEYS.include?(key) } }
|
54
|
+
.sort_by { |p| p['weight'] }
|
55
|
+
|
56
|
+
page
|
57
|
+
end
|
58
|
+
.sort_by { |p| p['weight'] }
|
39
59
|
end
|
40
60
|
end
|
41
61
|
end
|
@@ -163,43 +163,9 @@ module Jekyll
|
|
163
163
|
|
164
164
|
parent_pages_are_clickable = config['parent_pages_are_clickable']
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
pages = {}
|
169
|
-
pages = context.registers[:site].data['pages']
|
170
|
-
.select { |p| p['root'] }
|
171
|
-
.reject { |p| p['hidden'] }
|
172
|
-
.map do |page|
|
173
|
-
page = page.select { |key| page_keys.include?(key) }
|
174
|
-
|
175
|
-
page['children'] = page['children']
|
176
|
-
.reject { |p| p['hidden'] }
|
177
|
-
.map { |child| child.select { |key| page_keys.include?(key) } }
|
178
|
-
.sort_by { |p| p['weight'] }
|
179
|
-
|
180
|
-
page
|
181
|
-
end
|
182
|
-
.sort_by { |p| p['weight'] }
|
183
|
-
|
184
|
-
portal_pages = {}
|
185
|
-
if (context.registers[:site].data['portal_pages'])
|
186
|
-
portal_pages = context.registers[:site].data['portal_pages']
|
187
|
-
.select { |p| p['root'] }
|
188
|
-
.reject { |p| p['hidden'] }
|
189
|
-
.map do |page|
|
190
|
-
page = page.select { |key| page_keys.include?(key) }
|
191
|
-
|
192
|
-
page['children'] = page['children']
|
193
|
-
.reject { |p| p['hidden'] }
|
194
|
-
.map { |child| child.select { |key| page_keys.include?(key) } }
|
195
|
-
.sort_by { |p| p['weight'] }
|
196
|
-
|
197
|
-
page
|
198
|
-
end
|
199
|
-
.sort_by { |p| p['weight'] }
|
200
|
-
end
|
201
|
-
|
166
|
+
pages = Helpers.public_pages(context.registers[:site].data['pages'])
|
202
167
|
|
168
|
+
portal_pages = Helpers.public_pages(context.registers[:site].data['portal_pages']) || []
|
203
169
|
env = config['environment']
|
204
170
|
|
205
171
|
# IMPORTANT NOTE: The script variables below must NOT be changed without making sure that blockrenderer.js and other
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
RSpec.describe Jekyll::AttendeasePlugin::Helpers do
|
5
|
-
|
5
|
+
describe '#parameterize' do
|
6
6
|
it 'converts a typical filter item into a predictable CSS-friendly class name' do
|
7
7
|
expect(Jekyll::AttendeasePlugin::Helpers.parameterize('Super Hyper Advanced', '-')).to eq('super-hyper-advanced')
|
8
8
|
end
|
@@ -23,4 +23,47 @@ RSpec.describe Jekyll::AttendeasePlugin::Helpers do
|
|
23
23
|
expect(Jekyll::AttendeasePlugin::Helpers.parameterize('-, What--the--hell? ::')).to eq('what_the_hell')
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
describe '#convert_to_ascii' do
|
28
|
+
it 'converts accented characters to plain letters' do
|
29
|
+
expect(Jekyll::AttendeasePlugin::Helpers.convert_to_ascii('café')).to eq('cafe')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#public_pages' do
|
34
|
+
let(:pages) { JSON.parse(File.read(fixtures_path.join('_attendease', 'data', 'pages.json'))) }
|
35
|
+
let(:public_pages) { Jekyll::AttendeasePlugin::Helpers.public_pages(pages) }
|
36
|
+
let(:all_pages_hidden) do
|
37
|
+
hidden_pages = pages.map { |p| p['hidden'] = true; p }
|
38
|
+
Jekyll::AttendeasePlugin::Helpers.public_pages(hidden_pages)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'sorts pages by weight' do
|
42
|
+
expect(public_pages[0]['weight']).to eq(0)
|
43
|
+
expect(public_pages[0]['href']).to eq('/')
|
44
|
+
|
45
|
+
expect(public_pages[1]['weight']).to eq(1)
|
46
|
+
expect(public_pages[1]['href']).to eq('/product/')
|
47
|
+
|
48
|
+
expect(public_pages[2]['weight']).to eq(2)
|
49
|
+
expect(public_pages[2]['href']).to eq('/agenda/')
|
50
|
+
|
51
|
+
expect(public_pages[3]['weight']).to eq(3)
|
52
|
+
expect(public_pages[3]['href']).to eq('/sponsors/')
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'sorts children by weight' do
|
56
|
+
expect(public_pages[1]['children'][0]['name']).to eq('Product Child 2')
|
57
|
+
expect(public_pages[1]['children'][1]['name']).to eq('Product Child 1')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'publishes the home page regardless of hidden status' do
|
61
|
+
expect(all_pages_hidden.length).to eq(1)
|
62
|
+
expect(all_pages_hidden[0]['href']).to eq('/')
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'only has the declared keys in each page object' do
|
66
|
+
expect(public_pages[0].keys.length).to eq(7)
|
67
|
+
end
|
68
|
+
end
|
26
69
|
end
|
@@ -83,16 +83,22 @@ RSpec.describe "Jekyll Attendease tags" do
|
|
83
83
|
|
84
84
|
context "{% attendease_block_renderer %} for event" do
|
85
85
|
subject { render("{% attendease_block_renderer %}") }
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
86
|
+
let(:foo) { render("{% attendease_block_renderer %}") }
|
87
|
+
|
88
|
+
describe 'expected output' do
|
89
|
+
require 'pry'
|
90
|
+
|
91
|
+
|
92
|
+
it { binding.pry; is_expected.to match(/locale: "en"/) }
|
93
|
+
it { is_expected.to match(/siteName: "My Attendease Test Event"/) }
|
94
|
+
it { is_expected.to match(/eventApiEndpoint: "https:\/\/foobar\/api"/) }
|
95
|
+
it { is_expected.to match(/eventId: "foobar"/) }
|
96
|
+
it { is_expected.to match(/orgURL: "https:\/\/foobar.org\/"/) }
|
97
|
+
it { is_expected.to match(/orgId: "batbaz"/) }
|
98
|
+
it { is_expected.to match(/authApiEndpoint: "https:\/\/foobar.auth\/api"/) }
|
99
|
+
it { is_expected.to match(/dashboard.attendease.com\/webpack_assets\/blockrenderer.bundle.js/) }
|
100
|
+
it { is_expected.to_not match(/orgLocales/) }
|
101
|
+
end
|
96
102
|
end
|
97
103
|
|
98
104
|
context "{% attendease_block_renderer %} with custom bundle URL" do
|
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.44b
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Wood
|
@@ -234,12 +234,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
234
|
version: '0'
|
235
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
236
|
requirements:
|
237
|
-
- - "
|
237
|
+
- - ">"
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
239
|
+
version: 1.3.1
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.2
|
242
|
+
rubygems_version: 2.5.2
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Attendease event helper for Jekyll
|