diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-08 18:19:17 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-08 18:19:17 +0100 |
commit | 203c9040571944f573d18db2bd477521b6c76535 (patch) | |
tree | a8783aeecbff29cd22d4dc7209d6161c66dab7c0 /app | |
parent | 7c6984752fb6557ac754bb13a554f9b76ee39989 (diff) | |
download | gitlab-ce-203c9040571944f573d18db2bd477521b6c76535.tar.gz |
Add icon_with_name_and_action and use it everywhere
Diffstat (limited to 'app')
4 files changed, 19 insertions, 41 deletions
diff --git a/app/views/ci/status/_icon_with_name.html.haml b/app/views/ci/status/_icon_with_name.html.haml new file mode 100644 index 00000000000..028e1fe9402 --- /dev/null +++ b/app/views/ci/status/_icon_with_name.html.haml @@ -0,0 +1,11 @@ +- detailed_status = subject.detailed_status(current_user) +- details_path = detailed_status.details_path if detailed_status.has_details? +- klass = "ci-status-icon ci-status-icon-#{detailed_status}" + +- if details_path + = link_to details_path, class: klass, data: { toggle: 'tooltip', title: "#{subject.name} - #{detailed_status}" } do + %span{ class: klass }= custom_icon(detailed_status.icon) + .ci-status-text= subject.name +- else + %span{ class: klass }= custom_icon(detailed_status.icon) + .ci-status-text= subject.name diff --git a/app/views/ci/status/_icon_with_name_and_action.html.haml b/app/views/ci/status/_icon_with_name_and_action.html.haml new file mode 100644 index 00000000000..76db3b7f38a --- /dev/null +++ b/app/views/ci/status/_icon_with_name_and_action.html.haml @@ -0,0 +1,8 @@ += render "ci/status/icon_with_name", subject: subject + +- detailed_status = subject.detailed_status(current_user) +- if detailed_status.has_action? + = link_to detailed_status.action_path, method: detailed_status.action_method, + title: "#{subject.name}: #{detailed_status.action_title}", class: 'ci-action-icon-container' do + %i.ci-action-icon-wrapper + = icon(detailed_status.action_icon, class: detailed_status.action_class) diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml deleted file mode 100644 index 41b9265fe5e..00000000000 --- a/app/views/projects/ci/builds/_build_pipeline.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -- is_playable = subject.playable? && can?(current_user, :update_build, @project) -- can_cancel = subject.active? && can?(current_user, :update_build, @project) -- can_retry = subject.retryable? && can?(current_user, :update_build, @project) -- can_stop = subject.complete? && subject.stops_environment? && can?(current_user, :update_build, @project) - -- if can?(current_user, :read_build, @project) - = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject), data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.pipeline-graph', placement: 'bottom' } do - %span{class: "ci-status-icon ci-status-icon-#{subject.status}"} - = ci_icon_for_status(subject.status) - .ci-status-text= subject.name - - - if is_playable - = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: "#{subject.name} - Play", class: 'ci-action-icon-container' do - %i.ci-action-icon-wrapper - = icon('play', class: 'ci-play-icon') - - elsif can_cancel - = link_to cancel_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: "#{subject.name} - Cancel", class: 'ci-action-icon-container' do - %i.ci-action-icon-wrapper - = icon('ban') - - elsif can_retry - = link_to retry_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: "#{subject.name} - Retry", class: 'ci-action-icon-container' do - %i.ci-action-icon-wrapper - = icon('refresh') - - elsif can_stop - = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: "#{subject.name} - Stop", class: 'ci-action-icon-container' do - %i.ci-action-icon-wrapper - = icon('stop') - -- else - %span{class: "ci-status-icon ci-status-icon-#{subject.status}"} - = ci_icon_for_status(subject.status) diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml deleted file mode 100644 index 7b82d913d29..00000000000 --- a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%a{ data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.pipeline-graph', placement: 'bottom' } } - - if subject.target_url - = link_to subject.target_url do - %span{class: "ci-status-icon ci-status-icon-#{subject.status}"} - = ci_icon_for_status(subject.status) - %span.ci-status-text= subject.name - - else - %span{class: "ci-status-icon ci-status-icon-#{subject.status}"} - = ci_icon_for_status(subject.status) - %span.ci-status-text= subject.name |