radiant-reorder_children-extension 1.0.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.
- data/README.md +40 -0
- data/Rakefile +109 -0
- data/app/views/admin/pages/_reorder_extra_td.html.haml +3 -0
- data/app/views/admin/pages/_reorder_extra_th.html.haml +2 -0
- data/app/views/admin/pages/reorder.html.haml +61 -0
- data/config/initializers/radiant_config.rb +3 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/nl.yml +5 -0
- data/config/routes.rb +3 -0
- data/cucumber.yml +1 -0
- data/features/support/env.rb +11 -0
- data/features/support/paths.rb +22 -0
- data/lib/radiant-reorder_children-extension.rb +2 -0
- data/lib/radiant-reorder_children-extension/version.rb +3 -0
- data/lib/reorder_children/page_extensions.rb +13 -0
- data/lib/reorder_children/page_helper_extensions.rb +8 -0
- data/lib/reorder_children/pages_controller_extensions.rb +23 -0
- data/lib/reorder_children/radius_tags.rb +38 -0
- data/lib/tasks/reorder_children_extension_tasks.rake +55 -0
- data/public/images/admin/reorder.png +0 -0
- data/public/stylesheets/admin/reorder.css +4 -0
- data/radiant-reorder_children-extension.gemspec +29 -0
- data/reorder_children_extension.rb +41 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +36 -0
- metadata +95 -0
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
Reorder Children
|
2
|
+
===
|
3
|
+
|
4
|
+
About
|
5
|
+
---
|
6
|
+
|
7
|
+
Adds the ability to reorder the children of a certain page with drag and drop.
|
8
|
+
Tested on Radiant 1.0.0.rc2, but should work for older versions.
|
9
|
+
|
10
|
+
This extension is based on the work done by John Long in preparation for the feature to be a part
|
11
|
+
of Radiant 0.6.1. In the interest of making it available as soon as possible, it has been packaged
|
12
|
+
here for all the world to see.
|
13
|
+
|
14
|
+
"packaged here" was actually pointing to the old radiant subversion repository, so it was regenerated in a modern Radiant,
|
15
|
+
and cleaned up a bit.
|
16
|
+
|
17
|
+
Installation
|
18
|
+
---
|
19
|
+
|
20
|
+
git clone git://github.com/jomz/radiant-reorder_children-extension.git vendor/extensions/reorder_children
|
21
|
+
|
22
|
+
or, add the gem to your environment.rb:
|
23
|
+
|
24
|
+
config.gem "radiant-reorder_children-extension"
|
25
|
+
|
26
|
+
Then update and migrate:
|
27
|
+
|
28
|
+
rake db:migrate:extensions
|
29
|
+
rake radiant:extensions:reorder:update
|
30
|
+
|
31
|
+
###Added Tags
|
32
|
+
|
33
|
+
Adds r:next and r:previous tags. These default to the previous and next sibling by position.
|
34
|
+
Add a 'by' attribute to use i.e. the published_at column.
|
35
|
+
|
36
|
+
<r:next [by="position|published_at|slug"]></r:next>
|
37
|
+
|
38
|
+
[rre]: https://github.com/radiant/radiant-reorder-extension
|
39
|
+
[jomz]: http://github.com/jomz
|
40
|
+
[radiant]: http://radiantcms.org/
|
data/Rakefile
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Determine where the RSpec plugin is by loading the boot
|
2
|
+
unless defined? RADIANT_ROOT
|
3
|
+
ENV["RAILS_ENV"] = "test"
|
4
|
+
case
|
5
|
+
when ENV["RADIANT_ENV_FILE"]
|
6
|
+
require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
|
7
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
8
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
|
9
|
+
else
|
10
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rake'
|
15
|
+
require 'rake/rdoctask'
|
16
|
+
require 'rake/testtask'
|
17
|
+
|
18
|
+
rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
|
19
|
+
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
require 'cucumber'
|
22
|
+
require 'cucumber/rake/task'
|
23
|
+
|
24
|
+
# Cleanup the RADIANT_ROOT constant so specs will load the environment
|
25
|
+
Object.send(:remove_const, :RADIANT_ROOT)
|
26
|
+
|
27
|
+
extension_root = File.expand_path(File.dirname(__FILE__))
|
28
|
+
|
29
|
+
task :default => [:spec, :features]
|
30
|
+
task :stats => "spec:statsetup"
|
31
|
+
|
32
|
+
desc "Run all specs in spec directory"
|
33
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
34
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
35
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
36
|
+
end
|
37
|
+
|
38
|
+
task :features => 'spec:integration'
|
39
|
+
|
40
|
+
namespace :spec do
|
41
|
+
desc "Run all specs in spec directory with RCov"
|
42
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
43
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
44
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
45
|
+
t.rcov = true
|
46
|
+
t.rcov_opts = ['--exclude', 'spec', '--rails']
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Print Specdoc for all specs"
|
50
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
51
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
52
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
53
|
+
end
|
54
|
+
|
55
|
+
[:models, :controllers, :views, :helpers].each do |sub|
|
56
|
+
desc "Run the specs under spec/#{sub}"
|
57
|
+
Spec::Rake::SpecTask.new(sub) do |t|
|
58
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
59
|
+
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Run the Cucumber features"
|
64
|
+
Cucumber::Rake::Task.new(:integration) do |t|
|
65
|
+
t.fork = true
|
66
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
67
|
+
# t.feature_pattern = "#{extension_root}/features/**/*.feature"
|
68
|
+
t.profile = "default"
|
69
|
+
end
|
70
|
+
|
71
|
+
# Setup specs for stats
|
72
|
+
task :statsetup do
|
73
|
+
require 'code_statistics'
|
74
|
+
::STATS_DIRECTORIES << %w(Model\ specs spec/models)
|
75
|
+
::STATS_DIRECTORIES << %w(View\ specs spec/views)
|
76
|
+
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
|
77
|
+
::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
|
78
|
+
::CodeStatistics::TEST_TYPES << "Model specs"
|
79
|
+
::CodeStatistics::TEST_TYPES << "View specs"
|
80
|
+
::CodeStatistics::TEST_TYPES << "Controller specs"
|
81
|
+
::CodeStatistics::TEST_TYPES << "Helper specs"
|
82
|
+
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
83
|
+
end
|
84
|
+
|
85
|
+
namespace :db do
|
86
|
+
namespace :fixtures do
|
87
|
+
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
|
88
|
+
task :load => :environment do
|
89
|
+
require 'active_record/fixtures'
|
90
|
+
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
|
91
|
+
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
|
92
|
+
Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
desc 'Generate documentation for the reorder_children extension.'
|
100
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
101
|
+
rdoc.rdoc_dir = 'rdoc'
|
102
|
+
rdoc.title = 'ReorderChildrenExtension'
|
103
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
104
|
+
rdoc.rdoc_files.include('README')
|
105
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
106
|
+
end
|
107
|
+
|
108
|
+
# Load any custom rakefiles for extension
|
109
|
+
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
@@ -0,0 +1,61 @@
|
|
1
|
+
:css
|
2
|
+
.page {
|
3
|
+
font-size: 120%;
|
4
|
+
font-weight: bold;
|
5
|
+
position: relative;
|
6
|
+
padding: 10px;
|
7
|
+
padding-left: 30px;
|
8
|
+
border-top: 1px solid #eaeaea;
|
9
|
+
}
|
10
|
+
.page .icon {
|
11
|
+
position: absolute;
|
12
|
+
margin-top: -7px;
|
13
|
+
left: 0px;
|
14
|
+
}
|
15
|
+
ul.pages,
|
16
|
+
ul.pages li {
|
17
|
+
list-style: none;
|
18
|
+
margin: 0;
|
19
|
+
padding: 0
|
20
|
+
}
|
21
|
+
ul.pages {
|
22
|
+
border-bottom: 1px solid #eaeaea;
|
23
|
+
}
|
24
|
+
ul.pages li {
|
25
|
+
font-size: 105%;
|
26
|
+
font-weight: normal;
|
27
|
+
padding: 10px;
|
28
|
+
padding-left: 52px;
|
29
|
+
}
|
30
|
+
ul.page .icon,
|
31
|
+
ul.pages .icon {
|
32
|
+
position: absolute;
|
33
|
+
margin-top: -7px;
|
34
|
+
left: 22px;
|
35
|
+
}
|
36
|
+
|
37
|
+
%h1#reorder_pages= t('reorder_pages')
|
38
|
+
|
39
|
+
%p= t('drag_and_drop_to_reorder')
|
40
|
+
|
41
|
+
#page.page
|
42
|
+
= page_icon(@page)
|
43
|
+
= @page.title
|
44
|
+
|
45
|
+
%ul#children.pages
|
46
|
+
- for child in @children
|
47
|
+
%li{:id => "item_#{child.id}", :class => "page"}
|
48
|
+
= page_icon(child)
|
49
|
+
= child.breadcrumb
|
50
|
+
|
51
|
+
:javascript
|
52
|
+
Sortable.create("children", { onUpdate:function(){ $('sort_order').value = Sortable.sequence('children').join(',') } });
|
53
|
+
|
54
|
+
- @javascripts << 'admin/dragdrop'
|
55
|
+
- form_tag do
|
56
|
+
%p.buttons
|
57
|
+
= submit_tag t("buttons.save_changes"), :class => 'button'
|
58
|
+
= t('or')
|
59
|
+
= link_to t('cancel'), admin_pages_url
|
60
|
+
|
61
|
+
%div= hidden_field_tag "sort_order"
|
data/config/routes.rb
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --format progress features --tags ~@proposed,~@in_progress
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Sets up the Rails environment for Cucumber
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
# Extension root
|
4
|
+
extension_env = File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
|
5
|
+
require extension_env+'.rb'
|
6
|
+
|
7
|
+
Dir.glob(File.join(RADIANT_ROOT, "features", "**", "*.rb")).each {|step| require step unless step =~ /datasets_loader\.rb$/}
|
8
|
+
|
9
|
+
Cucumber::Rails::World.class_eval do
|
10
|
+
dataset :reorder_children
|
11
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
|
3
|
+
# Extend the standard PathMatchers with your own paths
|
4
|
+
# to be used in your features.
|
5
|
+
#
|
6
|
+
# The keys and values here may be used in your standard web steps
|
7
|
+
# Using:
|
8
|
+
#
|
9
|
+
# When I go to the "reorder_children" admin page
|
10
|
+
#
|
11
|
+
# would direct the request to the path you provide in the value:
|
12
|
+
#
|
13
|
+
# admin_reorder_children_path
|
14
|
+
#
|
15
|
+
PathMatchers = {} unless defined?(PathMatchers)
|
16
|
+
PathMatchers.merge!({
|
17
|
+
# /reorder_children/i => 'admin_reorder_children_path'
|
18
|
+
})
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
World(NavigationHelpers)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ReorderChildren
|
2
|
+
module PageExtensions
|
3
|
+
def included(page_base)
|
4
|
+
page_base.send(:before_create, :update_position)
|
5
|
+
end
|
6
|
+
|
7
|
+
def update_position
|
8
|
+
last = Page.find(:first, :conditions => { :parent_id => parent_id }, :order => 'position DESC')
|
9
|
+
write_attribute('position', last.position + 1) if last
|
10
|
+
true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ReorderChildren
|
2
|
+
module PagesControllerExtensions
|
3
|
+
def reorder
|
4
|
+
if request.post?
|
5
|
+
sort_order = params[:sort_order].to_s.split(',').map { |i| Integer(i) rescue nil }.compact
|
6
|
+
sort_order.each_with_index do |id, index|
|
7
|
+
Page.update(id, :position => index)
|
8
|
+
end
|
9
|
+
|
10
|
+
if defined? ResponseCache == 'constant'
|
11
|
+
ResponseCache.instance.clear
|
12
|
+
else
|
13
|
+
Radiant::Cache.clear
|
14
|
+
end
|
15
|
+
|
16
|
+
redirect_to admin_pages_url
|
17
|
+
else
|
18
|
+
@page = Page.find(params[:id])
|
19
|
+
@children = @page.children
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module ReorderChildren
|
2
|
+
module RadiusTags
|
3
|
+
include Radiant::Taggable
|
4
|
+
|
5
|
+
desc %{
|
6
|
+
Sets page context to next page sibling. For example:
|
7
|
+
|
8
|
+
<pre><code><r:next by="title"><r:link/></r:next></code></pre>
|
9
|
+
|
10
|
+
*Usage:*
|
11
|
+
<pre><code><r:next [by="sort_order"]>...</r:next></code></pre>
|
12
|
+
}
|
13
|
+
tag "next" do |tag|
|
14
|
+
by = tag.attr['by'] || "position"
|
15
|
+
next_page = Page.find_by_parent_id(tag.locals.page.parent_id, :conditions => ["virtual = false and status_id = 100 and #{by} > ?", tag.locals.page.send(by)], :order => "#{by} ASC")
|
16
|
+
if next_page
|
17
|
+
tag.locals.page = next_page
|
18
|
+
tag.expand
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
desc %{
|
23
|
+
Sets page context to previous page sibling. For example:
|
24
|
+
<pre><code><r:previous by="title"><r:link/></r:previous></code></pre>
|
25
|
+
|
26
|
+
*Usage:*
|
27
|
+
<pre><code><r:previous [by="sort_order"]>...</r:previous></code></pre>
|
28
|
+
}
|
29
|
+
tag "previous" do |tag|
|
30
|
+
by = tag.attr['by'] || "position"
|
31
|
+
previous_page = Page.find_by_parent_id(tag.locals.page.parent_id, :conditions => ["virtual = false and status_id = 100 and #{by} < ?", tag.locals.page.send(by)], :order => "#{by} DESC")
|
32
|
+
if previous_page
|
33
|
+
tag.locals.page = previous_page
|
34
|
+
tag.expand
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
namespace :radiant do
|
2
|
+
namespace :extensions do
|
3
|
+
namespace :reorder_children do
|
4
|
+
|
5
|
+
desc "Runs the migration of the Reorder Children extension"
|
6
|
+
task :migrate => :environment do
|
7
|
+
require 'radiant/extension_migrator'
|
8
|
+
if ENV["VERSION"]
|
9
|
+
ReorderChildrenExtension.migrator.migrate(ENV["VERSION"].to_i)
|
10
|
+
Rake::Task['db:schema:dump'].invoke
|
11
|
+
else
|
12
|
+
ReorderChildrenExtension.migrator.migrate
|
13
|
+
Rake::Task['db:schema:dump'].invoke
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Copies public assets of the Reorder Children to the instance public/ directory."
|
18
|
+
task :update => :environment do
|
19
|
+
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
|
20
|
+
puts "Copying assets from ReorderChildrenExtension"
|
21
|
+
Dir[ReorderChildrenExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
|
22
|
+
path = file.sub(ReorderChildrenExtension.root, '')
|
23
|
+
directory = File.dirname(path)
|
24
|
+
mkdir_p RAILS_ROOT + directory, :verbose => false
|
25
|
+
cp file, RAILS_ROOT + path, :verbose => false
|
26
|
+
end
|
27
|
+
unless ReorderChildrenExtension.root.starts_with? RAILS_ROOT # don't need to copy vendored tasks
|
28
|
+
puts "Copying rake tasks from ReorderChildrenExtension"
|
29
|
+
local_tasks_path = File.join(RAILS_ROOT, %w(lib tasks))
|
30
|
+
mkdir_p local_tasks_path, :verbose => false
|
31
|
+
Dir[File.join ReorderChildrenExtension.root, %w(lib tasks *.rake)].each do |file|
|
32
|
+
cp file, local_tasks_path, :verbose => false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Syncs all available translations for this ext to the English ext master"
|
38
|
+
task :sync => :environment do
|
39
|
+
# The main translation root, basically where English is kept
|
40
|
+
language_root = ReorderChildrenExtension.root + "/config/locales"
|
41
|
+
words = TranslationSupport.get_translation_keys(language_root)
|
42
|
+
|
43
|
+
Dir["#{language_root}/*.yml"].each do |filename|
|
44
|
+
next if filename.match('_available_tags')
|
45
|
+
basename = File.basename(filename, '.yml')
|
46
|
+
puts "Syncing #{basename}"
|
47
|
+
(comments, other) = TranslationSupport.read_file(filename, basename)
|
48
|
+
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
|
49
|
+
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
|
50
|
+
TranslationSupport.write_file(filename, basename, comments, other)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "radiant-reorder_children-extension/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "radiant-reorder_children-extension"
|
7
|
+
s.version = RadiantReorderChildrenExtension::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Benny Degezelle"]
|
10
|
+
s.email = ["benny@gorilla-webdesign.be"]
|
11
|
+
s.homepage = "http://github.com/jomz/radiant-reorder_children-extension"
|
12
|
+
s.summary = %q{Reorder Children for Radiant CMS}
|
13
|
+
s.description = %q{Makes Radiant better by adding reorder_children!}
|
14
|
+
|
15
|
+
ignores = if File.exist?('.gitignore')
|
16
|
+
File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
|
17
|
+
else
|
18
|
+
[]
|
19
|
+
end
|
20
|
+
s.files = Dir['**/*'] - ignores
|
21
|
+
s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - ignores
|
22
|
+
# s.executables = Dir['bin/*'] - ignores
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
|
25
|
+
s.post_install_message = %{
|
26
|
+
Add this to your radiant project with:
|
27
|
+
config.gem 'radiant-reorder_children-extension', :version => '~>#{RadiantReorderChildrenExtension::VERSION}'
|
28
|
+
}
|
29
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
begin
|
2
|
+
require_dependency 'application_controller'
|
3
|
+
rescue MissingSourceFile
|
4
|
+
require_dependency 'application'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'radiant-reorder_children-extension/version'
|
8
|
+
class ReorderChildrenExtension < Radiant::Extension
|
9
|
+
version RadiantReorderChildrenExtension::VERSION
|
10
|
+
description "Adds the ability to reorder the children of a page."
|
11
|
+
url "http://github.com/jomz/radiant-reorder_children-extension"
|
12
|
+
|
13
|
+
# extension_config do |config|
|
14
|
+
# config.gem 'some-awesome-gem'
|
15
|
+
# config.after_initialize do
|
16
|
+
# run_something
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
|
20
|
+
def activate
|
21
|
+
admin.page.index.add :sitemap_head, 'reorder_extra_th', :after => "modify_column_header"
|
22
|
+
admin.page.index.add :node, 'reorder_extra_td', :after => "add_child_column"
|
23
|
+
|
24
|
+
Page.send :include, ReorderChildren::PageExtensions, ReorderChildren::RadiusTags
|
25
|
+
Page.reflections[:children].options[:order] = "position ASC"
|
26
|
+
|
27
|
+
StandardTags.class_eval do
|
28
|
+
unless method_defined?(:children_find_options_with_position)
|
29
|
+
def children_find_options_with_position(tag)
|
30
|
+
default_options = children_find_options_without_position(tag)
|
31
|
+
default_options[:order].sub! /published_at/, 'position' if tag.attr.symbolize_keys[:by].nil?
|
32
|
+
default_options
|
33
|
+
end
|
34
|
+
alias_method_chain :children_find_options, :position
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Admin::PagesController.send :include, ReorderChildren::PagesControllerExtensions
|
39
|
+
Admin::PagesController.send :helper, ReorderChildren::PageHelperExtensions
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
unless defined? RADIANT_ROOT
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
case
|
4
|
+
when ENV["RADIANT_ENV_FILE"]
|
5
|
+
require ENV["RADIANT_ENV_FILE"]
|
6
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
7
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
|
8
|
+
else
|
9
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
require "#{RADIANT_ROOT}/spec/spec_helper"
|
13
|
+
|
14
|
+
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
|
15
|
+
|
16
|
+
if File.directory?(File.dirname(__FILE__) + "/matchers")
|
17
|
+
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
|
18
|
+
end
|
19
|
+
|
20
|
+
Spec::Runner.configure do |config|
|
21
|
+
# config.use_transactional_fixtures = true
|
22
|
+
# config.use_instantiated_fixtures = false
|
23
|
+
# config.fixture_path = RAILS_ROOT + '/spec/fixtures'
|
24
|
+
|
25
|
+
# You can declare fixtures for each behaviour like this:
|
26
|
+
# describe "...." do
|
27
|
+
# fixtures :table_a, :table_b
|
28
|
+
#
|
29
|
+
# Alternatively, if you prefer to declare them only once, you can
|
30
|
+
# do so here, like so ...
|
31
|
+
#
|
32
|
+
# config.global_fixtures = :table_a, :table_b
|
33
|
+
#
|
34
|
+
# If you declare global fixtures, be aware that they will be declared
|
35
|
+
# for all of your examples, even those that don't use them.
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-reorder_children-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Benny Degezelle
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-14 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Makes Radiant better by adding reorder_children!
|
23
|
+
email:
|
24
|
+
- benny@gorilla-webdesign.be
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- app/views/admin/pages/_reorder_extra_td.html.haml
|
33
|
+
- app/views/admin/pages/_reorder_extra_th.html.haml
|
34
|
+
- app/views/admin/pages/reorder.html.haml
|
35
|
+
- config/initializers/radiant_config.rb
|
36
|
+
- config/locales/en.yml
|
37
|
+
- config/locales/nl.yml
|
38
|
+
- config/routes.rb
|
39
|
+
- cucumber.yml
|
40
|
+
- features/support/env.rb
|
41
|
+
- features/support/paths.rb
|
42
|
+
- lib/radiant-reorder_children-extension/version.rb
|
43
|
+
- lib/radiant-reorder_children-extension.rb
|
44
|
+
- lib/reorder_children/page_extensions.rb
|
45
|
+
- lib/reorder_children/page_helper_extensions.rb
|
46
|
+
- lib/reorder_children/pages_controller_extensions.rb
|
47
|
+
- lib/reorder_children/radius_tags.rb
|
48
|
+
- lib/tasks/reorder_children_extension_tasks.rake
|
49
|
+
- public/images/admin/reorder.png
|
50
|
+
- public/stylesheets/admin/reorder.css
|
51
|
+
- radiant-reorder_children-extension.gemspec
|
52
|
+
- Rakefile
|
53
|
+
- README.md
|
54
|
+
- reorder_children_extension.rb
|
55
|
+
- spec/spec.opts
|
56
|
+
- spec/spec_helper.rb
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/jomz/radiant-reorder_children-extension
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-reorder_children-extension', :version => '~>1.0.0'\n "
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
requirements: []
|
85
|
+
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 1.3.7
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: Reorder Children for Radiant CMS
|
91
|
+
test_files:
|
92
|
+
- spec/spec.opts
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- features/support/env.rb
|
95
|
+
- features/support/paths.rb
|