radiant-relations-extension 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,14 +3,24 @@ module RelationsHelper
3
3
  options = []
4
4
  options << [t('support.select.prompt'), nil]
5
5
  if @page && @page.field('relations_target_parent_id')
6
- Page.find(@page.field('relations_target_parent_id').content).children.each do |p|
7
- options << [p.title, p.id]
8
- end
6
+ options.concat build_tree(Page.find(@page.field('relations_target_parent_id').content), [])
9
7
  else
10
- Page.all.each do |p|
11
- options << [p.title, p.id]
12
- end
8
+ options.concat build_tree(Page.root, [])
13
9
  end
14
10
  options_for_select(options, selected)
15
11
  end
12
+
13
+ def build_tree(page, list, level = 0)
14
+ label = "#{'-'*level} #{page.title}"
15
+ id = page.id
16
+ list << [label, id]
17
+
18
+ return list if page.fields.select{|f| f.name == "exclude_children_from_relations_target"}.any?
19
+ return list if Radiant::Config["relations.exclude_archive_children"] && page.class_name =~ /ArchivePage/
20
+
21
+ page.children.each do |p|
22
+ build_tree p, list, level + 1
23
+ end
24
+ list
25
+ end
16
26
  end
@@ -4,3 +4,6 @@ nl:
4
4
  page_parts:
5
5
  relation_page_part:
6
6
  add_row: Relatie toevoegen
7
+ support:
8
+ select:
9
+ prompt: Maak een keuze
@@ -1,3 +1,3 @@
1
1
  class RadiantRelationsExtension
2
- VERSION = '1.0.0'
3
- end
2
+ VERSION = '1.1.0'
3
+ end
@@ -7,10 +7,10 @@ Gem::Specification.new do |s|
7
7
  s.version = RadiantRelationsExtension::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Jan De Poorter", "Benny Degezelle"]
10
- s.email = ["jan@defv.be"]
11
- s.homepage = "http://github.com/defv/radiant-relations-extension"
12
- s.summary = %q{Relations for Radiant CMS}
13
- s.description = %q{Makes Radiant better by adding relations!}
10
+ s.email = ["rubygems@monkeypatch.be"]
11
+ s.homepage = "http://github.com/jomz/radiant-relations-extension"
12
+ s.summary = %q{Relations extension for Radiant CMS}
13
+ s.description = %q{Allows you to define relations between pages}
14
14
 
15
15
  ignores = if File.exist?('.gitignore')
16
16
  File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.require_paths = ["lib"]
24
24
 
25
25
  s.post_install_message = %{
26
- Add this to your radiant project with:
27
- config.gem 'radiant-relations-extension', :version => '~>#{RadiantRelationsExtension::VERSION}'
26
+ Add this to your radiant project by putting this line in your Gemfile:
27
+ gem "radiant-children_config-extension", "~> #{RadiantRelationsExtension::VERSION}"
28
28
  }
29
29
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-relations-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan De Poorter
@@ -16,13 +16,13 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-29 00:00:00 +02:00
19
+ date: 2012-09-25 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
23
- description: Makes Radiant better by adding relations!
23
+ description: Allows you to define relations between pages
24
24
  email:
25
- - jan@defv.be
25
+ - rubygems@monkeypatch.be
26
26
  executables: []
27
27
 
28
28
  extensions: []
@@ -48,7 +48,6 @@ files:
48
48
  - lib/tasks/relations_extension_tasks.rake
49
49
  - public/javascripts/admin/relations.js
50
50
  - public/stylesheets/sass/admin/relations.sass
51
- - radiant-relations-extension-1.0.0.gem
52
51
  - radiant-relations-extension.gemspec
53
52
  - Rakefile
54
53
  - README
@@ -56,10 +55,10 @@ files:
56
55
  - spec/spec.opts
57
56
  - spec/spec_helper.rb
58
57
  has_rdoc: true
59
- homepage: http://github.com/defv/radiant-relations-extension
58
+ homepage: http://github.com/jomz/radiant-relations-extension
60
59
  licenses: []
61
60
 
62
- post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-relations-extension', :version => '~>1.0.0'\n "
61
+ 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.0\"\n "
63
62
  rdoc_options: []
64
63
 
65
64
  require_paths:
@@ -85,10 +84,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
84
  requirements: []
86
85
 
87
86
  rubyforge_project:
88
- rubygems_version: 1.6.2
87
+ rubygems_version: 1.5.3
89
88
  signing_key:
90
89
  specification_version: 3
91
- summary: Relations for Radiant CMS
90
+ summary: Relations extension for Radiant CMS
92
91
  test_files:
93
92
  - spec/spec.opts
94
93
  - spec/spec_helper.rb