diff options
author | Jérémy FRERE <frere.jeremy@gmail.com> | 2013-10-24 12:41:20 +0200 |
---|---|---|
committer | Philip Arndt <git@p.arndt.io> | 2015-05-14 09:52:29 +1200 |
commit | a9288cc3bd998d7c179b080f56eccd6a56f59133 (patch) | |
tree | b4658ea330aab2f713151058b40cbbd1f2ac127a /app | |
parent | bb0d3b0da633053c0236bdbe5a9452ae9655fda7 (diff) | |
download | refinerycms-blog-a9288cc3bd998d7c179b080f56eccd6a56f59133.tar.gz refinerycms-blog-a9288cc3bd998d7c179b080f56eccd6a56f59133.tar.bz2 refinerycms-blog-a9288cc3bd998d7c179b080f56eccd6a56f59133.zip |
Adds a button to delete the displayed translation of a blog post
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/refinery/blog/backend.css.scss | 4 | ||||
-rw-r--r-- | app/controllers/refinery/blog/admin/posts_controller.rb | 7 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_form.html.erb | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/app/assets/stylesheets/refinery/blog/backend.css.scss b/app/assets/stylesheets/refinery/blog/backend.css.scss index e14d92b..e4ff700 100644 --- a/app/assets/stylesheets/refinery/blog/backend.css.scss +++ b/app/assets/stylesheets/refinery/blog/backend.css.scss @@ -71,3 +71,7 @@ a#copy_body_link { margin-top: 0; padding-left: 20px; } +.form-actions a.confirm-delete, #content .form-actions a.confirm-delete { + position: relative; + right: auto; +}
\ No newline at end of file diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb index d01bba9..4eeffd0 100644 --- a/app/controllers/refinery/blog/admin/posts_controller.rb +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -75,6 +75,13 @@ module Refinery end end + def delete_translation + find_post + @post.translations.find_by_locale(params[:locale_to_delete]).destroy + flash[:notice] = ::I18n.t('delete_translation_success', :scope => 'refinery.blog.admin.posts.post') + redirect_to refinery.blog_admin_posts_path + end + private def post_params diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb index 1d52c56..5cb061e 100644 --- a/app/views/refinery/blog/admin/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -106,7 +106,14 @@ <%= render "/refinery/admin/form_actions", :f => f, :continue_editing => true, - :delete_title => t('delete', :scope => 'refinery.blog.admin.posts.post') %> + :delete_title => t('delete', :scope => 'refinery.blog.admin.posts.post'), + :before_delete_button => (link_to(t('delete_translation', :scope => 'refinery.blog.admin.posts.post'), + refinery.delete_translation_blog_admin_post_path(@post, :locale_to_delete => Globalize.locale), + :method => :post, + :data => { + :confirm => t('delete_translation_confirmation', :scope => 'refinery.blog.admin.posts.post') + }, + :class => "button confirm-delete") if Refinery::I18n.frontend_locales.many? && @post.translations.size > 1) %> <% end -%> <% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> |