Commit 6cc4b53897170ee345cdefa7f7669ba893f2b115
Committed by
Fabio Teixeira
1 parent
ff2b2b83
Exists in
fix_cloned_article_parent
Article cloned passing parent by options
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Simiao Carvalho <simiaosimis@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Showing
3 changed files
with
3 additions
and
2 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -157,7 +157,7 @@ class CmsController < MyProfileController | @@ -157,7 +157,7 @@ class CmsController < MyProfileController | ||
157 | 157 | ||
158 | @article = if params[:clone] | 158 | @article = if params[:clone] |
159 | current_article = profile.articles.find(params[:id]) | 159 | current_article = profile.articles.find(params[:id]) |
160 | - current_article.copy_without_save | 160 | + current_article.copy_without_save({:parent_id => @parent_id}) |
161 | else | 161 | else |
162 | klass.new(article_data) | 162 | klass.new(article_data) |
163 | end | 163 | end |
app/models/article.rb
@@ -605,6 +605,7 @@ class Article < ActiveRecord::Base | @@ -605,6 +605,7 @@ class Article < ActiveRecord::Base | ||
605 | ATTRIBUTES_NOT_COPIED = [ | 605 | ATTRIBUTES_NOT_COPIED = [ |
606 | :id, | 606 | :id, |
607 | :profile_id, | 607 | :profile_id, |
608 | + :parent_id, | ||
608 | :path, | 609 | :path, |
609 | :slug, | 610 | :slug, |
610 | :updated_at, | 611 | :updated_at, |
app/views/content_viewer/_article_toolbar.html.erb
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | <%= modal_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %> | 32 | <%= modal_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %> |
33 | 33 | ||
34 | <% content = content_tag('span', label_for_clone_article(@page)) %> | 34 | <% content = content_tag('span', label_for_clone_article(@page)) %> |
35 | - <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'new', :id => @page.id, :clone => true, :type => @page.class }) %> | 35 | + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'new', :id => @page.id, :clone => true, :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)), :type => @page.type}) %> |
36 | <%= expirable_button @page, :clone, content, url %> | 36 | <%= expirable_button @page, :clone, content, url %> |
37 | <% end %> | 37 | <% end %> |
38 | 38 |