Commit bb3d3e54 authored by Clement Ho's avatar Clement Ho

Fix tooltips

parent ceb9f767
import $ from 'jquery'; import $ from 'jquery';
import Popper from 'popper.js/dist/umd/popper';
// bootstrap jQuery plugins // bootstrap jQuery plugins
import 'bootstrap-sass/assets/javascripts/bootstrap/affix'; import 'bootstrap/dist/js/bootstrap.bundle';
import 'bootstrap-sass/assets/javascripts/bootstrap/alert';
import 'bootstrap-sass/assets/javascripts/bootstrap/button';
import 'bootstrap-sass/assets/javascripts/bootstrap/dropdown';
import 'bootstrap-sass/assets/javascripts/bootstrap/modal';
import 'bootstrap-sass/assets/javascripts/bootstrap/tab';
import 'bootstrap-sass/assets/javascripts/bootstrap/transition';
import 'bootstrap-sass/assets/javascripts/bootstrap/tooltip';
import 'bootstrap-sass/assets/javascripts/bootstrap/popover';
// custom jQuery functions // custom jQuery functions
$.fn.extend({ $.fn.extend({
disable() { return $(this).prop('disabled', true).addClass('disabled'); }, disable() { return $(this).prop('disabled', true).addClass('disabled'); },
enable() { return $(this).prop('disabled', false).removeClass('disabled'); }, enable() { return $(this).prop('disabled', false).removeClass('disabled'); },
}); });
// Enable Bootstrap tooltips
$('[data-toggle="tooltip"]').tooltip();
...@@ -136,7 +136,6 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -136,7 +136,6 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
// Initialize tooltips // Initialize tooltips
$.fn.tooltip.Constructor.DEFAULTS.trigger = 'hover';
$body.tooltip({ $body.tooltip({
selector: '.has-tooltip, [data-toggle="tooltip"]', selector: '.has-tooltip, [data-toggle="tooltip"]',
placement(tip, el) { placement(tip, el) {
......
...@@ -92,7 +92,7 @@ module CiStatusHelper ...@@ -92,7 +92,7 @@ module CiStatusHelper
"pipeline-status/#{pipeline_status.sha}-#{pipeline_status.status}" "pipeline-status/#{pipeline_status.sha}-#{pipeline_status.status}"
end end
def render_project_pipeline_status(pipeline_status, tooltip_placement: 'auto left') def render_project_pipeline_status(pipeline_status, tooltip_placement: 'left')
project = pipeline_status.project project = pipeline_status.project
path = pipelines_project_commit_path(project, pipeline_status.sha, ref: pipeline_status.ref) path = pipelines_project_commit_path(project, pipeline_status.sha, ref: pipeline_status.ref)
...@@ -103,7 +103,7 @@ module CiStatusHelper ...@@ -103,7 +103,7 @@ module CiStatusHelper
tooltip_placement: tooltip_placement) tooltip_placement: tooltip_placement)
end end
def render_commit_status(commit, ref: nil, tooltip_placement: 'auto left') def render_commit_status(commit, ref: nil, tooltip_placement: 'left')
project = commit.project project = commit.project
path = pipelines_project_commit_path(project, commit, ref: ref) path = pipelines_project_commit_path(project, commit, ref: ref)
...@@ -114,7 +114,7 @@ module CiStatusHelper ...@@ -114,7 +114,7 @@ module CiStatusHelper
tooltip_placement: tooltip_placement) tooltip_placement: tooltip_placement)
end end
def render_pipeline_status(pipeline, tooltip_placement: 'auto left') def render_pipeline_status(pipeline, tooltip_placement: 'left')
project = pipeline.project project = pipeline.project
path = project_pipeline_path(project, pipeline) path = project_pipeline_path(project, pipeline)
render_status_with_link('pipeline', pipeline.status, path, tooltip_placement: tooltip_placement) render_status_with_link('pipeline', pipeline.status, path, tooltip_placement: tooltip_placement)
...@@ -125,7 +125,7 @@ module CiStatusHelper ...@@ -125,7 +125,7 @@ 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') def render_status_with_link(type, status, path = nil, tooltip_placement: '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 } data = { toggle: 'tooltip', placement: tooltip_placement, container: container }
......
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