Commit f744a5c1 authored by Luke Bennett's avatar Luke Bennett

Added dyanmic position adjustment

Added tooltips for dropdown items

Reverted pretty much everything in favour of a DOM approach

Simplified JS
parent baa3d0b3
...@@ -4,17 +4,6 @@ ...@@ -4,17 +4,6 @@
constructor() { constructor() {
$(document).off('click', '.toggle-pipeline-btn').on('click', '.toggle-pipeline-btn', this.toggleGraph); $(document).off('click', '.toggle-pipeline-btn').on('click', '.toggle-pipeline-btn', this.toggleGraph);
this.addMarginToBuildColumns(); this.addMarginToBuildColumns();
this.initGroupedPipelineTooltips();
}
initGroupedPipelineTooltips() {
$('.dropdown-menu-toggle', $('.grouped-pipeline-dropdown').parent()).each(function() {
const $this = $(this);
$this.tooltip({
title: $this.data('tooltip-title'),
placement: 'bottom'
});
});
} }
toggleGraph() { toggleGraph() {
......
...@@ -360,10 +360,6 @@ ...@@ -360,10 +360,6 @@
&:hover { &:hover {
background-color: $gray-lighter; background-color: $gray-lighter;
.dropdown-menu-toggle {
background-color: transparent;
}
} }
&.playable { &.playable {
...@@ -393,6 +389,15 @@ ...@@ -393,6 +389,15 @@
} }
} }
.tooltip {
white-space: nowrap;
.tooltip-inner {
overflow: hidden;
text-overflow: ellipsis;
}
}
.ci-status-text { .ci-status-text {
width: 135px; width: 135px;
white-space: nowrap; white-space: nowrap;
...@@ -410,6 +415,7 @@ ...@@ -410,6 +415,7 @@
} }
.dropdown-menu-toggle { .dropdown-menu-toggle {
background-color: transparent;
border: none; border: none;
width: auto; width: auto;
padding: 0; padding: 0;
......
...@@ -71,10 +71,10 @@ module CiStatusHelper ...@@ -71,10 +71,10 @@ module CiStatusHelper
Ci::Runner.shared.blank? Ci::Runner.shared.blank?
end end
def render_status_with_link(type, status, path = nil, tooltip_placement: 'auto left', cssclass: '', container: 'body', show_tooltip: true) def render_status_with_link(type, status, path = nil, tooltip_placement: 'auto left', cssclass: '', container: 'body')
klass = "ci-status-link ci-status-icon-#{status.dasherize} #{cssclass}" klass = "ci-status-link ci-status-icon-#{status.dasherize} #{cssclass}"
title = "#{type.titleize}: #{ci_label_for_status(status)}" title = "#{type.titleize}: #{ci_label_for_status(status)}"
data = { toggle: 'tooltip', placement: tooltip_placement, container: container } if show_tooltip data = { toggle: 'tooltip', placement: tooltip_placement, container: container }
if path if path
link_to ci_icon_for_status(status), path, link_to ci_icon_for_status(status), path,
......
- is_playable = subject.playable? && can?(current_user, :update_build, @project) - is_playable = subject.playable? && can?(current_user, :update_build, @project)
- if is_playable - if is_playable
= link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, data: { toggle: 'tooltip', title: "#{subject.name} - play", container: '.pipeline-graph', placement: 'bottom' } do
= render_status_with_link('build', 'play') = render_status_with_link('build', 'play')
.ci-status-text= subject.name .ci-status-text= subject.name
- elsif can?(current_user, :read_build, @project) - elsif can?(current_user, :read_build, @project)
= link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do = 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.ci-status-icon %span.ci-status-icon
= render_status_with_link('build', subject.status) = render_status_with_link('build', subject.status)
.ci-status-text= subject.name .ci-status-text= subject.name
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- is_playable = status.playable? && can?(current_user, :update_build, @project) - is_playable = status.playable? && can?(current_user, :update_build, @project)
%li.build{ class: ("playable" if is_playable) } %li.build{ class: ("playable" if is_playable) }
.curve .curve
.build-content{ { data: { toggle: 'tooltip', title: "#{group_name} - #{status.status}", placement: 'bottom' } } } .build-content
= render "projects/#{status.to_partial_path}_pipeline", subject: status = render "projects/#{status.to_partial_path}_pipeline", subject: status
- else - else
%li.build %li.build
......
- group_status = CommitStatus.where(id: subject).status - group_status = CommitStatus.where(id: subject).status
%button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown' } } %button.dropdown-menu-toggle.has-tooltip{ type: 'button', data: { toggle: 'dropdown', title: "#{name} - #{group_status}" } }
%span.ci-status-icon %span.ci-status-icon
= render_status_with_link('build', group_status) = render_status_with_link('build', group_status)
%span.ci-status-text %span.ci-status-text
......
- if subject.target_url %a{ data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.pipeline-graph', placement: 'bottom' } }
- if subject.target_url
= link_to subject.target_url do = link_to subject.target_url do
%span.ci-status-icon %span.ci-status-icon
= render_status_with_link('commit status', subject.status) = render_status_with_link('commit status', subject.status)
%span.ci-status-text= subject.name %span.ci-status-text= subject.name
- else - else
%span.ci-status-icon %span.ci-status-icon
= render_status_with_link('commit status', subject.status) = render_status_with_link('commit status', subject.status)
%span.ci-status-text= subject.name %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