3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/helpers/foreman_probing/scans_helper.rb', line 3
def scan_task_buttons(scan)
task = scan.task
task_authorizer = Authorizer.new(User.current, :collection => [task])
buttons = []
buttons << link_to(_('Rerun'), rerun_foreman_probing_scan_path(scan), :class => 'btn btn-default', :title => _('Refresh this page'))
buttons << link_to(_('Refresh'), {}, :class => 'btn btn-default', :title => _('Refresh this page'))
if authorized_for(:permission => :view_foreman_tasks, :auth_object => task, :authorizer => task_authorizer)
buttons << link_to(_('Task'), foreman_tasks_task_path(task),
:class => 'btn btn-default',
:title => _('See the task details'))
end
if authorized_for(:permission => :edit_foreman_tasks, :auth_object => task, :authorizer => task_authorizer)
buttons << link_to(_('Cancel Task'), cancel_foreman_tasks_task_path(task),
:class => 'btn btn-danger',
:title => _('Try to cancel the task'),
:disabled => !task.cancellable?,
:method => :post)
end
return buttons
end
|