radiant-copy_move-extension 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile ADDED
@@ -0,0 +1,53 @@
1
+ h1. CopyMove
2
+
3
+ * Created by: Andrea Franz - http://gravityblast.com
4
+ * Version: 2.3.0 (compatible with Radiant >= 0.9.1)
5
+ * Contact: andrea AT gravityblast DOT com
6
+
7
+ * This fork merged from others, refactored and extended by: Andrew vonderLuft - http://avlux.net
8
+ * Contact: avonderluft AT avlux DOT net
9
+
10
+ h2. Description
11
+
12
+ This extension adds a new action ('CopyMove') in the Radiant's administration interface near the 'Add child' button. With this extension you can copy or move a page with or without its children.
13
+
14
+ h2. Updates
15
+
16
+ * 2.3.0 - 03/2011 - merged updates from othe forks, refactored for Blade UI in Radiant 0.9 or greater - Andrew vonderLuft
17
+
18
+ h2. Requirements
19
+
20
+ * For Radiant versions < 0.6.7 You need the "shards extension":http://groups.google.com/group/radiantcms-dev/browse_frm/thread/d07f7fffd84b3ce0/5efa6fd6c2e1668e?lnk=gst&q=shards#5efa6fd6c2e1668e
21
+ * Radiant versions >= 0.6.7 and greater have Shards built in.
22
+
23
+ h2. Installation
24
+
25
+ # Get the latest version of CopyMove extension code:
26
+
27
+ <pre>
28
+ cd vendor/extensions
29
+ git clone git://github.com/avonderluft/radiant-copy-move.git copy_move
30
+ </pre>
31
+
32
+ ## For Radiant versions < 0.6.7
33
+
34
+ Open the environment.rb and set shards as first extension to be loaded:
35
+ config.extensions = [ :shards, :textile_filter, :markdown_filter, :all ]
36
+
37
+ # From your Rails app root type this command:
38
+ <pre>
39
+ rake RAILS_ENV=production radiant:extensions:copy_move:install
40
+ </pre>
41
+ which will copy some needed files to the public directory of your app.
42
+
43
+ h2. Contributors
44
+
45
+ * Benny Degezelle
46
+ * Mario T. Lanza
47
+ * Daniel Collis-Puro
48
+ * Sean Cribbs
49
+ * Andrew vonderLuft
50
+
51
+ h2. Credits
52
+
53
+ This extension contains icons from the FamFamFam Silk icon set. See http://famfamfam.com/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.3.0
@@ -0,0 +1,13 @@
1
+ - unless simple
2
+ %td.actions
3
+ - if page.respond_to?('children')
4
+ = link_to image('copy-move', :alt => 'CopyMove') + ' ' + t('copy_move.button'), "#copy_move_#{page.id}", :class => "action dropdown"
5
+ %ul.menu{:id => "copy_move_#{page.id}"}
6
+ - if page.children.any?
7
+ %li.copy_page_only= link_to image('page_white') + ' ' + t('copy_move.copy_page_only'), copy_page_path(page.id), :class => 'popup'
8
+ %li.copy_with_first_level_children= link_to image('page_white_copy') + ' ' + t('copy_move.copy_with_first_level_children'), copy_children_path(page.id), :class => 'popup'
9
+ %li.copy_whole_subtree= link_to image('page_white_stack') + ' ' + t('copy_move.copy_whole_subtree'), copy_tree_path(page.id), :class => 'popup'
10
+ %li.move_entire_subtree= link_to image('page_white_go') + ' ' + t('copy_move.move_entire_subtree'), move_page_path(page.id), :class => 'popup'
11
+ - else
12
+ %li.copy_page= link_to image('page_white') + ' ' + t('copy_move.copy_page'), copy_page_path(page.id), :class => 'popup'
13
+ %li.move_page= link_to image('page_white_go') + ' ' + t('copy_move.move_page'), move_page_path(page.id), :class => 'popup'
@@ -0,0 +1,20 @@
1
+ - status_msg = "#{self.request.path_parameters[:action].humanize} is being performed on #{@page.title} page ..."
2
+ - form_tag self.request.path_parameters, :method => :post, 'data-onsubmit_status' => status_msg do
3
+ %p
4
+ %label= "Page: #{@page.title} ( #{@page.path} )"
5
+ %p
6
+ %label= "Parent: #{@page.parent.title} ( #{@page.parent.path} )"
7
+ %hr
8
+ %p
9
+ %label{:for => 'parent_id'}
10
+ New parent:
11
+ = page_parent_select_tag
12
+ %p
13
+ %label{:for => 'status_id'}
14
+ New status:
15
+ = select_tag "status_id", options_for_select(Status.find_all.map{ |s| [s.name, s.id] }.unshift(['Use the same status', nil]))
16
+
17
+ %p.buttons
18
+ = submit_tag "OK"
19
+ = t('or')
20
+ = link_to_function t('cancel'), "$(this).closePopup();"
@@ -0,0 +1,6 @@
1
+ .popup
2
+ %h3.title
3
+ = image('page_white_copy')
4
+ = t('copy_move.copy_with_first_level_children')
5
+ %h4= t('copy_move.copy_children_description')
6
+ = render :partial => 'copy_move_form'
@@ -0,0 +1,6 @@
1
+ .popup
2
+ %h3.title
3
+ = image('page_white')
4
+ = t('copy_move.copy_page_only')
5
+ %h4= t('copy_move.copy_page_description')
6
+ = render :partial => 'copy_move_form'
@@ -0,0 +1,6 @@
1
+ .popup
2
+ %h3.title
3
+ = image('page_white_stack')
4
+ = t('copy_move.copy_whole_subtree')
5
+ %h4= t('copy_move.copy_tree_description')
6
+ = render :partial => 'copy_move_form'
@@ -0,0 +1,13 @@
1
+ .popup
2
+ %h3.title
3
+ = image('page_white_go')
4
+ - if @page.children.any?
5
+ = t('copy_move.move_entire_subtree')
6
+ - else
7
+ = t('copy_move.move_page')
8
+ %h4
9
+ - if @page.children.any?
10
+ = t('copy_move.move_tree_description')
11
+ - else
12
+ = t('copy_move.move_page_description')
13
+ = render :partial => 'copy_move_form'
@@ -1,10 +1,26 @@
1
1
  de:
2
2
  copy_move:
3
+ button: "Copy/Move"
4
+ copy_or_move_page: "Copy or Move Page"
5
+ copy_page: "Copy Page"
6
+ copy_page_only: "Copy Page Only"
7
+ copy_page_description: "This will create a copy of this single page under a new parent"
8
+ copy_whole_subtree: "Copy Whole Subtree"
9
+ copy_tree_description: "This will create a copy of this page and all its descendants under a new parent"
10
+ move_entire_subtree: "Move Entire Subtree"
11
+ move_tree_description: "This will move this page and all its descendants under a new parent"
12
+ move_page: "Move Page"
13
+ move_page_description: "This will move this page under a new parent"
14
+ copy_with_first_level_children: "Copy With First-level Children"
15
+ copy_children_description: "This will create a copy of this page and its immediate first-level children under a new parent"
16
+
3
17
  copied:
4
18
  'Eine Kopie von <strong>{{page}}</strong> wurde unterhalb von <strong>{{parent}}</strong> erstellt.'
19
+ moved:
20
+ 'Page <strong>{{page}}</strong> was moved under <strong>{{parent}}</strong>.'
5
21
  immediate_children_copied:
6
22
  'Eine Kopie der Seite <strong>{{page}}</strong> sowie der unmittelbaren Unterseiten wurde unter <strong>{{parent}}</strong> erstellt.'
7
23
  descendants_copied:
8
24
  'Eine Kopie der Seite <strong>{{page}}</strong> sowie aller Unterseiten wurde unter <strong>{{parent}}</strong> erstellt.'
9
25
  descendants_moved:
10
- 'Die Seite <strong>{{page}}</strong> und alle Unterseiten wurden verschoben in <strong>{{parent}}</strong>.'
26
+ 'Die Seite <strong>{{page}}</strong> und alle Unterseiten wurden verschoben in <strong>{{parent}}</strong>.'
@@ -1,22 +1,26 @@
1
1
  en:
2
2
  copy_move:
3
+ button: "Copy/Move"
4
+ copy_or_move_page: "Copy or Move Page"
5
+ copy_page: "Copy Page"
6
+ copy_page_only: "Copy Page Only"
7
+ copy_page_description: "This will create a copy of this single page under a new parent"
8
+ copy_whole_subtree: "Copy Whole Subtree"
9
+ copy_tree_description: "This will create a copy of this page and all its descendants under a new parent"
10
+ move_entire_subtree: "Move Entire Subtree"
11
+ move_tree_description: "This will move this page and all its descendants under a new parent"
12
+ move_page: "Move Page"
13
+ move_page_description: "This will move this page under a new parent"
14
+ copy_with_first_level_children: "Copy With First-level Children"
15
+ copy_children_description: "This will create a copy of this page and its immediate first-level children under a new parent"
16
+
3
17
  copied:
4
18
  'A copy of <strong>{{page}}</strong> was created under <strong>{{parent}}</strong>.'
5
- copy_page_only:
6
- "Copy this page."
7
- copy_page_and_all_children:
8
- "Copy this page and all of its children."
9
- copy_page_and_direct_children:
10
- "Copy this page and its first-level children."
19
+ moved:
20
+ 'Page <strong>{{page}}</strong> was moved under <strong>{{parent}}</strong>.'
21
+ immediate_children_copied:
22
+ 'Copies of <strong>{{page}}</strong> and its immediate children were created under <strong>{{parent}}</strong>'
11
23
  descendants_copied:
12
24
  'Copies of <strong>{{page}}</strong> and all its descendants were created under <strong>{{parent}}</strong>.'
13
25
  descendants_moved:
14
- 'Page <strong>{{page}}</strong> and all its descendants were moved under <strong>{{parent}}</strong>.'
15
- immediate_children_copied:
16
- 'Copies of <strong>{{page}}</strong> and its immediate children were created under <strong>{{parent}}</strong>'
17
- move_page:
18
- 'Move this page'
19
- move_page_and_children:
20
- 'Move this page and its children'
21
- what_do_you_want_to_do:
22
- 'What do you want to do?'
26
+ 'Page <strong>{{page}}</strong> and all its descendants were moved under <strong>{{parent}}</strong>.'
@@ -1,22 +1,26 @@
1
1
  nl:
2
2
  copy_move:
3
+ button: "Copy/Move"
4
+ copy_page: "Copy Page"
5
+ copy_or_move_page: "Copy or Move Page"
6
+ copy_page_only: "Copy Page Only"
7
+ copy_page_description: "This will create a copy of this single page under a new parent"
8
+ copy_whole_subtree: "Copy Whole Subtree"
9
+ copy_tree_description: "This will create a copy of this page and all its descendants under a new parent"
10
+ move_entire_subtree: "Move Entire Subtree"
11
+ move_tree_description: "This will move this page and all its descendants under a new parent"
12
+ move_page: "Move Page"
13
+ move_page_description: "This will move this page under a new parent"
14
+ copy_with_first_level_children: "Copy With First-level Children"
15
+ copy_children_description: "This will create a copy of this page and its immediate first-level children under a new parent"
16
+
3
17
  copied:
4
18
  'Er werd een kopie van <strong>{{page}}</strong> gemaakt onder <strong>{{parent}}</strong>.'
5
- copy_page_only:
6
- "Pagina kopieëren"
7
- copy_page_and_all_children:
8
- "Pagina en alle child-pagina's kopieëren"
9
- copy_page_and_direct_children:
10
- "Pagina en directe child-pagina's kopieëren"
11
- descendants_copied:
12
- "Kopieën van <strong>{{page}}</strong> en alle onderliggende pagina's zijn gemaakt onder <strong>{{parent}}</strong>"
13
- descendants_moved:
14
- "De pagina <strong>{{page}}</strong> en alle onderliggende pagina's zijn verplaatst onder <strong>{{parent}}</strong>"
19
+ moved:
20
+ 'Page <strong>{{page}}</strong> was moved under <strong>{{parent}}</strong>.'
15
21
  immediate_children_copied:
16
22
  "Kopieën van <strong>{{page}}</strong> en de eerst onderliggende pagina's zijn gemaakt onder <strong>{{parent}}</strong>"
17
- move_page:
18
- 'Pagina verplaatsen'
19
- move_page_and_children:
20
- "Pagina en child-pagina's verplaatsen"
21
- what_do_you_want_to_do:
22
- 'What do you want to do?'
23
+ descendants_copied:
24
+ "Kopieën van <strong>{{page}}</strong> en alle onderliggende pagina's zijn gemaakt onder <strong>{{parent}}</strong>."
25
+ descendants_moved:
26
+ "De pagina <strong>{{page}}</strong> en alle onderliggende pagina's zijn verplaatst onder <strong>{{parent}}</strong>."
data/config/routes.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
- map.with_options(:controller => "admin/pages") do |cm|
3
- cm.copy_page_admin_page '/admin/pages/:id/copy_page', :action => 'copy_page'
4
- cm.copy_children_admin_page '/admin/pages/:id/copy_children', :action => 'copy_children'
5
- cm.copy_tree_admin_page '/admin/pages/:id/copy_tree', :action => 'copy_tree'
6
- cm.move_admin_page '/admin/pages/:id/move', :action => 'move'
2
+ map.with_options(:controller => "admin/pages") do |page|
3
+ page.copy_page '/admin/pages/:id/copy_page', :action => 'copy_page'
4
+ page.copy_children '/admin/pages/:id/copy_children', :action => 'copy_children'
5
+ page.copy_tree '/admin/pages/:id/copy_tree', :action => 'copy_tree'
6
+ page.move_page '/admin/pages/:id/move_page', :action => 'move_page'
7
7
  end
8
- end
8
+ end
@@ -1,9 +1,9 @@
1
1
  require_dependency 'application_controller'
2
2
 
3
3
  class CopyMoveExtension < Radiant::Extension
4
- version "2.1.2"
5
- description "Adds the ability to copy and move a page and all of its children"
6
- url "http://gravityblast.com/projects/radiant-copymove-extension/"
4
+ version "2.3.0"
5
+ description "Adds the ability to copy or move a page with or without its children"
6
+ url "https://github.com/avonderluft/radiant-copy-move"
7
7
 
8
8
  def activate
9
9
  Admin::PagesController.class_eval do
@@ -11,8 +11,7 @@ class CopyMoveExtension < Radiant::Extension
11
11
  helper :copy_move
12
12
  end
13
13
  Page.class_eval { include CopyMove::Model }
14
- admin.page.index.add :sitemap_head, 'copy_move_extra_th'
15
- admin.page.index.add :node, 'copy_move_extra_td', :after => "add_child_column"
16
- admin.page.index.add :bottom, 'copy_move_popup'
14
+ admin.page.index.add :sitemap_head, 'copy_move_extra_th', :before => 'actions_column_header'
15
+ admin.page.index.add :node, 'copy_move_extra_td', :before => 'actions_column'
17
16
  end
18
17
  end
@@ -2,39 +2,67 @@ module CopyMove
2
2
  module Controller
3
3
  def self.included(base)
4
4
  base.class_eval do
5
- before_filter do |c|
6
- c.include_stylesheet 'admin/copy_move'
7
- end
8
- before_filter :load_page, :only => [:copy_page, :copy_children, :copy_tree, :move]
9
- before_filter :load_parent, :only => [:copy_page, :copy_children, :copy_tree, :move]
5
+ before_filter :load_page, :only => [:copy_page, :copy_children, :copy_tree, :move_page]
10
6
  end
11
7
  end
12
8
 
13
9
  def copy_page
14
- @new_page = @page.copy_to(@parent, params[:status_id])
15
- flash[:notice] = I18n.t('copied', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
16
- redirect_to admin_pages_url
10
+ if request.request_method() == :get
11
+ respond_to do |format|
12
+ format.any {render :copy_page, :content_type => "text/html", :layout => false }
13
+ end
14
+ elsif request.request_method() == :post
15
+ load_parent
16
+ @new_page = @page.copy_to(@parent, params[:status_id])
17
+ flash[:notice] = I18n.t('copied', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
18
+ redirect_to admin_pages_url
19
+ end
17
20
  end
18
21
 
19
22
  def copy_children
20
- @new_page = @page.copy_with_children_to(@parent, params[:status_id])
21
- flash[:notice] = I18n.t('immediate_children_copied', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
22
- redirect_to admin_pages_url
23
+ if request.request_method() == :get
24
+ respond_to do |format|
25
+ format.any {render :copy_children, :content_type => "text/html", :layout => false }
26
+ end
27
+ elsif request.request_method() == :post
28
+ load_parent
29
+ @new_page = @page.copy_with_children_to(@parent, params[:status_id])
30
+ flash[:notice] = I18n.t('immediate_children_copied', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
31
+ redirect_to admin_pages_url
32
+ end
23
33
  end
24
34
 
25
35
  def copy_tree
26
- @new_page = @page.copy_tree_to(@parent, params[:status_id])
27
- flash[:notice] = I18n.t('descendants_copied', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
28
- redirect_to admin_pages_url
36
+ if request.request_method() == :get
37
+ respond_to do |format|
38
+ format.any {render :copy_tree, :content_type => "text/html", :layout => false }
39
+ end
40
+ elsif request.request_method() == :post
41
+ load_parent
42
+ @new_page = @page.copy_tree_to(@parent, params[:status_id])
43
+ flash[:notice] = I18n.t('descendants_copied', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
44
+ redirect_to admin_pages_url
45
+ end
29
46
  end
30
47
 
31
- def move
32
- @page.move_under(@parent)
33
- flash[:notice] = I18n.t('descendants_moved', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
34
- redirect_to admin_pages_url
35
- rescue CopyMove::CircularHierarchy => e
36
- flash[:error] = e.message
37
- redirect_to admin_pages_url
48
+ def move_page
49
+ if request.request_method() == :get
50
+ respond_to do |format|
51
+ format.any {render :move_page, :content_type => "text/html", :layout => false }
52
+ end
53
+ elsif request.request_method() == :post
54
+ load_parent
55
+ @page.move_under(@parent, params[:status_id])
56
+ if @page.children.any?
57
+ flash[:notice] = I18n.t('descendants_moved', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
58
+ else
59
+ flash[:notice] = I18n.t('moved', :scope => :copy_move, :page => @page.title, :parent => @parent.title)
60
+ end
61
+ redirect_to admin_pages_url
62
+ end
63
+ rescue CopyMove::CircularHierarchy => e
64
+ flash[:error] = e.message
65
+ redirect_to admin_pages_url
38
66
  end
39
67
 
40
68
  private
@@ -13,9 +13,11 @@ module CopyMove
13
13
  {:slug => test_page.slug, :title => test_page.title, :breadcrumb => test_page.breadcrumb}
14
14
  end
15
15
 
16
- def move_under(parent)
16
+ def move_under(parent, status = nil)
17
17
  raise CircularHierarchy.new(self) if parent == self || parent.ancestors.include?(self)
18
- update_attributes!(:parent_id => parent.id)
18
+ status_id = status.blank? ? self.status_id : status
19
+ update_attributes!(:parent_id => parent.id, :status_id => status_id)
20
+ assume_bottom_position if defined?(Reorder)
19
21
  end
20
22
 
21
23
  def copy_to(parent, status = nil)
@@ -23,6 +25,7 @@ module CopyMove
23
25
  self.parts.each do |part|
24
26
  new_page.parts << part.clone
25
27
  end
28
+ new_page.send :add_to_list_bottom if defined?(Reorder)
26
29
  new_page.status_id = status.blank? ? new_page.status_id : status
27
30
  new_page.save!
28
31
  end
Binary file
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-copy_move-extension}
8
- s.version = "2.2.0"
8
+ s.version = "2.3.0"
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"]
12
- s.date = %q{2010-10-15}
13
- s.description = %q{Allows you to to copy pages or move them under a new parent. }
12
+ s.date = %q{2010-10-14}
13
+ s.description = %q{Adds the ability to copy or move a page with or without its children}
14
14
  s.email = %q{benny@gorilla-webdesign.be}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "app/views/admin/pages/_copy_move_extra_td.haml",
29
29
  "app/views/admin/pages/_copy_move_extra_th.haml",
30
30
  "app/views/admin/pages/_copy_move_popup.haml",
31
+ "app/views/copy_move/index.html.haml",
31
32
  "config/locales/de.yml",
32
33
  "config/locales/en.yml",
33
34
  "config/locales/nl.yml",
@@ -5,7 +5,7 @@ describe Admin::PagesController do
5
5
  before :each do
6
6
  login_as :existing
7
7
  end
8
-
8
+
9
9
  describe "routes" do
10
10
  it "should route URLs to the copy_page action" do
11
11
  route_for(:controller => "admin/pages", :action => "copy_page", :id => "1").should == "/admin/pages/1/copy_page"
@@ -22,9 +22,9 @@ describe Admin::PagesController do
22
22
  params_from(:post, "/admin/pages/1/copy_tree").should == {:controller => "admin/pages", :action => "copy_tree", :id => "1"}
23
23
  end
24
24
 
25
- it "should route URLs to the move action" do
26
- route_for(:controller => "admin/pages", :action => "move", :id => "1").should == "/admin/pages/1/move"
27
- params_from(:post, "/admin/pages/1/move").should == {:controller => "admin/pages", :action => "move", :id => "1"}
25
+ it "should route URLs to the move_page action" do
26
+ route_for(:controller => "admin/pages", :action => "move_page", :id => "1").should == "/admin/pages/1/move_page"
27
+ params_from(:post, "/admin/pages/1/move_page").should == {:controller => "admin/pages", :action => "move_page", :id => "1"}
28
28
  end
29
29
  end
30
30
 
@@ -115,10 +115,10 @@ describe Admin::PagesController do
115
115
  end
116
116
  end
117
117
 
118
- describe "POST to /admin/pages/:id/move" do
118
+ describe "POST to /admin/pages/:id/move_page" do
119
119
  describe "when moving to a valid parent" do
120
120
  before :each do
121
- post :move, :id => page_id(:first), :parent_id => page_id(:another)
121
+ post :move_page, :id => page_id(:first), :parent_id => page_id(:another)
122
122
  end
123
123
 
124
124
  it "should load the page" do
@@ -144,7 +144,7 @@ describe Admin::PagesController do
144
144
 
145
145
  describe "when moving to an invalid parent" do
146
146
  before :each do
147
- post :move, :id => page_id(:parent), :parent_id => page_id(:child)
147
+ post :move_page, :id => page_id(:parent), :parent_id => page_id(:child)
148
148
  end
149
149
 
150
150
  it "should load the page" do
@@ -1,16 +1,16 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe CopyMove do
4
- dataset :pages
5
-
4
+ dataset :pages, :users
5
+
6
6
  describe "suggesting a new slug and title" do
7
7
  it "should use the same slug and title when there is not a child page of the new parent that has the same slug or title" do
8
- pages(:first).new_slug_and_title_under(pages(:parent)).should == {:slug => "first", :title => "First"}
8
+ pages(:first).new_slug_and_title_under(pages(:parent)).should == {:slug => "first", :title => "First", :breadcrumb => "First"}
9
9
  end
10
10
 
11
11
  it "should use a different slug and title when there is a conflicting child page of the new parent" do
12
12
  pages(:first).new_slug_and_title_under(pages(:home)).should_not == {:slug => "first", :title => "First"}
13
- pages(:first).new_slug_and_title_under(pages(:home)).should == {:slug => "first-1", :title => "First (Copy)"}
13
+ pages(:first).new_slug_and_title_under(pages(:home)).should == {:slug => "first-copy-1", :title => "First Copy 1", :breadcrumb => "First Copy 1"}
14
14
  end
15
15
  end
16
16
 
@@ -32,11 +32,14 @@ describe CopyMove do
32
32
  describe "copying the page" do
33
33
  before :each do
34
34
  @page = pages(:first)
35
+ UserActionObserver.current_user = users(:existing)
36
+ @page.update_attribute(:created_by_id, user_id(:existing))
35
37
  end
36
38
 
37
39
  it "should duplicate the page" do
38
40
  @new_page = @page.copy_to(pages(:another))
39
- @page.attributes.delete_if {|k,v| [:id, :parent_id].include?(k.to_sym) }.each do |key,value|
41
+ # adding :position to excluded attributes to temporarily accommodate reorder extension
42
+ @page.attributes.delete_if {|k,v| [:id, :parent_id, :position].include?(k.to_sym) }.each do |key,value|
40
43
  @new_page[key].should == value
41
44
  end
42
45
  @page.parts.each do |part|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-copy_move-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 2.2.0
10
+ version: 2.3.0
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: 2010-10-15 00:00:00 +02:00
18
+ date: 2011-03-15 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,19 +42,23 @@ extensions: []
42
42
 
43
43
  extra_rdoc_files:
44
44
  - LICENSE
45
- - README
45
+ - README.textile
46
46
  - TODO
47
47
  files:
48
48
  - HELP.rdoc
49
49
  - LICENSE
50
- - README
50
+ - README.textile
51
51
  - Rakefile
52
52
  - TODO
53
53
  - VERSION
54
54
  - app/helpers/copy_move_helper.rb
55
- - app/views/admin/pages/_copy_move_extra_td.haml
56
- - app/views/admin/pages/_copy_move_extra_th.haml
57
- - app/views/admin/pages/_copy_move_popup.haml
55
+ - app/views/admin/pages/_copy_move_extra_td.html.haml
56
+ - app/views/admin/pages/_copy_move_extra_th.html.haml
57
+ - app/views/admin/pages/_copy_move_form.html.haml
58
+ - app/views/admin/pages/copy_children.html.haml
59
+ - app/views/admin/pages/copy_page.html.haml
60
+ - app/views/admin/pages/copy_tree.html.haml
61
+ - app/views/admin/pages/move_page.html.haml
58
62
  - config/locales/de.yml
59
63
  - config/locales/en.yml
60
64
  - config/locales/nl.yml
@@ -70,7 +74,6 @@ files:
70
74
  - public/images/admin/page_white_copy.png
71
75
  - public/images/admin/page_white_go.png
72
76
  - public/images/admin/page_white_stack.png
73
- - public/stylesheets/admin/copy_move.css
74
77
  - radiant-copy_move-extension.gemspec
75
78
  - spec/controllers/copy_move_controller_spec.rb
76
79
  - spec/models/copy_move_spec.rb
@@ -81,8 +84,8 @@ homepage: http://github.com/jomz/radiant-comments-extension
81
84
  licenses: []
82
85
 
83
86
  post_install_message:
84
- rdoc_options:
85
- - --charset=UTF-8
87
+ rdoc_options: []
88
+
86
89
  require_paths:
87
90
  - lib
88
91
  required_ruby_version: !ruby/object:Gem::Requirement
data/README DELETED
@@ -1,47 +0,0 @@
1
- = CopyMove
2
-
3
- Created by: Andrea Franz - http://gravityblast.com
4
- Version: 2.1.0
5
- Contact: andrea AT gravityblast DOT com
6
-
7
- This extension adds a new action ('CopyMove') in the Radiant's administration interface near the 'Add child' button. With this extension you can copy or move a page (and all of its children).
8
-
9
- == Requirements
10
-
11
- You need the shards extension for this to work for Radiant versions 0.6.6 and under. Versions 0.6.7 and greater have Shards built in.
12
-
13
- See http://groups.google.com/group/radiantcms-dev/browse_frm/thread/d07f7fffd84b3ce0/5efa6fd6c2e1668e?lnk=gst&q=shards#5efa6fd6c2e1668e
14
-
15
- == Installation
16
-
17
- 1. Get the latest version of CopyMove extension code:
18
-
19
- cd vendor/extensions
20
-
21
- git clone git://github.com/pilu/radiant-copy-move.git copy_move
22
-
23
- 1.a FOR RADIANT VERSION < 0.6.7
24
-
25
- Open the environment.rb and set shards as first extension to be loaded:
26
- config.extensions = [ :shards, :textile_filter, :markdown_filter, :all ]
27
-
28
- 1.b FOR RADIANT VERSION >= 0.6.7
29
-
30
- Shards is already installed and loaded.
31
-
32
- 2. From your Rails app root type this command:
33
-
34
- rake RAILS_ENV=production radiant:extensions:copy_move:install
35
-
36
- Which will copy some needed files to the public directory of your app.
37
-
38
- == Contributors
39
-
40
- Benny Degezelle
41
- Mario T. Lanza
42
- Daniel Collis-Puro
43
- Sean Cribbs
44
-
45
- == Credits
46
-
47
- This extension contains icons from the FamFamFam Silk icon set. See http://famfamfam.com/
@@ -1,13 +0,0 @@
1
- - unless simple
2
- %td.copy-move
3
- - if page.respond_to?('children')
4
- = link_to_function image('copy-move', :alt => 'CopyMove', :style => "margin: 6px 0 -6px 0"), "$$('ul.popup-menu').each(function(ul){ul.hide()});$(this).next('ul').toggle();Event.stop(event);", :class => "action"
5
- %ul.popup-menu{:style => "display:none"}
6
- - if page.children.any?
7
- %li= link_to t('copy_move.copy_page_only'), copy_page_admin_page_url(page), :style =>"background-image: url(/images/admin/page_white.png)"
8
- %li= link_to t('copy_move.copy_page_and_direct_children'), copy_children_admin_page_url(page), :style =>"background-image: url(/images/admin/page_white_copy.png)"
9
- %li= link_to t('copy_move.copy_page_and_all_children'), copy_tree_admin_page_url(page), :style =>"background-image: url(/images/admin/page_white_stack.png)"
10
- %li= link_to t('copy_move.move_page_and_children'), move_admin_page_url(page), :style =>"background-image: url(/images/admin/page_white_go.png)"
11
- - else
12
- %li= link_to t('copy_move.copy_page_only'), copy_page_admin_page_url(page), :style =>"background-image: url(/images/admin/page_white.png)"
13
- %li= link_to t('copy_move.move_page'), move_admin_page_url(page), :style =>"background-image: url(/images/admin/page_white_go.png)"
@@ -1,27 +0,0 @@
1
- - content_for :popups do
2
- #copy-move.popup{:style => "display:none"}
3
- - form_tag '#', :method => :post do
4
- %h3 Copy or move page
5
- %p
6
- %label{:for => 'parent_id'} New parent:
7
- = page_parent_select_tag
8
- %p
9
- %label{:for => 'status_id'} New status:
10
- = select_tag "status_id", options_for_select(Status.find_all.map{ |s| [s.name, s.id] }.unshift(['Use the same status', nil]))
11
- %p.buttons
12
- = submit_tag "OK"
13
- or
14
- = link_to_function "Cancel", "$(this).up('.popup').hide();"
15
- - content_for :page_scripts do
16
- :plain
17
- document.observe('dom:loaded', function(){
18
- $(document.body).observe('click', function(){$$('ul.popup-menu').invoke('hide');});
19
- $$('td.copy-move ul.popup-menu a').each(function(element){
20
- element.observe('click', function(evt){
21
- evt.stop();
22
- element.up('ul').hide();
23
- $('copy-move').centerInViewport();
24
- $('copy-move').show().down('form').setAttribute('action', element.href);
25
- });
26
- });
27
- });
@@ -1,30 +0,0 @@
1
- #content table.index .copy-move {
2
- padding-left:0pt;
3
- width:100px;
4
- }
5
-
6
- td.copy-move {
7
- position: relative; }
8
- td.copy-move ul.popup-menu {
9
- position: absolute;
10
- z-index: 1000;
11
- margin-top: 0.5em;
12
- margin-left: -1.5em;
13
- background: white;
14
- border-width: 1px;
15
- border-color: #bbb;
16
- border-style: solid;
17
- border-bottom: none;
18
- padding: 0; }
19
- td.copy-move ul.popup-menu li {
20
- list-style: none; }
21
- td.copy-move ul.popup-menu li a {
22
- display: block;
23
- padding: 0.5em;
24
- padding-left: 24px;
25
- background-position: 4px center;
26
- background-repeat: no-repeat;
27
- border-bottom: 1px solid #bbb;
28
- color: black; }
29
- td.copy-move ul.popup-menu li a:hover {
30
- background-color: rgb(255, 255, 179); }