Skip to content
Snippets Groups Projects
Verified Commit a50741de authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge remote-tracking branch 'ce-com/master' into ce-to-ee

parents 251d0116 56ea45ef
No related branches found
No related tags found
1 merge request!1225CE upstream
Pipeline #
Showing
with 100 additions and 79 deletions
Loading
Loading
@@ -5,7 +5,7 @@ require:
inherit_from: .rubocop_todo.yml
 
AllCops:
TargetRubyVersion: 2.1
TargetRubyVersion: 2.3
# Cop names are not d§splayed in offense messages by default. Change behavior
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
# option.
Loading
Loading
Loading
Loading
@@ -67,16 +67,8 @@
 
Build.prototype.initSidebar = function() {
this.$sidebar = $('.js-build-sidebar');
this.sidebarTranslationLimits = {
min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight()
};
this.sidebarTranslationLimits.max = this.sidebarTranslationLimits.min + $('.scrolling-tabs-container').outerHeight();
this.$sidebar.css({
top: this.sidebarTranslationLimits.max
});
this.$sidebar.niceScroll();
this.$document.off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar);
this.$document.off('scroll.translateSidebar').on('scroll.translateSidebar', this.translateSidebar.bind(this));
};
 
Build.prototype.location = function() {
Loading
Loading
@@ -231,14 +223,6 @@
return bootstrapBreakpoint === 'xs' || bootstrapBreakpoint === 'sm';
};
 
Build.prototype.translateSidebar = function(e) {
var newPosition = this.sidebarTranslationLimits.max - (document.body.scrollTop || document.documentElement.scrollTop);
if (newPosition < this.sidebarTranslationLimits.min) newPosition = this.sidebarTranslationLimits.min;
this.$sidebar.css({
top: newPosition
});
};
Build.prototype.toggleSidebar = function(shouldHide) {
var shouldShow = typeof shouldHide === 'boolean' ? !shouldHide : undefined;
this.$buildScroll.toggleClass('sidebar-expanded', shouldShow)
Loading
Loading
@@ -285,7 +269,7 @@
e.preventDefault();
$currentTarget = $(e.currentTarget);
$.scrollTo($currentTarget.attr('href'), {
offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
offset: 0
});
};
 
Loading
Loading
Loading
Loading
@@ -181,7 +181,7 @@ const Vue = require('vue');
}
 
$.scrollTo($target, {
offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
offset: 0
});
}
},
Loading
Loading
Loading
Loading
@@ -72,27 +72,18 @@
// This is required to handle non-unicode characters in hash
hash = decodeURIComponent(hash);
 
var navbar = document.querySelector('.navbar-gitlab');
var subnav = document.querySelector('.layout-nav');
var fixedTabs = document.querySelector('.js-tabs-affix');
var adjustment = 0;
if (navbar) adjustment -= navbar.offsetHeight;
if (subnav) adjustment -= subnav.offsetHeight;
// scroll to user-generated markdown anchor if we cannot find a match
if (document.getElementById(hash) === null) {
var target = document.getElementById('user-content-' + hash);
if (target && target.scrollIntoView) {
target.scrollIntoView(true);
window.scrollBy(0, adjustment);
}
} else {
// only adjust for fixedTabs when not targeting user-generated content
var fixedTabs = document.querySelector('.js-tabs-affix');
if (fixedTabs) {
adjustment -= fixedTabs.offsetHeight;
window.scrollBy(0, -fixedTabs.offsetHeight);
}
window.scrollBy(0, adjustment);
}
};
 
Loading
Loading
@@ -147,12 +138,10 @@
 
gl.utils.scrollToElement = function($el) {
var top = $el.offset().top;
gl.navBarHeight = gl.navBarHeight || $('.navbar-gitlab').height();
gl.navLinksHeight = gl.navLinksHeight || $('.nav-links').height();
gl.mrTabsHeight = gl.mrTabsHeight || $('.merge-request-tabs').height();
 
return $('body, html').animate({
scrollTop: top - (gl.navBarHeight + gl.navLinksHeight + gl.mrTabsHeight)
scrollTop: top - (gl.mrTabsHeight)
}, 200);
};
 
Loading
Loading
Loading
Loading
@@ -115,8 +115,8 @@ require('./merge_request_tabs');
e.preventDefault();
 
textarea.val(textarea.data('messageWithDescription'));
$('p.js-with-description-hint').hide();
$('p.js-without-description-hint').show();
$('.js-with-description-hint').hide();
$('.js-without-description-hint').show();
});
 
$(document).on('click', 'a.js-without-description-link', function(e) {
Loading
Loading
@@ -124,8 +124,8 @@ require('./merge_request_tabs');
e.preventDefault();
 
textarea.val(textarea.data('messageWithoutDescription'));
$('p.js-with-description-hint').show();
$('p.js-without-description-hint').hide();
$('.js-with-description-hint').show();
$('.js-without-description-hint').hide();
});
};
 
Loading
Loading
Loading
Loading
@@ -125,9 +125,8 @@ require('./flash');
if (this.diffViewType() === 'parallel') {
this.expandViewContainer();
}
const navBarHeight = $('.navbar-gitlab').outerHeight();
$.scrollTo('.merge-request-details .merge-request-tabs', {
offset: -navBarHeight,
offset: 0,
});
} else {
this.expandView();
Loading
Loading
@@ -140,11 +139,7 @@ require('./flash');
 
scrollToElement(container) {
if (location.hash) {
const offset = 0 - (
$('.navbar-gitlab').outerHeight() +
$('.layout-nav').outerHeight() +
$('.js-tabs-affix').outerHeight()
);
const offset = -$('.js-tabs-affix').outerHeight();
const $el = $(`${container} ${location.hash}:not(.match)`);
if ($el.length) {
$.scrollTo($el[0], { offset });
Loading
Loading
@@ -330,14 +325,12 @@ require('./flash');
if (Breakpoints.get().getBreakpointSize() === 'xs' || !$tabs.length) return;
 
const $diffTabs = $('#diff-notes-app');
const $fixedNav = $('.navbar-fixed-top');
const $layoutNav = $('.layout-nav');
 
$tabs.off('affix.bs.affix affix-top.bs.affix')
.affix({
offset: {
top: () => (
$diffTabs.offset().top - $tabs.height() - $fixedNav.height() - $layoutNav.height()
$diffTabs.offset().top - $tabs.height()
),
},
})
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@
const sidebarBreakpoint = 1024;
 
const pageSelector = '.page-with-sidebar';
const navbarSelector = '.navbar-fixed-top';
const navbarSelector = '.navbar-gitlab';
const sidebarWrapperSelector = '.sidebar-wrapper';
const sidebarContentSelector = '.nav-sidebar';
 
Loading
Loading
@@ -35,13 +35,16 @@
window.innerWidth >= sidebarBreakpoint &&
$(pageSelector).hasClass(expandedPageClass)
);
$(window).on('resize', () => this.setSidebarHeight());
$(document)
.on('click', sidebarToggleSelector, () => this.toggleSidebar())
.on('click', pinnedToggleSelector, () => this.togglePinnedState())
.on('click', 'html, body, a, button', (e) => this.handleClickEvent(e))
.on('DOMContentLoaded', () => this.renderState())
.on('scroll', () => this.setSidebarHeight())
.on('todo:toggle', (e, count) => this.updateTodoCount(count));
this.renderState();
this.setSidebarHeight();
}
 
handleClickEvent(e) {
Loading
Loading
@@ -64,6 +67,16 @@
this.renderState();
}
 
setSidebarHeight() {
const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight();
const diff = $navHeight - $('body').scrollTop();
if (diff > 0) {
$('.js-right-sidebar').outerHeight($(window).height() - diff);
} else {
$('.js-right-sidebar').outerHeight('100%');
}
}
togglePinnedState() {
this.isPinned = !this.isPinned;
if (!this.isPinned) {
Loading
Loading
Loading
Loading
@@ -222,6 +222,10 @@ header {
float: right;
border-top: none;
 
@media (min-width: $screen-md-min) {
padding: 0;
}
@media (max-width: $screen-xs-max) {
float: none;
}
Loading
Loading
@@ -272,7 +276,7 @@ header {
 
.header-user {
.dropdown-menu-nav {
width: 140px;
min-width: 140px;
margin-top: -5px;
}
}
Loading
Loading
Loading
Loading
@@ -283,10 +283,7 @@
}
 
.layout-nav {
position: fixed;
top: $header-height;
width: 100%;
z-index: 11;
background: $gray-light;
border-bottom: 1px solid $border-color;
transition: padding $sidebar-transition-duration;
Loading
Loading
@@ -419,15 +416,20 @@
}
 
.page-with-layout-nav {
margin-top: $header-height + 2;
.right-sidebar {
top: ($header-height * 2) + 2;
}
.build-sidebar {
top: ($header-height * 3) + 3;
&.affix {
top: 0;
}
}
}
 
.activities {
.nav-block {
border-bottom: 1px solid $border-color;
 
Loading
Loading
.page-with-sidebar {
padding: $header-height 0 25px;
padding-bottom: 25px;
transition: padding $sidebar-transition-duration;
 
&.page-sidebar-pinned {
Loading
Loading
@@ -208,7 +208,9 @@ header.header-sidebar-pinned {
padding-right: 0;
 
@media (min-width: $screen-sm-min) {
padding-right: $sidebar_collapsed_width;
.content-wrapper {
padding-right: $sidebar_collapsed_width;
}
 
.merge-request-tabs-holder.affix {
right: $sidebar_collapsed_width;
Loading
Loading
@@ -234,7 +236,9 @@ header.header-sidebar-pinned {
}
 
@media (min-width: $screen-md-min) {
padding-right: $gutter_width;
.content-wrapper {
padding-right: $gutter_width;
}
 
&:not(.with-overlay) .merge-request-tabs-holder.affix {
right: $gutter_width;
Loading
Loading
@@ -252,4 +256,9 @@ header.header-sidebar-pinned {
 
.right-sidebar {
border-left: 1px solid $border-color;
&.affix {
position: fixed;
top: 0;
}
}
Loading
Loading
@@ -138,6 +138,13 @@ pre {
margin: 0;
}
 
blockquote {
color: $gl-grayish-blue;
padding: 0 0 0 15px;
margin: 0;
border-left: 3px solid $white-dark;
}
span.highlight_word {
background-color: $highlighted-highlight-word !important;
}
Loading
Loading
Loading
Loading
@@ -332,12 +332,8 @@
 
.issue-boards-sidebar {
&.right-sidebar {
top: 153px;
top: 0;
bottom: 0;
@media (min-width: $screen-sm-min) {
top: 220px;
}
}
 
.issuable-sidebar-header {
Loading
Loading
Loading
Loading
@@ -41,7 +41,6 @@
word-wrap: break-word;
 
.md {
color: $gl-grayish-blue;
font-size: $gl-font-size;
 
.label {
Loading
Loading
Loading
Loading
@@ -189,7 +189,7 @@
}
 
.right-sidebar {
position: fixed;
position: absolute;
top: $header-height;
bottom: 0;
right: 0;
Loading
Loading
Loading
Loading
@@ -96,13 +96,6 @@
padding-right: 4px;
}
 
&.ci-success_with_warnings {
i {
color: $gl-warning;
}
}
@media (max-width: $screen-xs-max) {
flex-wrap: wrap;
}
Loading
Loading
@@ -486,7 +479,7 @@
background-color: $white-light;
 
&.affix {
top: 100px;
top: 0;
left: 0;
z-index: 10;
transition: right .15s;
Loading
Loading
Loading
Loading
@@ -94,6 +94,10 @@
padding: 10px 8px;
}
 
td.stage-cell {
padding: 10px 0;
}
.commit-link {
padding: 9px 8px 10px;
}
Loading
Loading
@@ -291,12 +295,14 @@
height: 22px;
margin: 3px 6px 3px 0;
 
.tooltip {
white-space: nowrap;
// Hack to show a button tooltip inline
button.has-tooltip + .tooltip {
min-width: 105px;
}
 
.tooltip-inner {
padding: 3px 4px;
// Bootstrap way of showing the content inline for anchors.
a.has-tooltip {
white-space: nowrap;
}
 
&:not(:last-child) {
Loading
Loading
Loading
Loading
@@ -171,8 +171,6 @@
.tree-controls {
float: right;
margin-top: 11px;
position: relative;
z-index: 2;
 
.project-action-button {
margin-left: $btn-side-margin;
Loading
Loading
Loading
Loading
@@ -9,6 +9,28 @@ module IssuableCollections
 
private
 
def issuable_meta_data(issuable_collection)
# map has to be used here since using pluck or select will
# throw an error when ordering issuables by priority which inserts
# a new order into the collection.
# We cannot use reorder to not mess up the paginated collection.
issuable_ids = issuable_collection.map(&:id)
issuable_note_count = Note.count_for_collection(issuable_ids, @collection_type)
issuable_votes_count = AwardEmoji.votes_for_collection(issuable_ids, @collection_type)
issuable_ids.each_with_object({}) do |id, issuable_meta|
downvotes = issuable_votes_count.find { |votes| votes.awardable_id == id && votes.downvote? }
upvotes = issuable_votes_count.find { |votes| votes.awardable_id == id && votes.upvote? }
notes = issuable_note_count.find { |notes| notes.noteable_id == id }
issuable_meta[id] = Issuable::IssuableMeta.new(
upvotes.try(:count).to_i,
downvotes.try(:count).to_i,
notes.try(:count).to_i
)
end
end
def issues_collection
issues_finder.execute.preload(:project, :author, :assignee, :labels, :milestone, project: :namespace)
end
Loading
Loading
Loading
Loading
@@ -9,6 +9,9 @@ def issues
.non_archived
.page(params[:page])
 
@collection_type = "Issue"
@issuable_meta_data = issuable_meta_data(@issues)
respond_to do |format|
format.html
format.atom { render layout: false }
Loading
Loading
Loading
Loading
@@ -7,6 +7,9 @@ def merge_requests
 
@merge_requests = merge_requests_collection
.page(params[:page])
@collection_type = "MergeRequest"
@issuable_meta_data = issuable_meta_data(@merge_requests)
end
 
private
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment