aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-06-23 16:03:02 +0200
committerRobert2017-06-23 16:03:02 +0200
commit509a52c5d7d4aae55debab1bdcb8e6a0802f46ff (patch)
tree92444b0e70239abb7e52280d0d7eca5382e52922
parentb7077970a244d00f59ce797ef5b36be774ca3802 (diff)
parent673d546c627dcf3f51a29579fd8e4c705d703ef7 (diff)
downloadchouette-core-509a52c5d7d4aae55debab1bdcb8e6a0802f46ff.tar.bz2
Merge branch '3478_archived_policy'
-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),