radiant-children_config-extension 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,21 @@
1
1
  module ChildrenConfig::PagesControllerExtensions
2
2
  def self.included(base)
3
3
  base.class_eval do
4
- alias :original_new :new
5
-
6
- def new
7
- unless params[:page_id].blank?
8
- parent_page = Page.find(params[:page_id])
9
- child_parts = parent_page.part("children_config").try(:content)
10
- self.model = model_class.new_with_children_config(config, child_parts)
11
- else
12
- self.model = model_class.new_with_defaults(config)
13
- self.model.slug = '/'
14
- end
15
- response_for :singular
16
- end
4
+ alias_method_chain :new, :children_config
5
+
17
6
  end
18
7
  end
19
- end
8
+
9
+ def new_with_children_config
10
+ unless params[:page_id].blank?
11
+ parent_page = Page.find(params[:page_id])
12
+ yaml_config = parent_page.part("children_config").try(:content)
13
+ @page = self.model = model_class.new_with_children_config(config, yaml_config)
14
+ assign_page_attributes
15
+ response_for :new
16
+ else
17
+ new_without_children_config
18
+ end
19
+
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module RadiantChildrenConfigExtension
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: radiant-children_config-extension
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.1
5
+ version: 1.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Benny Degezelle
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-10-12 00:00:00 Z
13
+ date: 2012-10-22 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Allows you to define new defaults on a page per page basis.
@@ -46,7 +46,7 @@ files:
46
46
  homepage: https://github.com/jomz/radiant-children_config-extension
47
47
  licenses: []
48
48
 
49
- post_install_message: "\n Add this to your radiant project by putting this line in your Gemfile:\n gem \"radiant-children_config-extension\", \"~> 1.1.1\"\n "
49
+ post_install_message: "\n Add this to your radiant project by putting this line in your Gemfile:\n gem \"radiant-children_config-extension\", \"~> 1.1.2\"\n "
50
50
  rdoc_options: []
51
51
 
52
52
  require_paths: