diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-08 10:40:56 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-12 12:59:01 +0100 |
commit | 516dc7a5be3624f1866fa46f19f6472e2f9fae22 (patch) | |
tree | e00fc4a90befc0488a8a9fea828b334009ef88c2 /lib/gitlab/ci/status/build/common.rb | |
parent | 633e64382d30674fecb1aaf138d18c73827c9a40 (diff) | |
download | gitlab-ce-516dc7a5be3624f1866fa46f19f6472e2f9fae22.tar.gz |
Improve actions
Diffstat (limited to 'lib/gitlab/ci/status/build/common.rb')
-rw-r--r-- | lib/gitlab/ci/status/build/common.rb | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/lib/gitlab/ci/status/build/common.rb b/lib/gitlab/ci/status/build/common.rb index d3d7e03ee3f..2bed68d1a11 100644 --- a/lib/gitlab/ci/status/build/common.rb +++ b/lib/gitlab/ci/status/build/common.rb @@ -13,33 +13,23 @@ module Gitlab @subject.pipeline) end - def action_type - case - when @subject.playable? then :playable - when @subject.active? then :cancel - when @subject.retryable? then :retry - end - end - def has_action?(current_user) - action_type && can?(current_user, :update_build, @subject) + (subject.cancelable? || subject.retryable?) && + can?(current_user, :update_build, @subject) end def action_icon - case action_type - when :playable then 'remove' - when :cancel then 'icon_play' - when :retry then 'repeat' + case + when subject.cancelable? then 'icon_play' + when subject.retryable? then 'repeat' end end def action_path - case action_type - when :playable - play_namespace_project_build_path(subject.project.namespace, subject.project, subject) - when :cancel + case + when subject.cancelable? cancel_namespace_project_build_path(subject.project.namespace, subject.project, subject) - when :retry + when subject.retryable? retry_namespace_project_build_path(subject.project.namespace, subject.project, subject) end end |