Commit 4950f3a5 authored by Luke Bennett's avatar Luke Bennett

Review changes

parent 77ee1428
import $ from 'jquery'; import $ from 'jquery';
import { import {
getSelector, getSelector,
togglePopover,
inserted, inserted,
} from './feature_highlight_helper';
import {
togglePopover,
mouseenter, mouseenter,
debouncedMouseleave, debouncedMouseleave,
} from './feature_highlight_helper'; } from '../shared/popover';
export function setupFeatureHighlightPopover(id, debounceTimeout = 300) { export function setupFeatureHighlightPopover(id, debounceTimeout = 300) {
const $selector = $(getSelector(id)); const $selector = $(getSelector(id));
......
...@@ -3,7 +3,7 @@ import axios from '../lib/utils/axios_utils'; ...@@ -3,7 +3,7 @@ import axios from '../lib/utils/axios_utils';
import { __ } from '../locale'; import { __ } from '../locale';
import Flash from '../flash'; import Flash from '../flash';
import LazyLoader from '../lazy_loader'; import LazyLoader from '../lazy_loader';
import { togglePopover, mouseenter, debouncedMouseleave } from '../shared/popover'; import { togglePopover } from '../shared/popover';
export const getSelector = highlightId => `.js-feature-highlight[data-highlight=${highlightId}]`; export const getSelector = highlightId => `.js-feature-highlight[data-highlight=${highlightId}]`;
...@@ -31,5 +31,3 @@ export function inserted() { ...@@ -31,5 +31,3 @@ export function inserted() {
LazyLoader.loadImage(lazyImg); LazyLoader.loadImage(lazyImg);
} }
} }
export { togglePopover, mouseenter, debouncedMouseleave };
import $ from 'jquery'; import $ from 'jquery';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import flash from './flash'; import flash from './flash';
import { mouseenter, debouncedMouseleave } from './shared/popover'; import { mouseenter, debouncedMouseleave, togglePopover } from './shared/popover';
export default class Milestone { export default class Milestone {
constructor() { constructor() {
...@@ -52,15 +52,21 @@ export default class Milestone { ...@@ -52,15 +52,21 @@ export default class Milestone {
if (!deprecationMesssageContainer) return; if (!deprecationMesssageContainer) return;
const deprecationMessage = deprecationMesssageContainer.querySelector('.milestone-deprecation-message-template').innerHTML; const deprecationMessage = deprecationMesssageContainer.querySelector('.milestone-deprecation-message-template').innerHTML;
const popoverLink = deprecationMesssageContainer.querySelector('.popover-link'); const $popover = $('.popover-link', deprecationMesssageContainer);
const hideOnScroll = togglePopover.bind($popover, false);
$(popoverLink).popover({ $popover.popover({
content: deprecationMessage, content: deprecationMessage,
html: true, html: true,
placement: 'bottom', placement: 'bottom',
trigger: 'manual',
}) })
.on('mouseenter', mouseenter) .on('mouseenter', mouseenter)
.on('mouseleave', debouncedMouseleave()); .on('mouseleave', debouncedMouseleave())
.on('show.bs.popover', () => {
window.addEventListener('scroll', hideOnScroll);
})
.on('hide.bs.popover', () => {
window.removeEventListener('scroll', hideOnScroll);
});
} }
} }
...@@ -24,8 +24,7 @@ export function mouseenter() { ...@@ -24,8 +24,7 @@ export function mouseenter() {
const showedPopover = togglePopover.call($popover, true); const showedPopover = togglePopover.call($popover, true);
if (showedPopover) { if (showedPopover) {
$('.popover') $('.popover').on('mouseleave', mouseleave.bind($popover));
.on('mouseleave', mouseleave.bind($popover));
} }
} }
......
...@@ -754,9 +754,9 @@ $image-comment-cursor-top-offset: 12; ...@@ -754,9 +754,9 @@ $image-comment-cursor-top-offset: 12;
/* /*
Popup Popup
*/ */
$popup-triangle-size: 8px; $popup-triangle-size: 15px;
$popup-triangle-border-size: 1px; $popup-triangle-border-size: 1px;
$popup-box-shadow-color: rgba(90, 90, 90, 0.3); $popup-box-shadow-color: rgba(90, 90, 90, 0.05);
/* /*
Multi file editor Multi file editor
......
...@@ -203,18 +203,21 @@ ...@@ -203,18 +203,21 @@
padding: 0; padding: 0;
} }
.body { .milestone-popover-body {
padding: 8px 15px 8px 30px; padding: $gl-padding-8;
background-color: $gray-light;
} }
.footer { .milestone-popover-footer {
padding: $gl-padding-8 $gl-padding; padding: $gl-padding-8 $gl-padding;
border-top: 1px solid $white-dark; border-top: 1px solid $white-dark;
} }
.instructions-list { .milestone-popover-instructions-list {
padding: 0; padding-left: 2em;
& > li {
padding-left: 1em;
}
} }
} }
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
%div= link_to _('Learn more'), help_page_url('user/project/milestones/index', anchor: 'promoting-project-milestones-to-group-milestones'), class: 'btn btn-default', target: '_blank' %div= link_to _('Learn more'), help_page_url('user/project/milestones/index', anchor: 'promoting-project-milestones-to-group-milestones'), class: 'btn btn-default', target: '_blank'
%template.milestone-deprecation-message-template %template.milestone-deprecation-message-template
.body .milestone-popover-body
%ol.instructions-list.append-bottom-0 %ol.milestone-popover-instructions-list.append-bottom-0
%li= _('Click any <strong>project name</strong> in the project list below to navigate to the project milestone.').html_safe %li= _('Click any <strong>project name</strong> in the project list below to navigate to the project milestone.').html_safe
%li= _('Click the <strong>Promote</strong> button in the top right corner to promote it to a group milestone.').html_safe %li= _('Click the <strong>Promote</strong> button in the top right corner to promote it to a group milestone.').html_safe
.footer= link_to _('Learn more'), help_page_url('user/project/milestones/index', anchor: 'promoting-project-milestones-to-group-milestones'), class: 'btn-link prepend-left-0', target: '_blank' .milestone-popover-footer= link_to _('Learn more'), help_page_url('user/project/milestones/index', anchor: 'promoting-project-milestones-to-group-milestones'), class: 'btn-link prepend-left-0', target: '_blank'
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