jekyll-open-sdg-plugins 1.2.0.pre.beta1 → 1.2.0.pre.beta2

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
  SHA256:
3
- metadata.gz: 714570ee0a7ab38905c524b6fad9c1590340e09052778c82adc543574d11e7ac
4
- data.tar.gz: ed6ee32ba2cb547dd8f46159fb133197b044fc101c0d00af12662cf78a245872
3
+ metadata.gz: c83cab37937dfcf97c1bfbef8746287e6297755250e89c7a6e5e45edfbc366d5
4
+ data.tar.gz: 8fee68ec2cff47f46d217c12f97af1b1953d1bef5eae6020937345d69c641859
5
5
  SHA512:
6
- metadata.gz: 2c5862fc0ffd6241ef72f92d15e72f5a0dc4fe682a8b0a9cfe80e418968b1eadfa0aa5fa7c5ea83e82b2ebe441535d3c8e77283b7925d9ce83f491b7bcf7f99d
7
- data.tar.gz: 789bb89817ceb676ab5eaac06411435030a6fcdf24dd4ad5c0529fa7cfadac27d5dcd91670f5894fdc983220e9cd6a04324309fee46bb747c93996e561a79821
6
+ metadata.gz: 87d899fbed0085ac3b376251ba97189415b685c5673b6d1096eb48db87898e2ae54d32f8757b16d59f3b96e7a9994d183ffa68bcac3ab2164865cf6a77190ebc
7
+ data.tar.gz: d54c8b23f83c63bbded2cb46f77358756f61d37164839a800f7c615af07446693368fa80873ad7d81bc69b7384540ca407658770550bc5716a009dfecf68a123
@@ -8,7 +8,7 @@ module JekyllOpenSdgPlugins
8
8
 
9
9
  def generate(site)
10
10
  # If site.create_goals is set, create goals per the metadata.
11
- if site.config['languages'] and site.config['create_goals']
11
+ if site.config['languages'] and site.config['create_goals'] and site.config['create_goals'].key?('layout') and site.config['create_goals']['layout'] != ''
12
12
  # Compile the list of goals.
13
13
  goals = {}
14
14
  # Are we using translated builds?
@@ -27,10 +27,7 @@ module JekyllOpenSdgPlugins
27
27
  goals[goal] = true
28
28
  end
29
29
  # Decide what layout to use for the goal pages.
30
- layout = 'goal'
31
- if site.config['create_goals'].key?('layout')
32
- layout = site.config['create_goals']['layout']
33
- end
30
+ layout = site.config['create_goals']['layout']
34
31
  # See if we need to "map" any language codes.
35
32
  languages_public = Hash.new
36
33
  if site.config['languages_public']
@@ -8,12 +8,9 @@ module JekyllOpenSdgPlugins
8
8
 
9
9
  def generate(site)
10
10
  # If site.create_indicators is set, create indicators per the metadata.
11
- if site.config['languages'] and site.config['create_indicators']
11
+ if site.config['languages'] and site.config['create_indicators'] and site.config['create_indicators'].key?('layout') and site.config['create_indicators']['layout'] != ''
12
12
  # Decide what layout to use for the indicator pages.
13
- layout = 'indicator'
14
- if site.config['create_indicators'].key?('layout')
15
- layout = site.config['create_indicators']['layout']
16
- end
13
+ layout = site.config['create_indicators']['layout']
17
14
  # See if we need to "map" any language codes.
18
15
  languages_public = Hash.new
19
16
  if site.config['languages_public']
@@ -44,33 +41,35 @@ module JekyllOpenSdgPlugins
44
41
  end
45
42
  end
46
43
  # Create the indicator configuration pages.
47
- metadata = {}
48
- if opensdg_translated_builds(site)
49
- if site.data.has_key?('untranslated')
50
- metadata = site.data['untranslated']['meta']
44
+ if site.config['create_config_forms'] && site.config['create_config_forms'].key?('layout') && site.config['create_config_forms']['layout'] != ''
45
+ metadata = {}
46
+ layout = site.config['create_config_forms']['layout']
47
+ if opensdg_translated_builds(site)
48
+ if site.data.has_key?('untranslated')
49
+ metadata = site.data['untranslated']['meta']
50
+ else
51
+ default_language = site.config['languages'][0]
52
+ metadata = site.data[default_language]['meta']
53
+ end
51
54
  else
52
- default_language = site.config['languages'][0]
53
- metadata = site.data[default_language]['meta']
55
+ metadata = site.data['meta']
54
56
  end
55
- else
56
- metadata = site.data['meta']
57
- end
58
- # Loop through the indicators (using metadata as a list).
59
- if !metadata.empty?
60
- site.config['show_indicator_config_forms'] = true
61
- # Loop through the languages.
62
- site.config['languages'].each_with_index do |language, index|
63
- # Get the "public language" (for URLs) which may be different.
64
- language_public = language
65
- if languages_public[language]
66
- language_public = languages_public[language]
67
- end
68
- metadata.each do |inid, meta|
69
- dir = File.join('config', inid)
70
- if index != 0
71
- dir = File.join(language_public, 'config', inid)
57
+ # Loop through the indicators (using metadata as a list).
58
+ if !metadata.empty?
59
+ # Loop through the languages.
60
+ site.config['languages'].each_with_index do |language, index|
61
+ # Get the "public language" (for URLs) which may be different.
62
+ language_public = language
63
+ if languages_public[language]
64
+ language_public = languages_public[language]
65
+ end
66
+ metadata.each do |inid, meta|
67
+ dir = File.join('config', inid)
68
+ if index != 0
69
+ dir = File.join(language_public, 'config', inid)
70
+ end
71
+ site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, layout)
72
72
  end
73
- site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta)
74
73
  end
75
74
  end
76
75
  end
@@ -98,7 +97,7 @@ module JekyllOpenSdgPlugins
98
97
 
99
98
  # A Page subclass used in the `CreateIndicators` class.
100
99
  class IndicatorConfigPage < Jekyll::Page
101
- def initialize(site, base, dir, inid, language, meta)
100
+ def initialize(site, base, dir, inid, language, meta, layout)
102
101
  @site = site
103
102
  @base = base
104
103
  @dir = dir
@@ -109,7 +108,7 @@ module JekyllOpenSdgPlugins
109
108
  self.data['language'] = language
110
109
  self.data['indicator_number'] = inid.gsub('-', '.')
111
110
  self.data['config_type'] = 'indicator'
112
- self.data['layout'] = 'config-builder'
111
+ self.data['layout'] = layout
113
112
  self.data['meta'] = meta
114
113
  self.data['title'] = 'Open SDG indicator configuration: ' + self.data['indicator_number']
115
114
  self.data['config_filename'] = inid + '.yml'
@@ -67,13 +67,15 @@ module JekyllOpenSdgPlugins
67
67
  # Hardcode the site configuration page if it's not already there.
68
68
  config_page = pages.find { |page| page['layout'] == 'config-builder' }
69
69
  if config_page == nil
70
- pages.push({
71
- 'folder' => '/config',
72
- 'layout' => 'config-builder',
73
- 'title' => 'Open SDG site configuration',
74
- 'config_type' => 'site',
75
- 'config_filename' => 'site_config.yml'
76
- })
70
+ if site.config['create_config_forms'] && site.config['create_config_forms'].key?('layout') && site.config['create_config_forms']['layout'] != ''
71
+ pages.push({
72
+ 'folder' => '/config',
73
+ 'layout' => site.config['create_config_forms']['layout'],
74
+ 'title' => 'Open SDG site configuration',
75
+ 'config_type' => 'site',
76
+ 'config_filename' => 'site_config.yml'
77
+ })
78
+ end
77
79
  end
78
80
 
79
81
  # See if we need to "map" any language codes.
@@ -116,6 +116,30 @@
116
116
  }
117
117
  ]
118
118
  },
119
+ "create_config_forms": {
120
+ "options": {"collapsed": true},
121
+ "type": "object",
122
+ "title": "Create configuration forms",
123
+ "description": "This setting can be used to automatically create the configuration form pages.",
124
+ "properties": {
125
+ "layout": {
126
+ "type": "string",
127
+ "title": "Layout",
128
+ "format": "choices",
129
+ "enum": [
130
+ "",
131
+ "config-builder"
132
+ ],
133
+ "options": {
134
+ "enum_titles": [
135
+ "Do not automatically create config forms",
136
+ "config-builder"
137
+ ]
138
+ },
139
+ "description": "The layout to use for the configuration form pages."
140
+ }
141
+ }
142
+ },
119
143
  "create_goals": {
120
144
  "options": {"collapsed": true},
121
145
  "type": "object",
@@ -125,6 +149,21 @@
125
149
  "layout": {
126
150
  "type": "string",
127
151
  "title": "Layout",
152
+ "format": "choices",
153
+ "enum": [
154
+ "",
155
+ "goal",
156
+ "goal-by-target",
157
+ "goal-by-target-vertical"
158
+ ],
159
+ "options": {
160
+ "enum_titles": [
161
+ "Do not automatically create goals",
162
+ "goal",
163
+ "goal-by-target",
164
+ "goal-by-target-vertical"
165
+ ]
166
+ },
128
167
  "description": "The layout to use for the goal pages."
129
168
  }
130
169
  },
@@ -144,6 +183,17 @@
144
183
  "layout": {
145
184
  "type": "string",
146
185
  "title": "Layout",
186
+ "format": "choices",
187
+ "enum": [
188
+ "",
189
+ "indicator"
190
+ ],
191
+ "options": {
192
+ "enum_titles": [
193
+ "Do not automatically create indicators",
194
+ "indicator"
195
+ ]
196
+ },
147
197
  "description": "The layout to use for the indicator pages."
148
198
  }
149
199
  },
@@ -1,3 +1,3 @@
1
1
  module JekyllOpenSdgPlugins
2
- VERSION = "1.2.0-beta1".freeze
2
+ VERSION = "1.2.0-beta2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-open-sdg-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre.beta1
4
+ version: 1.2.0.pre.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brock Fanning