radiant-group_children-extension 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,8 +18,14 @@ The children:grouped tag takes all the same arguments like children:each, except
18
18
  Furthermore, inside children:grouped, you can use r:if\_first and r:if\_last to check if you are in the first or last group.
19
19
  The children:each within children:grouped does NOT take arguments; those have to be passed to the children:grouped tag itself.
20
20
 
21
- Also note that this extension does not override any of the existing tags, and should be backwards-compatible with 0.8 and earlier.
21
+ This extension does not override any of the existing tags, and should be backwards-compatible with 0.8 and earlier.
22
22
 
23
+ # Installation
24
+
25
+ Clone or submodule this extension into vendor/extensions/group\_children
26
+ Or, gem install radiant-group\_children-extension and put this inside Radiant::Initializer;
27
+
28
+ config.gem 'radiant-group_children-extension', :lib => false
23
29
 
24
30
  [1]: http://radiantcms.org/ "Radiant: Content management simplified"
25
31
  [2]: http://hardcoreforkingaction.com "Hard-core forking action: a low frequency, web-tech blog by Benny Degezelle"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -4,7 +4,6 @@ class GroupChildrenExtension < Radiant::Extension
4
4
  url "http://github.com/jomz/radiant-group_children-extension"
5
5
 
6
6
  def activate
7
- Array.send :include, ArrayHack
8
7
  Page.send :include, GroupTags
9
8
  end
10
9
  end
data/lib/group_tags.rb CHANGED
@@ -21,7 +21,11 @@ module GroupTags
21
21
  tag 'children:grouped' do |tag|
22
22
  options = children_find_options(tag)
23
23
  group_size = tag.attr['per'].to_i || 2
24
- tag.locals.groups = tag.locals.children.all(options) % group_size
24
+ tag.locals.groups = tag.locals.children.all(options).inject([]) do |groups, value|
25
+ groups << [] if !groups.last || groups.last.size >= group_size
26
+ groups.last << value
27
+ groups
28
+ end
25
29
  result = []
26
30
  tag.locals.groups.each_with_index do |group, i|
27
31
  tag.locals.children = group
@@ -0,0 +1,56 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{radiant-group_children-extension}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Benny Degezelle"]
12
+ s.date = %q{2010-09-23}
13
+ s.description = %q{Adds the ability to iterate over a page's children per n items.}
14
+ s.email = %q{benny@gorilla-webdesign.be}
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ "README.md",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "config/locales/en.yml",
23
+ "config/routes.rb",
24
+ "cucumber.yml",
25
+ "features/support/env.rb",
26
+ "features/support/paths.rb",
27
+ "group_children_extension.rb",
28
+ "lib/group_tags.rb",
29
+ "lib/tasks/group_children_extension_tasks.rake",
30
+ "radiant-group_children-extension.gemspec",
31
+ "spec/spec.opts",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.homepage = %q{http://github.com/jomz/radiant-group_children-extension}
35
+ s.rdoc_options = ["--charset=UTF-8"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = %q{1.3.7}
38
+ s.summary = %q{Group Children Extension for Radiant CMS}
39
+ s.test_files = [
40
+ "spec/spec_helper.rb"
41
+ ]
42
+
43
+ if s.respond_to? :specification_version then
44
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<radiant>, [">= 0.9.1"])
49
+ else
50
+ s.add_dependency(%q<radiant>, [">= 0.9.1"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<radiant>, [">= 0.9.1"])
54
+ end
55
+ end
56
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-group_children-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benny Degezelle
@@ -52,9 +52,9 @@ files:
52
52
  - features/support/env.rb
53
53
  - features/support/paths.rb
54
54
  - group_children_extension.rb
55
- - lib/array_hack.rb
56
55
  - lib/group_tags.rb
57
56
  - lib/tasks/group_children_extension_tasks.rake
57
+ - radiant-group_children-extension.gemspec
58
58
  - spec/spec.opts
59
59
  - spec/spec_helper.rb
60
60
  has_rdoc: true
data/lib/array_hack.rb DELETED
@@ -1,9 +0,0 @@
1
- module ArrayHack
2
- def % len
3
- inject([]) do |groups, value|
4
- groups << [] if !groups.last || groups.last.size >= len
5
- groups.last << value
6
- groups
7
- end
8
- end
9
- end