radiant-relations-extension 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -31,6 +31,7 @@ module RelationsExtension::RelationsTags
|
|
31
31
|
By default the order will be ascending, you can reverse it 'SQL style' by adding " desc" to the order attribute.
|
32
32
|
}
|
33
33
|
tag 'related_pages:each' do |tag|
|
34
|
+
tag.locals.previous_headers = {}
|
34
35
|
tag.locals.related_pages.inject('') do |result, related_page|
|
35
36
|
tag.locals.page = related_page
|
36
37
|
result + tag.expand
|
@@ -68,4 +69,54 @@ module RelationsExtension::RelationsTags
|
|
68
69
|
tag.locals.page = tag.locals.related_pages.last
|
69
70
|
tag.expand
|
70
71
|
end
|
72
|
+
|
73
|
+
desc %{ Expands if the current page in related_pages:each is the first one. }
|
74
|
+
tag 'related_pages:each:if_first' do |tag|
|
75
|
+
tag.expand if tag.locals.page == tag.locals.related_pages.first
|
76
|
+
end
|
77
|
+
tag 'related_pages:each:unless_first' do |tag|
|
78
|
+
tag.expand unless tag.locals.page == tag.locals.related_pages.first
|
79
|
+
end
|
80
|
+
desc %{ Expands if the current page in related_pages:each is the last one. }
|
81
|
+
tag 'related_pages:each:if_last' do |tag|
|
82
|
+
tag.expand if tag.locals.page == tag.locals.related_pages.last
|
83
|
+
end
|
84
|
+
tag 'related_pages:each:unless_last' do |tag|
|
85
|
+
tag.expand unless tag.locals.page == tag.locals.related_pages.last
|
86
|
+
end
|
87
|
+
desc %{
|
88
|
+
Renders the tag contents only if the contents do not match the previous header.
|
89
|
+
|
90
|
+
If you would like to use several header blocks you may use the @name@ attribute to
|
91
|
+
name the header. When a header is named it will not restart until another header of
|
92
|
+
the same name is different.
|
93
|
+
|
94
|
+
Using the @restart@ attribute you can cause other named headers to restart when the
|
95
|
+
present header changes. Simply specify the names of the other headers in a semicolon
|
96
|
+
separated list.
|
97
|
+
|
98
|
+
*Usage:*
|
99
|
+
|
100
|
+
<pre><code><r:related_pages:each>
|
101
|
+
<r:header [name="header_name"] [restart="name1[;name2;...]"]>
|
102
|
+
...
|
103
|
+
</r:header>
|
104
|
+
</r:related_pages:each>
|
105
|
+
</code></pre>
|
106
|
+
}
|
107
|
+
tag 'related_pages:each:header' do |tag|
|
108
|
+
previous_headers = tag.locals.previous_headers
|
109
|
+
name = tag.attr['name'] || :unnamed
|
110
|
+
restart = (tag.attr['restart'] || '').split(';')
|
111
|
+
header = tag.expand
|
112
|
+
unless header == previous_headers[name]
|
113
|
+
previous_headers[name] = header
|
114
|
+
unless restart.empty?
|
115
|
+
restart.each do |n|
|
116
|
+
previous_headers[n] = nil
|
117
|
+
end
|
118
|
+
end
|
119
|
+
header
|
120
|
+
end
|
121
|
+
end
|
71
122
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-relations-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-02-24 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Allows you to define relations between pages
|
16
16
|
email:
|
@@ -21,6 +21,7 @@ extra_rdoc_files: []
|
|
21
21
|
files:
|
22
22
|
- db/migrate/20110623112105_add_related_pages.rb
|
23
23
|
- radiant-relations-extension-1.2.6.gem
|
24
|
+
- radiant-relations-extension-1.2.7.gem
|
24
25
|
- radiant-relations-extension.gemspec
|
25
26
|
- config/initializers/radiant_config.rb
|
26
27
|
- config/routes.rb
|
@@ -49,7 +50,7 @@ files:
|
|
49
50
|
homepage: http://github.com/jomz/radiant-relations-extension
|
50
51
|
licenses: []
|
51
52
|
post_install_message: ! "\n Add this to your radiant project by putting this line
|
52
|
-
in your Gemfile:\n gem \"radiant-relations-extension\", \"~> 1.2.
|
53
|
+
in your Gemfile:\n gem \"radiant-relations-extension\", \"~> 1.2.8\"\n "
|
53
54
|
rdoc_options: []
|
54
55
|
require_paths:
|
55
56
|
- lib
|