19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/helpers/foreman_dlm/dlmlock_helper.rb', line 19
def dlmlock_actions(lock, authorizer)
actions = []
if lock.enabled?
actions << display_link_if_authorized(
_('Disable'),
hash_for_disable_foreman_dlm_dlmlock_path(:id => lock.to_param).merge(auth_object: lock, authorizer: authorizer),
method: :put
)
end
if lock.disabled?
actions << display_link_if_authorized(
_('Enable'),
hash_for_enable_foreman_dlm_dlmlock_path(:id => lock.to_param).merge(auth_object: lock, authorizer: authorizer),
method: :put
)
end
if lock.taken?
actions << display_link_if_authorized(
_('Release'),
hash_for_release_foreman_dlm_dlmlock_path(:id => lock.to_param).merge(auth_object: lock, authorizer: authorizer),
method: :put
)
end
actions << display_delete_if_authorized(hash_for_foreman_dlm_dlmlock_path(:id => lock.to_param).merge(auth_object: lock, authorizer: authorizer), class: 'delete')
actions
end
|