radiant-relations-extension 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  class RadiantRelationsExtension
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -2,14 +2,21 @@ module RelationsExtension::RelationsTags
2
2
  include Radiant::Taggable
3
3
 
4
4
  tag 'related_pages' do |tag|
5
- related_pages = tag.locals.page.related_pages
6
- tag.expand unless related_pages.empty?
5
+ tag.locals.related_pages = tag.locals.page.related_pages
6
+ if tag.attr['from_ancestor']
7
+ ancestor_path = Page.find(tag.attr['from_ancestor']).path
8
+ tag.locals.related_pages.delete_if{|p| p.path =~ /^#{ancestor_path}/ }
9
+ end
10
+ tag.expand unless tag.locals.related_pages.empty?
7
11
  end
8
12
  desc %{
9
13
  Iterates over all related pages. Page relations should be declared via a Relations page part.
14
+ You can limit the results by use of a @from_ancestor@ attribute.
15
+ For example: <r:related_pages from_ancestor="8"><r:each:link/></r:related_pages> where 8 is a page id
16
+ The from_ancestor attribute accepts only one page id.
10
17
  }
11
18
  tag 'related_pages:each' do |tag|
12
- related_pages.inject('') do |result, related_page|
19
+ tag.locals.related_pages.inject('') do |result, related_page|
13
20
  tag.locals.page = related_page
14
21
  result + tag.expand
15
22
  end
@@ -17,12 +24,12 @@ module RelationsExtension::RelationsTags
17
24
 
18
25
  desc %{ }
19
26
  tag 'related_pages:first' do |tag|
20
- tag.locals.page = related_pages.first
27
+ tag.locals.page = tag.locals.related_pages.first
21
28
  tag.expand
22
29
  end
23
30
  desc %{ }
24
31
  tag 'related_pages:last' do |tag|
25
- tag.locals.page = related_pages.last
32
+ tag.locals.page = tag.locals.related_pages.last
26
33
  tag.expand
27
34
  end
28
35
  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: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
- - 1
10
- version: 1.1.1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan De Poorter
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-09-25 00:00:00 +02:00
19
+ date: 2012-09-27 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -49,6 +49,7 @@ files:
49
49
  - public/javascripts/admin/relations.js
50
50
  - public/stylesheets/sass/admin/relations.sass
51
51
  - radiant-relations-extension-1.1.0.gem
52
+ - radiant-relations-extension-1.1.1.gem
52
53
  - radiant-relations-extension.gemspec
53
54
  - Rakefile
54
55
  - README
@@ -59,7 +60,7 @@ has_rdoc: true
59
60
  homepage: http://github.com/jomz/radiant-relations-extension
60
61
  licenses: []
61
62
 
62
- 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 "
63
+ post_install_message: "\n Add this to your radiant project by putting this line in your Gemfile:\n gem \"radiant-children_config-extension\", \"~> 1.2.0\"\n "
63
64
  rdoc_options: []
64
65
 
65
66
  require_paths: