Skip to content

Commit

Permalink
Merged develop into master for release.
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismeonmounteverest committed Oct 30, 2023
2 parents ee51b7c + d0b80e7 commit b8cbde0
Show file tree
Hide file tree
Showing 157 changed files with 6,912 additions and 5,448 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ ENV COMPOSER_ALLOW_SUPERUSER=1
# install Symfony Flex globally to speed up download of Composer packages (parallelized prefetching)
RUN set -eux; \
composer global config --no-plugins allow-plugins.symfony/flex true; \
composer global require "symfony/flex" --prefer-dist --no-progress --classmap-authoritative; \ composer clear-cache
composer global require "symfony/flex" --prefer-dist --no-progress --classmap-authoritative; \
composer clear-cache
ENV PATH="${PATH}:/root/.composer/vendor/bin"

WORKDIR /srv/bewelcome
Expand Down
2 changes: 1 addition & 1 deletion assets/js/api/avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const uploadTemporaryAvatar = async (file) => {
var form = new FormData();
form.append("avatar", file);

const endpoint = `${window.globals.baseUrl}/members/uploadavatar`;
const endpoint = `${window.globals.baseUrl}members/uploadavatar`;

const response = fetch(endpoint, { method: 'POST', body: form });

Expand Down
19 changes: 14 additions & 5 deletions assets/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ import 'select2/dist/js/select2.full.js';
import '@fortawesome/fontawesome-free/js/all.js';
import './scrollmagic.js';
import './collapsemenu.js';
import {initializeSingleAutoComplete} from './suggest/locations';

$(".select2").select2({
theme: 'bootstrap4',
width: 'auto',
dropdownAutoWidth: true
});
function onChange(element, result) {
const fullName = element;
const baseId = element.id + "_";
const geonameId = document.getElementById(baseId + "geoname_id");
const latitude = document.getElementById(baseId + "latitude");
const longitude = document.getElementById(baseId + "longitude");
fullName.value = result.name.replaceAll("#", ", ");
geonameId.value = result.id;
latitude.value = result.latitude;
longitude.value = result.longitude;
}

initializeSingleAutoComplete("/suggest/locations/all", 'js-location-picker', onChange);
19 changes: 16 additions & 3 deletions assets/js/landing/landing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import SearchPicker from "./../search/searchpicker";

const searchPicker = new SearchPicker( "/search/locations/all");
import {initializeSingleAutoComplete} from '../suggest/locations';

function onChange(element, result) {
const locationFullName = document.getElementById('tiny_location_fullname');
const locationName = document.getElementById('tiny_location_name');
const locationGeonameId = document.getElementById('tiny_location_geoname_id');
const locationLatitude = document.getElementById('tiny_location_latitude');
const locationLongitude = document.getElementById('tiny_location_longitude');
locationFullName.value = result.name.replaceAll("#", ", ");
locationName.value = result.name.split("#")[0];
locationGeonameId.value = result.id;
locationLatitude.value = result.latitude;
locationLongitude.value = result.longitude;
}

initializeSingleAutoComplete("/suggest/locations/all", 'js-location-picker', onChange);

$(document).ready(function() {
if (!$('#conversationsdisplay').length) {
Expand Down
3 changes: 3 additions & 0 deletions assets/js/message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {disableButtonOnSubmit} from './submit_button_disable';

disableButtonOnSubmit();
4 changes: 2 additions & 2 deletions assets/js/profile/setlocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ marker.addTo(map);
map.setView([locationLatitude.value, locationLongitude.value], 12);

// callback when a selection is done from the list of possible results
const addMarkerAndMoveToNewLocation = function(result) {
const addMarkerAndMoveToNewLocation = function(element, result) {
locationGeonameId.value = result.id;
locationLatitude.value = result.latitude;
locationLongitude.value = result.longitude;
Expand All @@ -52,7 +52,7 @@ function dragend(e) {
locationLongitude.value = e.target._latlng.lng;
}

initializeSingleAutoComplete("/suggest/locations/places/exact", 'js-location-picker', '_autocomplete', addMarkerAndMoveToNewLocation);
initializeSingleAutoComplete("/suggest/locations/places/exact", 'js-location-picker', addMarkerAndMoveToNewLocation);

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>',
Expand Down
10 changes: 7 additions & 3 deletions assets/js/react/avatar/Avatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ const Avatar = () => {
We will also find other profile pictures outside of react and update their src
with the new changeCount to fool browser cache and reload the image
*/
const miniAvatarObjectsElements = document.getElementsByClassName('profileimg');
const miniAvatarObjectsElements = document.getElementsByClassName('js-profile-picture');
for (let element of miniAvatarObjectsElements) {
element.src = `${element.src}?${changeCount}`;
if (element.href !== undefined) {
element.href = `${element.href}?${changeCount}`;
} else {
element.src = `${element.src}?${changeCount}`;
}
}
}

Expand All @@ -30,4 +34,4 @@ const Avatar = () => {
</>)
}

export default Avatar;
export default Avatar;
3 changes: 1 addition & 2 deletions assets/js/react/avatar/AvatarChangeButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { uploadTemporaryAvatar } from '../../api/avatar';
import { getText } from '../../utils/texts';
import { alertError, alertSuccess } from '../../utils/alerts';


const AvatarChangeButton = (props) => {
const [uploading, setUploading] = React.useState(false);
const inputFile = React.useRef(null)
Expand All @@ -24,7 +23,7 @@ const AvatarChangeButton = (props) => {
props.onChange();
alertSuccess(getText('profile.change.avatar.success'));
} else if (result?.status === 413) {
alertError(getText('profile.change.avatar.fail.file.to.big'));
alertError(getText('profile.change.avatar.fail.file.too.big'));
} else {
alertError(getText('profile.change.avatar.fail'));
}
Expand Down
16 changes: 5 additions & 11 deletions assets/js/react/avatar/AvatarPicture.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@ import {getText} from '../../utils/texts';

const AvatarPicture = (props) => {
const config = window.globals.config;

const useLightbox = config.avatarUseLightbox;
const basePictureUrl = config.avatarUrl;
const pictureUrl = useLightbox ? `${basePictureUrl}/original` : `/members/avatar/${config.username}/original`;
const avatarOriginalUrl = `${basePictureUrl}/original`;
const pictureUrl = `/members/avatar/${config.username}/500`;
const pictureTitle = getText('profile.picture.title');

const imageStyle = {
// We are adding changeCount here to make browser skip it's cache and refetch the picture
backgroundImage: `url('${basePictureUrl}/500?${props.changeCount}')`,
};

return (
<div className="u-w-full u-relative u-pb-[100%]">
<div className="u-absolute u-left-0 u-top-0">
<a href={pictureUrl} title={pictureTitle} data-toggle="lightbox" data-type="image">
<img className="u-rounded-8 u-max-w-full"
<div className="u-absolute u-left-0 u-top-0 u-w-full u-h-full">
<a href={avatarOriginalUrl} title={pictureTitle} className="js-profile-picture" data-toggle="lightbox" data-type="image">
<img className="u-rounded-8 u-w-full u-h-full u-object-cover js-profile-picture"
src={pictureUrl} alt={pictureTitle}/>
</a>
</div>
Expand Down
6 changes: 3 additions & 3 deletions assets/js/readmore.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ document.addEventListener('DOMContentLoaded', function () {
new ShowMore('.js-read-more-received', {
config: {
type: "text",
limit: 120,
after: 120,
limit: 240,
after: 60,
btnClass: "o-show-more-btn",
more: document.getElementById('read.more').value,
less: document.getElementById('show.less').value
Expand All @@ -24,7 +24,7 @@ document.addEventListener('DOMContentLoaded', function () {
config: {
type: "text",
limit: 120,
after: 60,
after: 30,
btnClass: "o-show-more-btn",
more: document.getElementById('read.more').value,
less: document.getElementById('show.less').value
Expand Down
3 changes: 3 additions & 0 deletions assets/js/requests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dayjs from 'dayjs';
import Litepicker from 'litepicker';
import {disableButtonOnSubmit} from './submit_button_disable';

import '../scss/_daterangepicker.scss';

Expand Down Expand Up @@ -39,3 +40,5 @@ $(function () {
}
}
});

disableButtonOnSubmit();
136 changes: 136 additions & 0 deletions assets/js/scrollingtabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
let move = require('move-js');

const scrollBarWidths = 40;
const wrapper = document.getElementsByClassName("wrapper-nav")[0];
const lastNavLink = document.getElementsByClassName("last-nav-link")[0];

const scrollerRight = document.getElementsByClassName("scroller-right")[0];
const scrollerLeft = document.getElementsByClassName("scroller-left")[0];

const list = document.querySelectorAll(".list");

let btnTriggered = false;

let widthOfList = function() {
let itemsWidth = 0;

const listLinks = document.querySelectorAll(".list a");

listLinks.forEach((el) => {
let itemWidth = getOuterWidth(el);
itemsWidth += itemWidth;
});

return itemsWidth;
};

let widthOfHidden = function(w) {
const wrapperHelper = document.getElementsByClassName("wrapper-nav")[0];

w = (!w) ? 0 : w;

oW = getOuterWidth(wrapperHelper) - w;

let ww = parseFloat((0 - oW).toFixed(3));

let hw = (oW - widthOfList() - getLeftPosition()) - scrollBarWidths;

let rp = document.body.clientWidth - (getOuterLeft(lastNavLink) + getOuterWidth(lastNavLink)) - w;

if (ww > hw) {
//return ww;
return (rp > ww ? rp : ww);
}
else {
//return hw;
return (rp > hw ? rp : hw);
}
};

let getLeftPosition = function() {
let ww = 0 - getOuterWidth(wrapper);
let lp = getOuterLeft(list[0]);

if (ww > lp) {
return ww;
}
else {
return lp;
}
};

let reAdjust = function() {
let rp = document.body.clientWidth - (getOuterLeft(lastNavLink) + getOuterWidth(lastNavLink));

if (getOuterWidth(wrapper) < widthOfList() && (rp < 0)) {
scrollerRight.style.cssText = 'display: flex';
}
else {
scrollerRight.style.display = 'none';
}

if (getLeftPosition() < 0) {
scrollerLeft.style.cssText = 'display: flex';
}
else {
scrollerLeft.style.display = 'none';
}

btnTriggered = false;
}

window.addEventListener('resize', function(event) {
reAdjust();
}, true);

scrollerRight.addEventListener("click", function() {
if (btnTriggered) return;

btnTriggered = true;

fade(scrollerLeft);
unfade(scrollerRight);

let wR = getOuterWidth(scrollerRight);

move(document.querySelectorAll(".list")[0]).add("left", +widthOfHidden(wR), 200).end().then(x=> {
reAdjust();
});
});

scrollerLeft.addEventListener("click", function() {
if (btnTriggered) return;

btnTriggered = true;

fade(scrollerRight);
unfade(scrollerLeft);

let wL = getOuterWidth(scrollerLeft);

move(document.querySelectorAll(".list")[0]).add("left", -getLeftPosition() + wL, 200).end().then(()=> {
reAdjust();
});
});

let getOuterLeft = function(elem) {
return elem.getBoundingClientRect().left;
}

let getOuterWidth = function(elem) {
return parseFloat(window.getComputedStyle(elem).width);
}

function fade(elem) {
elem.style.display = "none";
elem.style.transition="opacity 0.6s";
elem.style.opacity=0;
}

function unfade(elem) {
elem.style.display = "block";
elem.style.transition="opacity 0.6s";
elem.style.opacity=1;
}

reAdjust();
17 changes: 16 additions & 1 deletion assets/js/search/locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@ import {initializeSingleAutoComplete} from '../suggest/locations';
import 'leaflet.fullscreen';
import 'leaflet.fullscreen/Control.FullScreen.css';

initializeSingleAutoComplete("/suggest/locations/all", 'js-location-picker', '_autocomplete');
function onChange(element, result) {
const locationFullName = document.getElementById('search_location_fullname');
const locationName = document.getElementById('search_location_name');
const locationGeonameId = document.getElementById('search_location_geoname_id');
const locationLatitude = document.getElementById('search_location_latitude');
const locationLongitude = document.getElementById('search_location_longitude');
const locationIsAdminUnit = document.getElementById('search_location_admin_unit');
locationFullName.value = result.name.replaceAll("#", ", ");
locationName.value = result.name.split("#")[0];
locationIsAdminUnit.value = result.isAdminUnit;
locationGeonameId.value = result.id;
locationLatitude.value = result.latitude;
locationLongitude.value = result.longitude;
}

initializeSingleAutoComplete("/suggest/locations/all", 'js-location-picker', onChange);

function Map() {
this.map = undefined;
Expand Down
17 changes: 16 additions & 1 deletion assets/js/search/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import 'leaflet';
import 'leaflet.fullscreen';
import 'leaflet.fullscreen/Control.FullScreen.css';
import {initializeSingleAutoComplete} from "../suggest/locations";

function onChange(element, result) {
const locationFullName = document.getElementById('search_map_location');
const locationGeonameId = document.getElementById('search_map_location_geoname_id');
const locationLatitude = document.getElementById('search_map_location_latitude');
const locationLongitude = document.getElementById('search_map_location_longitude');
locationFullName.value = result.name.replaceAll("#", ", ");
locationGeonameId.value = result.id;
locationLatitude.value = result.latitude;
locationLongitude.value = result.longitude;
}

initializeSingleAutoComplete("/suggest/locations/all", 'js-location-picker', onChange);

function Map() {
this.map = undefined;
Expand All @@ -10,7 +25,7 @@ function Map() {

Map.prototype.showMap = function () {
if (this.map === undefined) {
this.mapBox.append('<div id="map" class="map p-2 framed w-100"></div>');
this.mapBox.append('<div id="map" class="map u-w-full"></div>');
this.map = L.map('map', {
center: [15, 0],
zoomSnap: 0.25,
Expand Down
17 changes: 17 additions & 0 deletions assets/js/submit_button_disable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export function disableButtonOnSubmit() {
const forms = document.getElementsByTagName("form");

for (const form of forms) {
form.addEventListener("submit", disableButtons);
}
}

function disableButtons()
{
Array
.from(document.getElementsByTagName("button"))
.forEach(b => {
b.classList.add('disabled')
b.classList.add('u-pointer-events-none')
});
}
Loading

0 comments on commit b8cbde0

Please sign in to comment.