jekyll-open-sdg-plugins 2.3.0.pre.beta1 → 2.3.0.pre.beta3

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: 19b31bd6706a47dcbf2c07f210aa589639fc8ce67410e3843bb537a200980770
4
- data.tar.gz: 0da1202bfcbb679a36d5e4f2d7438246872743ec6d33e13e7caf6a22ef3476ec
3
+ metadata.gz: 4944fa0ac86eba4e83bf4f3968446d4750af37f341e4f286dfe115faae4119da
4
+ data.tar.gz: 064bdf7b8c764545426078ea071dadc7ee6a0312a90c67f463e66140fd95f37a
5
5
  SHA512:
6
- metadata.gz: ad5b6e143538c031cc803114b93af911c496b471f7ac1310003d5230debb5c79a6b359f15f856700fe534f13f6a310ecbbb57095b612cdc2e62047c9f3ade3b6
7
- data.tar.gz: 656cfd31efc7b480fdba2b798531a308efca2e5bf03853f7b9f4431cc53045408dd81119f90889ec05eecc625b05d57426391a8c75d95b282597fea8b34c2f0b
6
+ metadata.gz: ec3a89e0a127bf08518ac704c4824b35c0b9a02eaa31c44f7bfa65b00362efd6a3a6ce5a87b3ea8578b5ba56c004ca7f323248e42aacf3d8e09a992e739aca7a
7
+ data.tar.gz: 5e5bf4015c3ba53b6d395dd5c3bfd0381813cec35b1a7c2c5d16141ce23e4df79441ac90a8a5d0466fbeb587d7fead29b500406623788b80384001c0812224de
@@ -13,6 +13,10 @@ module JekyllOpenSdgPlugins
13
13
  form_settings_config = site.config['indicator_config_form']
14
14
  form_settings_meta = site.config['indicator_metadata_form']
15
15
  form_settings_data = site.config['indicator_data_form']
16
+ config_builder_layout = 'config-builder'
17
+ #if site.config['use_new_config_forms']
18
+ # config_builder_layout = 'config-builder-2'
19
+ #end
16
20
 
17
21
  translations = site.data['translations']
18
22
  # If site.create_indicators is set, create indicators per the metadata.
@@ -110,7 +114,7 @@ module JekyllOpenSdgPlugins
110
114
  dir = File.join(dir_base, 'config')
111
115
  title = opensdg_translate_key('indicator.edit_configuration', translations, language)
112
116
  config_type = 'indicator'
113
- site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, title, config_type, form_settings_config)
117
+ site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, title, config_type, form_settings_config, config_builder_layout)
114
118
  end
115
119
 
116
120
  if do_indicator_meta_forms
@@ -121,7 +125,7 @@ module JekyllOpenSdgPlugins
121
125
  dir = File.join(dir_base, 'metadata')
122
126
  title = opensdg_translate_key('indicator.edit_metadata', translations, language)
123
127
  config_type = 'metadata'
124
- site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, metadata_to_use, title, config_type, form_settings_meta)
128
+ site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, metadata_to_use, title, config_type, form_settings_meta, config_builder_layout)
125
129
  end
126
130
 
127
131
  if do_indicator_data_forms
@@ -155,7 +159,7 @@ module JekyllOpenSdgPlugins
155
159
 
156
160
  # A Page subclass used in the `CreateIndicators` class for the indicator config forms.
157
161
  class IndicatorConfigPage < Jekyll::Page
158
- def initialize(site, base, dir, inid, language, meta, title, config_type, form_settings)
162
+ def initialize(site, base, dir, inid, language, meta, title, config_type, form_settings, layout)
159
163
  @site = site
160
164
  @base = base
161
165
  @dir = dir
@@ -166,7 +170,7 @@ module JekyllOpenSdgPlugins
166
170
  self.data['language'] = language
167
171
  self.data['indicator_number'] = inid
168
172
  self.data['config_type'] = config_type
169
- self.data['layout'] = 'config-builder'
173
+ self.data['layout'] = layout
170
174
  self.data['meta'] = meta
171
175
  self.data['title'] = title + ': ' + inid.gsub('-', '.')
172
176
  self.data['config_filename'] = inid + '.yml'
@@ -89,11 +89,15 @@ module JekyllOpenSdgPlugins
89
89
  # Hardcode the site configuration page if it's not already there.
90
90
  form_settings = site.config['site_config_form']
91
91
  config_page = pages.find { |page| page['layout'] == 'config-builder' }
92
+ config_builder_layout = 'config-builder'
93
+ if site.config['use_new_config_forms']
94
+ config_builder_layout = 'config-builder-2'
95
+ end
92
96
  if config_page == nil
93
97
  if form_settings && form_settings['enabled']
94
98
  pages.push({
95
99
  'folder' => '/config',
96
- 'layout' => 'config-builder',
100
+ 'layout' => config_builder_layout,
97
101
  'title' => 'Open SDG site configuration',
98
102
  'config_type' => 'site',
99
103
  'config_filename' => 'site_config.yml',
@@ -101,7 +105,7 @@ module JekyllOpenSdgPlugins
101
105
  end
102
106
  end
103
107
  # Make sure the form settings are set.
104
- config_page = pages.find { |page| page['layout'] == 'config-builder' }
108
+ config_page = pages.find { |page| page['layout'] == config_builder_layout }
105
109
  if config_page != nil && form_settings && form_settings['enabled']
106
110
  config_page['form_settings'] = form_settings
107
111
  end
@@ -26,7 +26,7 @@ module JekyllOpenSdgPlugins
26
26
  route = route + '/'
27
27
  end
28
28
 
29
- unless doc.data['layout'] == 'config-builder' or doc.data['layout'] == 'data-editor'
29
+ unless doc.data['layout'] == 'config-builder' or doc.data['layout'] == 'data-editor' or doc.data['layout'] == 'config-builder-2'
30
30
  routes['pages'].append(route)
31
31
  end
32
32
  end
@@ -40,7 +40,7 @@ module JekyllOpenSdgPlugins
40
40
  route = route + '/'
41
41
  end
42
42
 
43
- if doc.data['layout'] == 'config-builder' or doc.data['layout'] == 'data-editor'
43
+ if doc.data['layout'] == 'config-builder' or doc.data['layout'] == 'data-editor' or doc.data['layout'] == 'config-builder-2'
44
44
  routes['config'].append(route)
45
45
  end
46
46
  end
@@ -1521,6 +1521,18 @@
1521
1521
  }
1522
1522
  ]
1523
1523
  },
1524
+ "use_new_config_forms": {
1525
+ "title": "Use new config forms",
1526
+ "type": "boolean",
1527
+ "description": "This setting can be set to `true` to try the new site configuration forms. This is experimental and will eventually be the default.",
1528
+ "format": "checkbox",
1529
+ "links": [
1530
+ {
1531
+ "rel": "More information on the use_new_config_forms setting",
1532
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#use_new_config_forms"
1533
+ }
1534
+ ]
1535
+ },
1524
1536
  "validate_indicator_config": {
1525
1537
  "title": "Validate indicator config",
1526
1538
  "type": "boolean",
@@ -36,7 +36,7 @@ module JekyllOpenSdgPlugins
36
36
  site.collections.keys.each do |collection|
37
37
  site.collections[collection].docs.each do |doc|
38
38
  # Do not index configuration forms.
39
- if doc.data.has_key?('layout') && doc.data['layout'] == 'config-builder'
39
+ if doc.data.has_key?('layout') && (doc.data['layout'] == 'config-builder' or doc.data['layout'] == 'config-builder-2')
40
40
  next
41
41
  end
42
42
  # We segregate the search items by language.
@@ -1,3 +1,3 @@
1
1
  module JekyllOpenSdgPlugins
2
- VERSION = "2.3.0-beta1".freeze
2
+ VERSION = "2.3.0-beta3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-open-sdg-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.pre.beta1
4
+ version: 2.3.0.pre.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brock Fanning
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-17 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll