jekyll-attendease 0.6.26g → 0.6.26j

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3801098fe322dcb018ebf7f94f9b5941f15945a0
4
- data.tar.gz: 52b883649eee0224f7417f92560c7074e91208b4
3
+ metadata.gz: cd03907bc1e4684082076948f5d797fac51191a8
4
+ data.tar.gz: 04d35d69866ef8e45284ea365d0147b087b82aa4
5
5
  SHA512:
6
- metadata.gz: 23381e4b92c34d2b4266e00ac1c82f903fb0f00e0bb96f73e723a529d630788f2daab60ee065fa17d319b69a7befc176eb2e1871127f554738ef0ab8de3cdffa
7
- data.tar.gz: 2f37f4bf699298e532996a17a06adadd53ce58648f2be3d22676635db6efb07ad5ec098dfec5a2afad022d360d6e7c77ba5ad032bf8c3c3dbe0bd7bcc00c5840
6
+ metadata.gz: f068a309df08a10113ddf0e0dc826e5c53ad1cdefc9b0b92906e8234a99e34951d2f0273170073cbc9a2eb2f6a190ca88c4fcbb0e8063f06472797e1239ddd40
7
+ data.tar.gz: 35fb2f473b63a2afa85cb1ebfd3a51ce8a467a841aff7183345b6c13f00791e481920d2c3972ad32a6f6d107a339a786e67619db6956a3d08b01476046df6345
@@ -96,8 +96,9 @@ module Jekyll
96
96
  site.data[File.basename(filename, '.*')] = data
97
97
 
98
98
  if data.is_a?(Hash)
99
+ # DEPRECATED
99
100
  if filename == 'site.json'
100
- # Adding to site config so we can access these variables globally wihtout using a Liquid Tag so we can use if/else
101
+ # Adding to site config so we can access these variables globally without using a Liquid Tag so we can use if/else
101
102
  site.config['attendease']['data'] = {}
102
103
 
103
104
  data.keys.each do |tag|
@@ -142,5 +142,70 @@ module Jekyll
142
142
  end
143
143
  end
144
144
  end
145
+
146
+ class BlockRendererTag < Liquid::Tag
147
+ def initialize(tag_name, url_override, tokens)
148
+ super
149
+ @url_override = url_override
150
+ end
151
+
152
+ def render(context)
153
+ config = context.registers[:site].config['attendease']
154
+ #data = context.registers[:site].data
155
+ env = config['environment']
156
+
157
+ if config['mode'] == 'organization'
158
+ script = <<_EOT
159
+ <script type="text/javascript">
160
+ (function(w) {
161
+ w.AttendeaseConstants = {
162
+ locale: "en",
163
+ orgApiEndpoint: "#{ config['api_host'] }api",
164
+ orgId: "#{ config['source_id'] }",
165
+ authApiEndpoint: "#{ config['auth_host'] }",
166
+ orgLocales: #{ config['available_portal_locales'] }
167
+ }
168
+ })(window)
169
+ </script>
170
+
171
+ _EOT
172
+ else
173
+ script = <<_EOT
174
+ <script type="text/javascript">
175
+ (function(w) {
176
+ w.AttendeaseConstants = {
177
+ locale: "#{ config['locale'] }",
178
+ eventApiEndpoint: "#{ config['api_host'] }api",
179
+ eventId: "#{ config['source_id'] }",
180
+ orgApiEndpoint: "#{ config['organization_url'] }api",
181
+ orgId: "#{ config['organization_id'] }",
182
+ authApiEndpoint: "#{ config['auth_host'] }"
183
+ }
184
+ })(window)
185
+ </script>
186
+
187
+ _EOT
188
+ end
189
+
190
+ if @url_override.match(/^(https:)?\/\/.+/)
191
+ url = @url_override
192
+ else
193
+ case env
194
+ when 'development'
195
+ url = '//dashboard.localhost.attendease.com/webpack_assets/blockrenderer.bundle.js'
196
+ when 'preview'
197
+ url = '//cdn.attendease.com/blockrenderer/ci-latest.js'
198
+ else
199
+ url = '//dashboard.attendease.com/webpack_assets/blockrenderer.bundle.js'
200
+ end
201
+ end
202
+
203
+ script << <<_EOT
204
+ <script type="text/javascript" src="#{ url }"></script>
205
+ _EOT
206
+
207
+ script
208
+ end
209
+ end
145
210
  end
146
211
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AttendeasePlugin
3
- VERSION = '0.6.26g'
3
+ VERSION = '0.6.26j'
4
4
  end
5
5
  end
@@ -15,5 +15,6 @@ Liquid::Template.register_tag('attendease_auth_action', Jekyll::AttendeaseP
15
15
  Liquid::Template.register_tag('attendease_t', Jekyll::AttendeasePlugin::TranslateTag)
16
16
  Liquid::Template.register_tag('attendease_nav', Jekyll::AttendeasePlugin::NavigationTag)
17
17
  Liquid::Template.register_tag('attendease_portal_nav', Jekyll::AttendeasePlugin::PortalNavigationTag)
18
+ Liquid::Template.register_tag('attendease_block_renderer', Jekyll::AttendeasePlugin::BlockRendererTag)
18
19
 
19
20
  Liquid::Template.register_filter(Jekyll::AttendeasePlugin::Filters)
@@ -5,6 +5,8 @@ RSpec.describe "Jekyll Attendease tags" do
5
5
  let(:cms_site) { build_site({ 'attendease' => { 'jekyll33' => true } }) }
6
6
  let(:context) { { :registers => { :site => site, :page => {} } } }
7
7
  let(:cms_context) { { :registers => { :site => cms_site, :page => {} } } }
8
+ let(:org_site) { build_org_site }
9
+ let(:org_context) { { :registers => { :site => org_site, :page => {} } } }
8
10
 
9
11
  def render(content)
10
12
  ::Liquid::Template.parse(content).render({}, context)
@@ -14,6 +16,10 @@ RSpec.describe "Jekyll Attendease tags" do
14
16
  ::Liquid::Template.parse(content).render({}, cms_context)
15
17
  end
16
18
 
19
+ def org_render(content)
20
+ ::Liquid::Template.parse(content).render({}, org_context)
21
+ end
22
+
17
23
  context "{% attendease_auth_script %}" do
18
24
  subject { render("{% attendease_auth_script %}") }
19
25
  it { is_expected.to include "assets/attendease_event/auth.js" }
@@ -74,6 +80,40 @@ RSpec.describe "Jekyll Attendease tags" do
74
80
  # hidden page
75
81
  it { is_expected.to_not match(/<li><a href="\/test\/"/) }
76
82
  end
83
+
84
+ context "{% attendease_block_renderer %} for event" do
85
+ subject { render("{% attendease_block_renderer %}") }
86
+
87
+ it { is_expected.to match(/window.AttendeaseConstants.locale = "en";/) }
88
+ it { is_expected.to match(/window.AttendeaseConstants.eventApiEndpoint = "https:\/\/foobar\/api";/) }
89
+ it { is_expected.to match(/window.AttendeaseConstants.eventId = "foobar";/) }
90
+ it { is_expected.to match(/window.AttendeaseConstants.orgApiEndpoint = "https:\/\/foobar\.org\/api";/) }
91
+ it { is_expected.to match(/window.AttendeaseConstants.orgId = "batbaz";/) }
92
+ it { is_expected.to match(/window.AttendeaseConstants.authApiEndpoint = "https:\/\/foobar.auth\/";/) }
93
+ it { is_expected.to match(/dashboard.attendease.com\/webpack_assets\/blockrenderer.bundle.js/) }
94
+ it { is_expected.to_not match(/window.AttendeaseConstants.orgLocales/) }
95
+ end
96
+
97
+ context "{% attendease_block_renderer %} with custom bundle URL" do
98
+ subject { render("{% attendease_block_renderer https://foobar.cdn/blockrenderer.js %}") }
99
+
100
+ it { is_expected.to match(/https:\/\/foobar.cdn\/blockrenderer.js/) }
101
+ end
102
+
103
+ context "{% attendease_block_renderer %} for an org portal" do
104
+ subject { org_render("{% attendease_block_renderer %}") }
105
+
106
+ it { is_expected.to match(/window.AttendeaseConstants.locale = "en";/) }
107
+ it { is_expected.to match(/window.AttendeaseConstants.orgApiEndpoint = "https:\/\/foobar\/api";/) }
108
+ it { is_expected.to match(/window.AttendeaseConstants.orgId = "foobar";/) }
109
+ it { is_expected.to match(/window.AttendeaseConstants.authApiEndpoint = "https:\/\/foobar.auth\/";/) }
110
+ it { is_expected.to match(/dashboard.attendease.com\/webpack_assets\/blockrenderer.bundle.js/) }
111
+ it { is_expected.to match(/window.AttendeaseConstants.orgLocales = \["en", "fr", "it", "es", "de"\];/) }
112
+
113
+ it { is_expected.to_not match(/window.AttendeaseConstants.eventApiEndpoint/) }
114
+ it { is_expected.to_not match(/window.AttendeaseConstants.eventId/) }
115
+ end
116
+
77
117
  end
78
118
 
79
119
  def schedule_widget_data
data/spec/spec_helper.rb CHANGED
@@ -76,13 +76,21 @@ RSpec.configure do |config|
76
76
  'source' => fixtures_path.to_s,
77
77
  'destination' => dest.to_s,
78
78
  'attendease' => {
79
- 'api_host' => 'https://foobar/',
80
- 'has_sessions' => true,
81
- 'has_presenters' => true,
82
- 'has_sponsors' => true,
83
- 'has_rooms' => true,
84
- 'has_filters' => true,
85
- 'has_venues' => true
79
+ 'api_host' => 'https://foobar/',
80
+ 'has_sessions' => true,
81
+ 'has_presenters' => true,
82
+ 'has_sponsors' => true,
83
+ 'has_rooms' => true,
84
+ 'has_filters' => true,
85
+ 'has_venues' => true,
86
+ 'environment' => 'test',
87
+ 'locale' => 'en',
88
+ 'source_id' => 'foobar',
89
+ 'auth_host' => 'https://foobar.auth/',
90
+ 'organization_url' => 'https://foobar.org/',
91
+ 'organization_id' => 'batbaz',
92
+ 'organization_name' => 'Foo Bar Widgets',
93
+ 'available_portal_locales' => %w{ en fr it es de }
86
94
  }
87
95
  }), overrides)
88
96
  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.26g
4
+ version: 0.6.26j
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood
@@ -183,7 +183,6 @@ files:
183
183
  - lib/jekyll/attendease_plugin/schedule_session_page.rb
184
184
  - lib/jekyll/attendease_plugin/schedule_sessions_page.rb
185
185
  - lib/jekyll/attendease_plugin/site_page.rb
186
- - lib/jekyll/attendease_plugin/site_page_blocks_json.rb
187
186
  - lib/jekyll/attendease_plugin/site_pages_generator.rb
188
187
  - lib/jekyll/attendease_plugin/sponsor_generator.rb
189
188
  - lib/jekyll/attendease_plugin/sponsors_index_page.rb
@@ -1,42 +0,0 @@
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| x['weight'] <=> y['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
-