radiant-page_factory_config-extension 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,20 +8,24 @@ module PageFactoryConfig
8
8
  base.class_eval do
9
9
  def new_with_factory_config
10
10
  if params[:page_id].present?
11
- begin
12
- if factory_config = YAML::load(Page.find(params[:page_id]).render_part('factory-config'))
13
- ['parts', 'fields', 'remove_parts', 'remove_fields'].each do |key|
14
- if config = factory_config[key]
15
- config.each do |value|
16
- model_class.send(key.singularize, value.delete('name'), value)
11
+ page = Page.find(params[:page_id])
12
+
13
+ if page.has_part?('factory-config')
14
+ begin
15
+ if factory_config = YAML::load(page.render_part('factory-config'))
16
+ ['parts', 'fields', 'remove_parts', 'remove_fields'].each do |key|
17
+ if config = factory_config[key]
18
+ config.each do |value|
19
+ model_class.send(key.singularize, value.delete('name'), value)
20
+ end
17
21
  end
18
22
  end
19
- end
20
23
 
21
- model_class.layout(factory_config['layout'])
24
+ model_class.layout(factory_config['layout'])
25
+ end
26
+ rescue
27
+ raise PageFactoryConfigError
22
28
  end
23
- rescue
24
- raise PageFactoryConfigError
25
29
  end
26
30
  end
27
31
 
@@ -1,5 +1,5 @@
1
1
  module RadiantPageFactoryConfigExtension
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  SUMMARY = "Child Config for Radiant CMS"
4
4
  DESCRIPTION = "Enables default parts & fields for a Page's children"
5
5
  URL = "http://github.com/jsntv200/radiant-page_factory_config-extension"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-page_factory_config-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Taylor
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-15 00:00:00 Z
18
+ date: 2011-10-04 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Enables default parts & fields for a Page's children