Skip to content
Snippets Groups Projects
Commit 1a59a096 authored by Christopher Guindon's avatar Christopher Guindon
Browse files

Merge branch 'cguindon/main/move-images-with-section' into 'main'

move collaborations images with content

See merge request !42
parents 24ac05e6 bbb1ad33
No related branches found
No related tags found
1 merge request!42move collaborations images with content
Pipeline #18973 passed
...@@ -37,7 +37,7 @@ const weights = { ...@@ -37,7 +37,7 @@ const weights = {
sparkplug: 50, sparkplug: 50,
}; };
// An object which uses WG aliases as keys and logo urls as value. Use this only for WGs which do not yet have a logo. // An object which uses WG aliases as keys and logo urls as value. Use this only for WGs which do not yet have a logo.
const fallbackLogos = {}; const fallbackLogos = {};
const removeDuplicates = (value, index, self) => self.indexOf(value) === index; const removeDuplicates = (value, index, self) => self.indexOf(value) === index;
...@@ -54,7 +54,7 @@ const getWeightedRandomIndex = (weightBuckets, categorizedArrayByWeight) => { ...@@ -54,7 +54,7 @@ const getWeightedRandomIndex = (weightBuckets, categorizedArrayByWeight) => {
const weightBucketSelectionIndex = weightBuckets.indexOf(closest); const weightBucketSelectionIndex = weightBuckets.indexOf(closest);
const weightBucketSelection = weightBuckets[weightBucketSelectionIndex]; const weightBucketSelection = weightBuckets[weightBucketSelectionIndex];
const selectionIndex = Math.floor(Math.random() * categorizedArrayByWeight[weightBucketSelection].length); const selectionIndex = Math.floor(Math.random() * categorizedArrayByWeight[weightBucketSelection].length);
return categorizedArrayByWeight[weightBucketSelection][selectionIndex]; return categorizedArrayByWeight[weightBucketSelection][selectionIndex];
} }
...@@ -112,7 +112,7 @@ async function getWeightedRandomWorkingGroups(count) { ...@@ -112,7 +112,7 @@ async function getWeightedRandomWorkingGroups(count) {
const matchHeightForLogos = (baseElement) => { const matchHeightForLogos = (baseElement) => {
const imgElements = baseElement.querySelectorAll('.weighted-working-group-logo'); const imgElements = baseElement.querySelectorAll('.weighted-working-group-logo');
imgElements.forEach(el => { imgElements.forEach(el => {
el.addEventListener('load', () => { el.addEventListener('load', () => {
$('.weighted-working-group-block-wrapper').matchHeight(); $('.weighted-working-group-block-wrapper').matchHeight();
}); });
...@@ -130,8 +130,8 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { ...@@ -130,8 +130,8 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
const element = document.querySelector('.eclipsefdn-weighted-working-groups'); const element = document.querySelector('.eclipsefdn-weighted-working-groups');
if (!element) return; if (!element) return;
const options = { const options = {
...defaultOptions, ...defaultOptions,
...element.dataset, ...element.dataset,
count: +element.dataset.count count: +element.dataset.count
}; };
...@@ -139,7 +139,7 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { ...@@ -139,7 +139,7 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
element.innerHTML = template({ isFetching: true, items: new Array(options.count) , wrapperClass: options.wrapperClass }) element.innerHTML = template({ isFetching: true, items: new Array(options.count) , wrapperClass: options.wrapperClass })
const [workingGroups, error] = await getWeightedRandomWorkingGroups(options.count); const [workingGroups, error] = await getWeightedRandomWorkingGroups(options.count);
if (error) { if (error) {
element.innerHTML = `<p class="alert alert-danger">Error when attempting to load working groups.</p>`; element.innerHTML = `<p class="alert alert-danger">Error when attempting to load working groups.</p>`;
console.error(error); console.error(error);
...@@ -156,6 +156,6 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => { ...@@ -156,6 +156,6 @@ const getWorkingGroupLogo = ({ alias, logo } = workingGroup) => {
})) }))
}; };
element.innerHTML = template(data); element.innerHTML = template(data);
matchHeightForLogos(element); matchHeightForLogos(element);
})(); })();
\ No newline at end of file
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
<div class="col-md-12 collaborations-collaborating-item-col"> <div class="col-md-12 collaborations-collaborating-item-col">
<div class="collaborations-collaborating-item"> <div class="collaborations-collaborating-item">
<div class="item-icon-wrapper"> <div class="item-icon-wrapper">
<img class="item-icon-bg" src="/images/collaborations/icons/icon-bg.png" alt="" /> <img class="item-icon-bg" src="/collaborations/images/icons/icon-bg.png" alt="" />
<img class="item-icon" src="/images/collaborations/icons/{{ $item.icon }}" alt="" /> <img class="item-icon" src="/collaborations/images/icons/{{ $item.icon }}" alt="" />
</div> </div>
<div class="item-content"> <div class="item-content">
<h3 class="item-content-title">{{ $item.title }}</h3> <h3 class="item-content-title">{{ $item.title }}</h3>
......
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