Skip to content

Commit 9a1e538

Browse files
thisismeonmounteverestthisismeonmounteverest
andauthored
Moving to Tailwind CSS 4.x, Update profile pages. (#387)
* Add CI steps to create database. * Create MariaDB and test database as part of the test workflow. * Update ci.yml * Update .env.test * Update ci.yml * Update ci.yml * Install dependencies and run encore to create needed files for integration tests. * Update ci.yml * Update ci.yml * Update ci.yml * Updating ci.yml to use * Updating ci.yml to use * Updating ci.yml to use $GITHUB_OUTPUT * Updating ci.yml to use $GITHUB_OUTPUT * Updating ci.yml to use $GITHUB_OUTPUT * Ignore SignupController for infection (mutating integration tests is meaningless). * Enabling infection run. * Update ci.yml * Update ci.yml * Update infection.json5.dist * Update ci.yml * Bump versions. * Moving docker setup from nginx and php to Frankenphp. * Tailwind CSS 4.x, profile pages. --------- Co-authored-by: thisismeonmounteverest <shevek@blafaselblubb.abcde.biz>
1 parent f8e38e7 commit 9a1e538

File tree

388 files changed

+8044
-21145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+8044
-21145
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ indent_size = 2
2626

2727
[*.md]
2828
trim_trailing_whitespace = false
29+
30+
[*.twig]
31+
indent_size = 2

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TIME_STAMP := $(shell git log -n 1 --format=%aI)
1212

1313
all: phpci
1414

15-
phpci: phpcpd phploc php-code-sniffer php-cs-fixer phpunit infection int-test version
15+
phpci: phpcpd phploc php-code-sniffer php-cs-fixer phpunit infection int-test version yaml-lint doctrine twig
1616

1717
install:
1818
git rev-parse --short HEAD > VERSION
@@ -88,7 +88,8 @@ int-test:
8888
"./bin/phpunit" --log-junit=build/logs/phpunit/junit.xml --colors=never --order-by=random --group=integration
8989

9090
infection: phpunit
91-
"./vendor/bin/infection" --skip-initial-tests --coverage=build/logs/phpunit --min-covered-msi=80 --threads=30
91+
92+
"./vendor/bin/infection" --skip-initial-tests --coverage=build/logs/phpunit --min-covered-msi=80 --threads=2
9293

9394
#behat: encore
9495
# bin/console doctrine:database:create --env=test --if-not-exists
@@ -102,3 +103,12 @@ phpmetrics:
102103
version:
103104
git rev-parse --short HEAD > VERSION
104105
touch -d $(TIME_STAMP) VERSION
106+
107+
yaml-lint:
108+
bin/console lint:yaml --parse-tags config fixtures
109+
110+
doctrine:
111+
bin/console doctrine:schema:validate --skip-sync
112+
113+
twig:
114+
bin/console lint:twig

Migrations/Version20200522172912.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function up(Schema $schema): void
3030
VIEW `forum_trads` AS
3131
SELECT
3232
`translations`.`id` AS `id`,
33-
`translations`.`IdLanguage` AS `IdLanguage`,
33+
`translations`.`ShortCode` AS `ShortCode`,
3434
`translations`.`IdOwner` AS `IdOwner`,
3535
`translations`.`IdTrad` AS `IdTrad`,
3636
`translations`.`IdTranslator` AS `IdTranslator`,

assets/js/password/check.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ const email = document.querySelector('.js-email-address');
55

66
function resetBackgroundColor() {
77
for (let i = 0; i < 5; i++) {
8-
passwordStrength.children.item(i).classList.add('u-bg-gray-20');
9-
passwordStrength.children.item(i).classList.remove('u-bg-red');
10-
passwordStrength.children.item(i).classList.remove('u-bg-bewelcome');
11-
passwordStrength.children.item(i).classList.remove('u-bg-bewelcome-dark');
12-
passwordStrength.children.item(i).classList.remove('u-bg-green');
13-
passwordStrength.children.item(i).classList.remove('u-bg-green-dark');
8+
passwordStrength.children.item(i).classList.add('u:bg-gray-300');
9+
passwordStrength.children.item(i).classList.remove('u:bg-red-700');
10+
passwordStrength.children.item(i).classList.remove('u:bg-bewelcome');
11+
passwordStrength.children.item(i).classList.remove('u:bg-bewelcome-dark');
12+
passwordStrength.children.item(i).classList.remove('u:bg-green-600');
13+
passwordStrength.children.item(i).classList.remove('u:bg-green-800');
1414
}
1515
}
16+
1617
async function getPasswordScore() {
1718
// Collect form data (username, email address and password)
1819
// Send to server to calculate score
@@ -37,17 +38,17 @@ async function getPasswordScore() {
3738

3839
let backgroundColor;
3940
switch(score) {
40-
case 0: backgroundColor = 'u-bg-red'; break;
41-
case 1: backgroundColor = 'u-bg-bewelcome-dark'; break;
42-
case 2: backgroundColor = 'u-bg-bewelcome'; break;
43-
case 3: backgroundColor = 'u-bg-green'; break;
44-
case 4: backgroundColor = 'u-bg-green-dark'; break;
41+
case 0: backgroundColor = 'u:bg-red-700'; break;
42+
case 1: backgroundColor = 'u:bg-bewelcome-dark'; break;
43+
case 2: backgroundColor = 'u:bg-bewelcome'; break;
44+
case 3: backgroundColor = 'u:bg-green-600'; break;
45+
case 4: backgroundColor = 'u:bg-green-800'; break;
4546
}
4647

4748
resetBackgroundColor();
4849
for (let i = 0; i < 5; i++) {
4950
if (i <= score) {
50-
passwordStrength.children.item(i).classList.remove('u-bg-gray-20');
51+
passwordStrength.children.item(i).classList.remove('u:bg-gray-300');
5152
passwordStrength.children.item(i).classList.add(backgroundColor);
5253
}
5354
}

assets/js/profile/edit.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import 'ekko-lightbox';
2+
import MicroModal from 'micromodal';
3+
4+
const L = require("leaflet");
5+
6+
const editLanguages = document.querySelectorAll("[data-edit-language]");
7+
8+
editLanguages.forEach(editLanguage => {
9+
editLanguage.addEventListener("click", e => {
10+
editLanguages.forEach(editLanguage => {
11+
editLanguage.classList.add('btn-outline-primary')
12+
editLanguage.classList.remove('btn-primary')
13+
})
14+
15+
const languages = document.querySelectorAll('[id^=profile-language-]')
16+
languages.forEach(language => {
17+
language.classList.add('u:hidden!')
18+
})
19+
20+
const language = e.target.dataset.editLanguage
21+
const activeLanguage = document.getElementById("profile-language-" + language)
22+
const editLanguageButton = document.querySelector("[data-edit-language=" + language + "]")
23+
24+
activeLanguage.classList.remove('u:hidden!')
25+
editLanguageButton.classList.add("btn-primary")
26+
editLanguageButton.classList.remove("btn-outline-primary")
27+
})
28+
})
29+
30+
const deleteLanguages = document.querySelectorAll("[data-delete-language]")
31+
32+
deleteLanguages.forEach( deleteLanguage => {
33+
deleteLanguage.addEventListener('click', (e) => {
34+
const modalId = 'delete-' + e.target.dataset.deleteLanguage;
35+
MicroModal.show(modalId);
36+
})
37+
})
38+
39+
const locationMaps = document.querySelectorAll('[id^=location-map]')
40+
41+
locationMaps.forEach( locationMap => {
42+
const latitude = document.getElementById('latitude').value;
43+
const longitude = document.getElementById('longitude').value;
44+
45+
const map = L.map(locationMap, {
46+
zoomControl: false,
47+
boxZoom: false
48+
}).setView([latitude, longitude], 10)
49+
50+
map.attributionControl.setPrefix(false)
51+
const markerIcon = L.icon({
52+
iconUrl: 'images/icons/marker_drop.png',
53+
iconShadowUrl: 'images/icons/marker_drop_shadow.png',
54+
iconSize: [25, 25],
55+
iconAnchor: [13, 0],
56+
});
57+
58+
L.marker(new L.LatLng(latitude, longitude), {icon: markerIcon}).addTo(map)
59+
60+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
61+
subdomains: ['a', 'b', 'c']
62+
}).addTo(map)
63+
})
64+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {initializeTomSelects, destroyTomSelects} from "../tom-select";
2+
3+
document
4+
.querySelectorAll('.js-add-language')
5+
.forEach(btn => {
6+
btn.addEventListener("click", addFormToCollection)
7+
});
8+
9+
addDeleteLanguageEventListener()
10+
11+
function addFormToCollection(e) {
12+
const collectionHolder = document.querySelector('.' + e.currentTarget.dataset.collectionHolderClass);
13+
14+
const html = collectionHolder
15+
.dataset
16+
.prototype
17+
.replace(
18+
/__name__/g,
19+
collectionHolder.dataset.index
20+
);
21+
22+
collectionHolder.insertAdjacentHTML('beforeend', html)
23+
collectionHolder.insertAdjacentHTML('beforeend', '<hr class="u:bg-bewelcome" style="margin-top:0">')
24+
collectionHolder.dataset.index++
25+
26+
addDeleteLanguageEventListener()
27+
initializeTomSelects()
28+
}
29+
30+
function deleteFormFromCollection(e) {
31+
const current = document.getElementById(e.currentTarget.dataset.related);
32+
console.log(current)
33+
current.remove()
34+
35+
const collectionHolder = document.querySelector('.' + e.currentTarget.dataset.collectionHolderClass);
36+
collectionHolder.dataset.index--
37+
38+
initializeTomSelects()
39+
}
40+
41+
function addDeleteLanguageEventListener() {
42+
document
43+
.querySelectorAll('.js-delete-language')
44+
.forEach(btn => {
45+
btn.addEventListener("click", deleteFormFromCollection)
46+
});
47+
}

assets/js/profile/profile.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ const languageSwitch = document.getElementById("language-switch");
55
languageSwitch.addEventListener("change", e => {
66
const languages = document.querySelectorAll('[id^=profile-language-]');
77
languages.forEach(language => {
8-
language.classList.add('u-hidden');
9-
language.classList.remove('u-block');
8+
language.classList.add('u:hidden!');
109
})
1110
const current = document.getElementById("profile-language-" + e.target.value);
12-
current.classList.remove('u-hidden')
13-
current.classList.add('u-block')
11+
current.classList.remove('u:hidden!')
1412
})

assets/js/react/avatar/AvatarPicture.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const AvatarPicture = (props) => {
99
const pictureTitle = getText('profile.picture.title');
1010

1111
return (
12-
<div className="u-w-full u-relative u-pb-[100%]">
13-
<div className="u-absolute u-left-0 u-top-0 u-w-full u-h-full">
12+
<div className="u:w-full u:relative u:pb-[100%]">
13+
<div className="u:absolute u:left-0 u:top-0 u:w-full u:h-full">
1414
<a href={avatarOriginalUrl} title={pictureTitle} className="js-profile-picture" data-toggle="lightbox" data-type="image">
15-
<img className="u-rounded-8 u-w-full u-h-full u-object-cover js-profile-picture"
15+
<img className="u:rounded-8 u:w-full u:h-full u:object-cover js-profile-picture"
1616
src={pictureUrl} alt={pictureTitle}/>
1717
</a>
1818
</div>

assets/js/roxeditor.js

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
BlockQuote,
99
EasyImage,
1010
Image,
11+
ImageBlock,
1112
ImageCaption,
1213
ImageStyle,
1314
ImageToolbar,
@@ -57,11 +58,11 @@ for (let i = 0; i < mentions.length; i++) {
5758
feed.push('@' + mentions.item(i).value);
5859
}
5960

60-
let allEditors = document.querySelectorAll('.editor');
61+
let allEditors = document.querySelectorAll('.js-ckeditor-images, .js-ckeditor-no-images');
6162
for (let i = 0; i < allEditors.length; ++i) {
62-
ClassicEditor.create(allEditors[i], {
63-
licenseKey: 'GPL',
64-
plugins: [
63+
const allowImageUpload = allEditors[i].classList.contains('js-ckeditor-images');
64+
console.log(allowImageUpload);
65+
let plugins = [
6566
Autosave,
6667
PendingActions,
6768
Essentials,
@@ -70,53 +71,57 @@ for (let i = 0; i < allEditors.length; ++i) {
7071
Italic,
7172
HorizontalLine,
7273
BlockQuote,
73-
Image,
74-
LinkImage,
75-
ImageCaption,
76-
ImageStyle,
77-
ImageToolbar,
78-
EasyImage,
7974
Link,
8075
List,
8176
Mention,
8277
Paragraph,
8378
CKFinderUploadAdapter,
8479
SpecialCharacters,
8580
SpecialCharactersEssentials,
86-
SpecialCharactersTextExtended,
81+
// SpecialCharactersTextExtended,
82+
];
83+
if (allowImageUpload) {
84+
console.log(plugins)
85+
plugins = plugins.concat([
86+
Image,
87+
EasyImage,
88+
ImageCaption,
89+
ImageStyle,
90+
ImageToolbar,
91+
ImageBlock,
92+
LinkImage,
8793
ImageUpload,
8894
CloudServices
89-
],
90-
ckfinder: {
91-
uploadUrl: uploadUrl
92-
},
95+
]);
96+
console.log(plugins)
97+
}
98+
let toolbar = [
99+
'bold',
100+
'underline',
101+
'italic',
102+
'|',
103+
'link',
104+
'bulletedList',
105+
'numberedList',
106+
'specialCharacters',
107+
'|',
108+
'horizontalLine',
109+
'|',
110+
];
111+
if (allowImageUpload) {
112+
toolbar = toolbar.concat(['imageUpload']);
113+
}
114+
toolbar = toolbar.concat([
115+
'blockQuote',
116+
'|',
117+
'undo',
118+
'redo',
119+
]);
120+
let config = {
121+
licenseKey: 'GPL',
122+
plugins: plugins,
93123
// So is the rest of the default configuration.
94-
toolbar: [
95-
'bold',
96-
'underline',
97-
'italic',
98-
'|',
99-
'link',
100-
'bulletedList',
101-
'numberedList',
102-
'specialCharacters',
103-
'|',
104-
'horizontalLine',
105-
'|',
106-
'imageUpload',
107-
'blockQuote',
108-
'|',
109-
'undo',
110-
'redo'
111-
],
112-
image: {
113-
toolbar: [
114-
'imageTextAlternative',
115-
'|',
116-
'toggleImageCaption',
117-
'linkImage'
118-
]
119-
},
124+
toolbar: toolbar,
120125
language: document.documentElement.lang,
121126
translations: translations,
122127
mention: {
@@ -132,7 +137,22 @@ for (let i = 0; i < allEditors.length; ++i) {
132137
return saveData( editor.getData() );
133138
}
134139
}
135-
} )
140+
}
141+
if (allowImageUpload) {
142+
config.ckFinder = {
143+
uploadUrl: uploadUrl
144+
};
145+
config.image = {
146+
toolbar: [
147+
'imageTextAlternative',
148+
'|',
149+
'toggleImageCaption',
150+
'linkImage'
151+
]
152+
};
153+
}
154+
console.log(config);
155+
ClassicEditor.create(allEditors[i], config )
136156
.then( editor => {
137157
const form = editor.sourceElement.form;
138158
registerSubmitHandler(form);

assets/js/search/map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function Map() {
2525

2626
Map.prototype.showMap = function () {
2727
if (this.map === undefined) {
28-
this.mapBox.append('<div id="map" class="map u-w-full"></div>');
28+
this.mapBox.append('<div id="map" class="map u:w-full"></div>');
2929
this.map = L.map('map', {
3030
center: [15, 0],
3131
zoomSnap: 0.25,

0 commit comments

Comments
 (0)