Skip to content
Snippets Groups Projects
Commit 000b2169 authored by Olivier Goulet's avatar Olivier Goulet
Browse files

fix: Remove race condition for resizing collaborations

parent 606a6023
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,6 @@ import template from '../templates/weighted-working-groups/working-group-block.m ...@@ -15,7 +15,6 @@ import template from '../templates/weighted-working-groups/working-group-block.m
const defaultOptions = { const defaultOptions = {
count: 1, count: 1,
wrapperClass: ''
} }
// Working groups with a weight of -1 will not be displayed. // Working groups with a weight of -1 will not be displayed.
...@@ -109,16 +108,6 @@ async function getWeightedRandomWorkingGroups(count) { ...@@ -109,16 +108,6 @@ async function getWeightedRandomWorkingGroups(count) {
} }
}; };
const matchHeightForLogos = (baseElement) => {
const imgElements = baseElement.querySelectorAll('.weighted-working-group-logo');
imgElements.forEach(el => {
el.addEventListener('load', () => {
$('.weighted-working-group-block-wrapper').matchHeight();
});
});
}
const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
const fallbackLogo = fallbackLogos[alias]; const fallbackLogo = fallbackLogos[alias];
if (logo === '') return fallbackLogo || ''; if (logo === '') return fallbackLogo || '';
...@@ -136,7 +125,7 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { ...@@ -136,7 +125,7 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
count: +element.dataset.count count: +element.dataset.count
}; };
element.innerHTML = template({ isFetching: true, items: new Array(options.count) , wrapperClass: options.wrapperClass }) element.innerHTML = template({ isFetching: true, items: new Array(options.count) })
const [workingGroups, error] = await getWeightedRandomWorkingGroups(options.count); const [workingGroups, error] = await getWeightedRandomWorkingGroups(options.count);
...@@ -148,7 +137,6 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { ...@@ -148,7 +137,6 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
const data = { const data = {
isFetching: false, isFetching: false,
wrapperClass: options.wrapperClass,
items: workingGroups.map(wg => ({ items: workingGroups.map(wg => ({
title: wg.title, title: wg.title,
logo: getWorkingGroupLogo(wg), logo: getWorkingGroupLogo(wg),
...@@ -157,6 +145,4 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { ...@@ -157,6 +145,4 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
}; };
element.innerHTML = template(data); element.innerHTML = template(data);
// @todo: Race condition $(...).matchHeight is not a function })();
//matchHeightForLogos(element)
})();
\ No newline at end of file
{{#items}} {{#items}}
<div class="weighted-working-group-block-wrapper match-height-item-by-row {{wrapperClass}}"> <div class="weighted-working-group-block-wrapper">
{{#isFetching}} {{#isFetching}}
<div class="weighted-working-group-block weighted-working-group-loading" aria-label="Loading working group website links"> <div class="weighted-working-group-block weighted-working-group-loading" aria-label="Loading working group website links">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i> <i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
</a> </a>
{{/isFetching}} {{/isFetching}}
</div> </div>
{{/items}} {{/items}}
\ No newline at end of file
<section id="join-collaboration" class="container join-collaboration margin-bottom-60"> <section id="join-collaboration" class="container join-collaboration margin-bottom-60">
<h2>Join a Collaboration</h2> <h2>Join a Collaboration</h2>
<div class="row"> <div class="row">
<div class="eclipsefdn-weighted-working-groups" data-wrapper-class="col-sm-8" data-count="3"></div> <div class="eclipsefdn-weighted-working-groups" data-count="3"></div>
<div class="col-xs-24 join-collaboration-button-col"> <div class="col-xs-24 join-collaboration-button-col">
<a class="btn btn-primary join-collaboration-button" href="/org/workinggroups/explore.php" tabindex="0">View All</a> <a class="btn btn-primary join-collaboration-button" href="/org/workinggroups/explore.php" tabindex="0">View All</a>
</div> </div>
......
...@@ -201,7 +201,13 @@ ...@@ -201,7 +201,13 @@
} }
// Join collaboration section // Join collaboration section
.eclipsefdn-weighted-working-groups {
display: flex;
gap: 3rem;
}
.weighted-working-group-block-wrapper { .weighted-working-group-block-wrapper {
width: 100%;
padding-bottom: 2em; padding-bottom: 2em;
} }
......
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