jekyll-attendease 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75b3ac6437c60cf1f0e8ff306bbe434f5579a0ed
4
- data.tar.gz: 3332793ac437f20cb1410d4a6b0e137159704459
3
+ metadata.gz: 4f867f34c0e4cc4dabc62736cce3090ff8704f69
4
+ data.tar.gz: 3762e813ed104e03303573e54c66e811bc01b79c
5
5
  SHA512:
6
- metadata.gz: 0574338faeb230b0e75c5d0819fa230a50cb046a35333cedc12db1f9979ab21fb6a767cb7d58ad83080a092938b01ba2c4718d49a67f359eff3a88a87edd6a6c
7
- data.tar.gz: 141efa54efae2155d2ca03a8a8720152e5e8efd571ef14dec857023d85cd251b7cb561ae8db418cede98c0f5fa477af34d6d3a2ffb07ee58a5167feb8498dfd8
6
+ metadata.gz: ff901e6c108f5552659bdb976d175833ba5d3b064c74310705290188e2cb4b43be28b195ed5a29376b787fd25818b645af088093d0bff430b4e233ab2ad1fbcb
7
+ data.tar.gz: 58a84db46c4bff9098325473b0da0f9f47d16364209b97d5426d45005edac6bcf9250d1a9c060a62f0e88db6776f0e7c49011eedf8828ea110c661d825f90a67
@@ -1,5 +1,6 @@
1
1
  require 'httparty'
2
2
  require 'json'
3
+ require 'i18n'
3
4
 
4
5
  module Jekyll
5
6
  module Attendease
@@ -35,7 +36,7 @@ module Jekyll
35
36
 
36
37
  FileUtils.mkdir_p(@attendease_data_path)
37
38
 
38
- data_files = ['site.json', 'event.json', 'sessions.json', 'presenters.json', 'rooms.json', 'filters.json', 'venues.json']
39
+ data_files = ['site.json', 'event.json', 'sessions.json', 'presenters.json', 'rooms.json', 'filters.json', 'venues.json', 'lingo.json', 'lingo.yml']
39
40
 
40
41
  data_files.each do |file_name|
41
42
  update_data = true
@@ -44,9 +45,13 @@ module Jekyll
44
45
  if (Time.now.to_i - File.mtime("#{@attendease_data_path}/#{file_name}").to_i) <= (@attendease_config['cache_expiry'].nil? ? 30 : @attendease_config['cache_expiry']) # file is less than 30 seconds old
45
46
  update_data = false
46
47
 
47
- json = File.read("#{@attendease_data_path}/#{file_name}")
48
+ if file_name.match(/json$/)
49
+ json = File.read("#{@attendease_data_path}/#{file_name}")
48
50
 
49
- data = JSON.parse(json)
51
+ data = JSON.parse(json)
52
+ else
53
+ data = File.read("#{@attendease_data_path}/#{file_name}")
54
+ end
50
55
  end
51
56
  end
52
57
 
@@ -54,15 +59,22 @@ module Jekyll
54
59
  options = {}
55
60
  options.merge!(:headers => {'X-Event-Token' => @attendease_config['access_token']}) if @attendease_config['access_token']
56
61
 
57
- data = get("#{@attendease_config['api_host']}api/#{file_name}", options)
62
+ request_filename = file_name.gsub(/yml$/, 'yaml')
63
+ data = get("#{@attendease_config['api_host']}api/#{request_filename}", options)
58
64
 
59
- if (data.is_a?(Hash) && !data['error']) || data.is_a?(Array)
65
+ #if (file_name.match(/yaml$/) || data.is_a?(Hash) && !data['error']) || data.is_a?(Array)
66
+ if (data.response.is_a?(Net::HTTPOK))
60
67
  puts "" if file_name == 'site.json' # leading space, that's all.
61
68
  puts " [Attendease] Saving #{file_name} data..."
62
69
 
63
- File.open("#{@attendease_data_path}/#{file_name}", 'w+') { |file| file.write(data.parsed_response.to_json) }
70
+
71
+ if file_name.match(/json$/)
72
+ File.open("#{@attendease_data_path}/#{file_name}", 'w+') { |file| file.write(data.parsed_response.to_json) }
73
+ else
74
+ File.open("#{@attendease_data_path}/#{file_name}", 'w+') { |file| file.write(data.body) }
75
+ end
64
76
  else
65
- raise "Event data not found, is your Attendease api_host site properly in _config.yml?"
77
+ raise "Request failed for #{@attendease_config['api_host']}api/#{request_filename}. Is your Attendease api_host site properly in _config.yml?"
66
78
  end
67
79
  end
68
80
 
@@ -150,6 +162,26 @@ module Jekyll
150
162
  end
151
163
  end
152
164
 
165
+ class AttendeaseTranslateTag < Liquid::Tag
166
+ def initialize(tag_name, params, tokens)
167
+ super
168
+ @args = split_params(params)
169
+ end
170
+
171
+ def split_params(params)
172
+ params.split(",").map(&:strip)
173
+ end
174
+
175
+ def render(context)
176
+ I18n::Backend::Simple.include(I18n::Backend::Pluralization)
177
+ I18n.enforce_available_locales = false
178
+ i18n_path = File.join(context.registers[:site].config['source'], '_attendease_data', 'lingo.yml')
179
+ I18n.load_path << i18n_path unless I18n.load_path.include?(i18n_path)
180
+ I18n.locale = context.registers[:page]['lang'] || context.registers[:site].config['attendease']['lang'] || :en
181
+ I18n.t(@args[0], :count => context['t_size'].nil? ? 0 : context['t_size'].to_i)
182
+ end
183
+ end
184
+
153
185
  class AttendeaseAuthAccountTag < Liquid::Tag
154
186
  def render(context)
155
187
  '<div id="attendease-auth-account"></div>'
@@ -551,3 +583,4 @@ Liquid::Template.register_tag('attendease_scheduler_script', Jekyll::Attendease:
551
583
  Liquid::Template.register_tag('attendease_locales_script', Jekyll::Attendease::AttendeaseLocalesScriptTag)
552
584
  Liquid::Template.register_tag('attendease_auth_account', Jekyll::Attendease::AttendeaseAuthAccountTag)
553
585
  Liquid::Template.register_tag('attendease_auth_action', Jekyll::Attendease::AttendeaseAuthActionTag)
586
+ Liquid::Template.register_tag('t', Jekyll::Attendease::AttendeaseTranslateTag)
@@ -23,7 +23,10 @@
23
23
  </div>
24
24
 
25
25
  <div class="attendease-sessions">
26
- <h2>Sessions</h2>
26
+ {% if site.attendease.data.event_session_times_heading == true %}
27
+ {% assign t_size = page.presenter.sessions.size %}
28
+ <h2 class="attendease-sessions-heading">{% t event.lingo.sessions %}</h2>
29
+ {% endif %}
27
30
 
28
31
  {% for session in page.presenter.sessions %}
29
32
  <div class="attendease-session-and-instances" data-session-id="{{ session.id }}">
@@ -68,4 +71,4 @@
68
71
  {% endfor %}
69
72
 
70
73
  </div>
71
- </div>
74
+ </div>
@@ -4,12 +4,17 @@
4
4
  <h1>{{ page.session.name }}</h1>
5
5
  </div>
6
6
 
7
+ {% if site.attendease.data.event_session_description_first == true %}
7
8
  <div class="attendease-description">
8
9
  {{ page.session.description | markdownify }}
9
10
  </div>
11
+ {% endif %}
10
12
 
11
13
  <div class="attendease-instances attendease-meta-item">
12
- <h2>Times</h2>
14
+ {% if site.attendease.data.event_session_times_heading == true %}
15
+ {% assign t_size = page.session.instances.size %}
16
+ <h2 class="attendease-times-heading">{% t event.lingo.times %}</h2>
17
+ {% endif %}
13
18
 
14
19
  {% for instance in page.session.instances %}
15
20
  <div class="attendease-instance" data-instance-id="{{ instance.id }}">
@@ -43,11 +48,21 @@
43
48
  {% endfor %}
44
49
 
45
50
  </div>
51
+
52
+ {% if site.attendease.data.event_session_description_first != true %}
53
+ <div class="attendease-description">
54
+ {{ page.session.description | markdownify }}
55
+ </div>
56
+ {% endif %}
57
+
46
58
  </div>
47
59
 
48
60
  <div class="attendease-session-meta">
49
61
  <div class="attendease-presenters attendease-meta-item">
50
- <h2>Presenters</h2>
62
+ {% if site.attendease.data.event_session_presenters_heading == true %}
63
+ {% assign t_size = page.session.presenters.size %}
64
+ <h2 class="attendease-presenter-heading">{% t event.lingo.presenters %}</h2>
65
+ {% endif %}
51
66
 
52
67
  {% for presenter in page.session.presenters %}
53
68
  <div class="attendease-presenter" data-presenter-id="{{ presenter.id }}">
@@ -72,7 +87,10 @@
72
87
  </div>
73
88
 
74
89
  <div class="attendease-filters attendease-meta-item">
75
- <h2>Tags</h2>
90
+ {% if site.attendease.data.event_session_filters_heading == true %}
91
+ {% assign t_size = page.session.filters.size %}
92
+ <h2 class="attendease-filter-heading">{% t event.lingo.filters %}</h2>
93
+ {% endif %}
76
94
 
77
95
  {% for filter in page.session.filters %}
78
96
  <div class="attendease-filter">
@@ -90,4 +108,4 @@
90
108
  {% endfor %}
91
109
  </div>
92
110
  </div>
93
- </div>
111
+ </div>
@@ -1,6 +1,7 @@
1
1
  <div class="attendease-schedule">
2
2
  <div class="attendease-header">
3
- <h1>Sessions</h1>
3
+ {% assign t_size = page.session.size %}
4
+ <h1>{% t event.lingo.sessions %}</h2>
4
5
  </div>
5
6
 
6
7
  {% for session in page.sessions %}
@@ -20,4 +21,4 @@
20
21
  </div>
21
22
  {% endfor %}
22
23
 
23
- </div>
24
+ </div>
@@ -1,6 +1,7 @@
1
1
  <div class="attendease-venues">
2
2
  <div class="attendease-header">
3
- <h1>Venues</h1>
3
+ {% assign t_size = page.venues.size %}
4
+ <h1>{% t event.lingo.venues %}</h2>
4
5
  </div>
5
6
 
6
7
  {% for venue in page.venues %}
@@ -41,4 +42,4 @@
41
42
 
42
43
  </div>
43
44
  {% endfor %}
44
- </div>
45
+ </div>
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.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-29 00:00:00.000000000 Z
13
+ date: 2014-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -40,6 +40,20 @@ dependencies:
40
40
  - - '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: i18n
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
43
57
  description: Bring your event data into Jekyll for amazing event websites.
44
58
  email: support@attendease.com
45
59
  executables: []
@@ -58,7 +72,8 @@ files:
58
72
  - templates/_includes/attendease/venues/index.html
59
73
  - templates/_includes/attendease/venues/venue.html
60
74
  homepage: https://attendease.com/
61
- licenses: []
75
+ licenses:
76
+ - MIT
62
77
  metadata: {}
63
78
  post_install_message:
64
79
  rdoc_options: []