radiant-reorder_children-extension 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateReorderExtensionSchema < ActiveRecord::Migration
|
2
|
+
class << self
|
3
|
+
def up
|
4
|
+
add_column "pages", "position", :integer, :default => 0, :null => false
|
5
|
+
Page.reset_column_information
|
6
|
+
update_position_column
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
remove_column "pages", "position"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def update_position_column
|
16
|
+
pages = Page.find(:all).reject { |page| page.children.empty? }
|
17
|
+
pages.each do |page|
|
18
|
+
children = page.children.find(:all, :order => 'virtual DESC, title ASC')
|
19
|
+
children.each_with_index do |child, index|
|
20
|
+
child.update_attribute :position, index
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-reorder_children-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benny Degezelle
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-15 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- config/locales/nl.yml
|
38
38
|
- config/routes.rb
|
39
39
|
- cucumber.yml
|
40
|
+
- db/migrate/001_create_reorder_extension_schema.rb
|
40
41
|
- features/support/env.rb
|
41
42
|
- features/support/paths.rb
|
42
43
|
- lib/radiant-reorder_children-extension/version.rb
|
@@ -48,7 +49,6 @@ files:
|
|
48
49
|
- lib/tasks/reorder_children_extension_tasks.rake
|
49
50
|
- public/images/admin/reorder.png
|
50
51
|
- public/stylesheets/admin/reorder.css
|
51
|
-
- radiant-reorder_children-extension-1.0.0.gem
|
52
52
|
- radiant-reorder_children-extension.gemspec
|
53
53
|
- Rakefile
|
54
54
|
- README.md
|
@@ -59,7 +59,7 @@ has_rdoc: true
|
|
59
59
|
homepage: http://github.com/jomz/radiant-reorder_children-extension
|
60
60
|
licenses: []
|
61
61
|
|
62
|
-
post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-reorder_children-extension', :version => '~>1.0.
|
62
|
+
post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-reorder_children-extension', :version => '~>1.0.2'\n "
|
63
63
|
rdoc_options: []
|
64
64
|
|
65
65
|
require_paths:
|
Binary file
|