radiant-group_children-extension 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@ Until now we have sometimes used javascript to alter markup, which is very ucky.
8
8
 
9
9
  Here is the solution;
10
10
 
11
- <r:children:grouped per="3">
11
+ <r:children:grouped size="3">
12
12
  <div>
13
13
  <r:children:each> ... </r:children:each>
14
14
  </div>
data/lib/group_tags.rb CHANGED
@@ -9,7 +9,7 @@ module GroupTags
9
9
 
10
10
  *Usage:*
11
11
 
12
- <pre><code><r:children:grouped [per="number"] [limit="number"]
12
+ <pre><code><r:children:grouped [size="number"] [limit="number"]
13
13
  [by="published_at|updated_at|created_at|slug|title|keywords|description"]
14
14
  [order="asc|desc"]
15
15
  [status="draft|reviewed|published|hidden|all"]
@@ -20,20 +20,20 @@ module GroupTags
20
20
  }
21
21
  tag 'children:grouped' do |tag|
22
22
  options = children_find_options(tag)
23
- group_size = tag.attr['per'].to_i || 2
23
+ group_size = tag.attr['size'].to_i || 2
24
24
  tag.locals.groups = tag.locals.children.all(options).inject([]) do |groups, value|
25
25
  groups << [] if !groups.last || groups.last.size >= group_size
26
26
  groups.last << value
27
27
  groups
28
28
  end
29
29
  result = []
30
- tag.locals.groups.each_with_index do |group, i|
30
+ tag.locals.groups.map do |group|
31
31
  tag.locals.children = group
32
- tag.locals.first_group = i == 0
33
- tag.locals.last_group = i == tag.locals.groups.length - 1
32
+ tag.locals.first_group = group == tag.locals.groups.first
33
+ tag.locals.last_group = group == tag.locals.groups.last
34
34
  result << tag.expand
35
35
  end
36
- result
36
+ result.join ""
37
37
  end
38
38
 
39
39
  tag 'children:grouped:if_first' do |tag|
@@ -50,14 +50,14 @@ module GroupTags
50
50
 
51
51
  tag 'children:grouped:children:each' do |tag|
52
52
  result = []
53
- tag.locals.children.each_with_index do |page, i|
53
+ tag.locals.children.map do |page|
54
54
  tag.locals.child = page
55
55
  tag.locals.page = page
56
- tag.locals.first_child = i == 0
57
- tag.locals.last_child = i == tag.locals.children.length - 1
56
+ tag.locals.first_child = page == tag.locals.children.first
57
+ tag.locals.last_child = page == tag.locals.children.last
58
58
  result << tag.expand
59
59
  end
60
- result
60
+ result.join ""
61
61
  end
62
62
 
63
63
  tag 'children:grouped:children:each:if_first' do |tag|
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-group_children-extension}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Benny Degezelle"]
metadata CHANGED
@@ -1,48 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: radiant-group_children-extension
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Benny Degezelle
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-09-23 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2010-09-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: radiant
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 57
30
- segments:
31
- - 0
32
- - 9
33
- - 1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
34
21
  version: 0.9.1
35
22
  type: :runtime
36
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.1
37
30
  description: Adds the ability to iterate over a page's children per n items.
38
31
  email: benny@gorilla-webdesign.be
39
32
  executables: []
40
-
41
33
  extensions: []
42
-
43
- extra_rdoc_files:
34
+ extra_rdoc_files:
44
35
  - README.md
45
- files:
36
+ files:
46
37
  - README.md
47
38
  - Rakefile
48
39
  - VERSION
@@ -57,39 +48,30 @@ files:
57
48
  - radiant-group_children-extension.gemspec
58
49
  - spec/spec.opts
59
50
  - spec/spec_helper.rb
60
- has_rdoc: true
61
51
  homepage: http://github.com/jomz/radiant-group_children-extension
62
52
  licenses: []
63
-
64
53
  post_install_message:
65
- rdoc_options:
54
+ rdoc_options:
66
55
  - --charset=UTF-8
67
- require_paths:
56
+ require_paths:
68
57
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
58
+ required_ruby_version: !ruby/object:Gem::Requirement
70
59
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
65
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 3
84
- segments:
85
- - 0
86
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
87
70
  requirements: []
88
-
89
71
  rubyforge_project:
90
- rubygems_version: 1.3.7
72
+ rubygems_version: 1.8.23.2
91
73
  signing_key:
92
74
  specification_version: 3
93
75
  summary: Group Children Extension for Radiant CMS
94
- test_files:
76
+ test_files:
95
77
  - spec/spec_helper.rb