aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/decorators/referential_decorator.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb
index 9107de0b3..b95b04f9f 100644
--- a/app/decorators/referential_decorator.rb
+++ b/app/decorators/referential_decorator.rb
@@ -17,15 +17,6 @@ class ReferentialDecorator < Draper::Decorator
end
if h.policy(object).edit?
- links << HTMLElement.new(
- :button,
- 'Purger',
- type: 'button',
- data: {
- toggle: 'modal',
- target: '#purgeModal'
- }
- )
if object.archived?
links << Link.new(
@@ -34,6 +25,15 @@ class ReferentialDecorator < Draper::Decorator
method: :put
)
else
+ links << HTMLElement.new(
+ :button,
+ 'Purger',
+ type: 'button',
+ data: {
+ toggle: 'modal',
+ target: '#purgeModal'
+ }
+ )
links << Link.new(
content: h.t('actions.archive'),
href: h.archive_referential_path(object.id),
@@ -42,7 +42,7 @@ class ReferentialDecorator < Draper::Decorator
end
end
- if h.policy(object).destroy?
+ if h.policy(object).destroy? && !object.archived?
links << Link.new(
content: h.destroy_link_content,
href: h.referential_path(object),