Commit 203c9040 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add icon_with_name_and_action and use it everywhere

parent 7c698475
- 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
= 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)
- 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)
%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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment