Commit 54276d39 authored by Phil Hughes's avatar Phil Hughes Committed by Kushal Pandya

Merge branch '33693-protected-branch-dropdowns-cut-off-in-repository-settings-page' into 'master'

Resolve "Protected branch dropdowns cut-off in Repository Settings page"

Closes #33693

See merge request !12247
parent a3acf98e
function expandSectionParent($section, $content) {
$section.addClass('expanded');
$content.off('animationend.expandSectionParent');
}
function expandSection($section) { function expandSection($section) {
$section.find('.js-settings-toggle').text('Close'); $section.find('.js-settings-toggle').text('Close');
$section.find('.settings-content').addClass('expanded').off('scroll').scrollTop(0);
const $content = $section.find('.settings-content');
$content.addClass('expanded').off('scroll.expandSection').scrollTop(0);
if ($content.hasClass('no-animate')) {
expandSectionParent($section, $content);
} else {
$content.on('animationend.expandSectionParent', () => expandSectionParent($section, $content));
}
} }
function closeSection($section) { function closeSection($section) {
$section.find('.js-settings-toggle').text('Expand'); $section.find('.js-settings-toggle').text('Expand');
$section.find('.settings-content').removeClass('expanded').on('scroll', () => expandSection($section));
const $content = $section.find('.settings-content');
$content.removeClass('expanded').on('scroll.expandSection', () => expandSection($section));
$section.removeClass('expanded');
} }
function toggleSection($section) { function toggleSection($section) {
...@@ -21,7 +38,7 @@ function toggleSection($section) { ...@@ -21,7 +38,7 @@ function toggleSection($section) {
export default function initSettingsPanels() { export default function initSettingsPanels() {
$('.settings').each((i, elm) => { $('.settings').each((i, elm) => {
const $section = $(elm); const $section = $(elm);
$section.on('click', '.js-settings-toggle', () => toggleSection($section)); $section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section));
$section.find('.settings-content:not(.expanded)').on('scroll', () => expandSection($section)); $section.find('.settings-content:not(.expanded)').on('scroll.expandSection', () => expandSection($section));
}); });
} }
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
&:first-of-type { &:first-of-type {
margin-top: 10px; margin-top: 10px;
} }
&.expanded {
overflow: visible;
}
} }
.settings-header { .settings-header {
......
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