diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index d914917ac4be6f5266fee49493b4a3967862f73f..87171b052b8e88789729523f1c3b825a7408a56c 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -56,7 +56,7 @@ module Admin::ApplicationHelper end def publish_link(object) - return if object.published + return if object.published || cannot?(:publish, object) link_to t('admin.communication.website.publish.button'), [:publish, :admin, object], method: :post, diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 8ff5bcc13d4de05ef9fb3952d3338a8db7bfd2dc..69e10e49220d48b555b62c38f50357be7a4aac9a 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -49,7 +49,7 @@ <%= link_to t('admin.communication.website.publish.button'), publish_admin_communication_website_page_path(@page), class: button_classes, - method: :post unless @page.published + method: :post if !@page.published && can?(:publish, @page) # This is not edit_link @page because of the polymorphism of the special pages, which would create a wrong path %> <% end %>