Compare commits
No commits in common. "transcaffeine/refactor" and "main" have entirely different histories.
transcaffe
...
main
@ -21,10 +21,7 @@ traperr() {
|
||||
}
|
||||
trap traperr ERR
|
||||
|
||||
mkdir ../nextcloud-pride-flags-tmp
|
||||
mv .git ../nextcloud-pride-flags-tmp/.git
|
||||
mv bin ../nextcloud-pride-flags-tmp/bin
|
||||
mv vendor-bin ../nextcloud-pride-flags-tmp/vendor-bin
|
||||
mv .git ../nextcloud-pride-flags-git
|
||||
|
||||
sudo docker run --hostname nc31.local \
|
||||
-e NEXTCLOUD_ADMIN_USER=admin \
|
||||
@ -44,14 +41,12 @@ sudo docker exec -it ${CONTAINER_NAME} php occ integrity:sign-app \
|
||||
sudo docker stop "${CONTAINER_NAME}"
|
||||
sudo docker rm "${CONTAINER_NAME}"
|
||||
|
||||
mv ../nextcloud-pride-flags-tmp/.git .git
|
||||
mv ../nextcloud-pride-flags-tmp/bin bin
|
||||
mv ../nextcloud-pride-flags-tmp/vendor-bin vendor-bin
|
||||
mv ../nextcloud-pride-flags-git .git
|
||||
|
||||
echo "App $APP_NAME signed @ ${VERSION}. Commit the appinfo/signatures.json now and press enter."
|
||||
read -p "Press Enter to continue" < /dev/tty
|
||||
|
||||
tar --exclude-vcs --exclude='./bin' --exclude='./vendor-bin' -czvf "${TARBALL}" "$REPO"
|
||||
tar --exclude-vcs -czvf "${TARBALL}" "$REPO"
|
||||
|
||||
# verify content
|
||||
echo "Tarball '${TARBALL}' content:"
|
||||
|
@ -3,25 +3,18 @@
|
||||
const button_selector = document.querySelectorAll('.pride_flags_server_settings .server-settings.button-flavour select')[0];
|
||||
const submit_button = document.querySelectorAll('.pride_flags_server_settings .settings-pride-submit');
|
||||
const container = document.querySelector('.pride_flags_server_settings .settings-section');
|
||||
const inputs = [
|
||||
folder_selector,
|
||||
button_selector,
|
||||
];
|
||||
|
||||
function load() {
|
||||
window.pride_flags.util.settings.blockInputs(inputs);
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings/global'))
|
||||
.then(res => res.json())
|
||||
.then(({folderVariant, buttonVariant}) => {
|
||||
folder_selector.value = folderVariant;
|
||||
button_selector.value = buttonVariant;
|
||||
window.pride_flags.util.settings.unblockInputs(inputs);
|
||||
container.classList.remove('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
function save() {
|
||||
window.pride_flags.util.settings.blockInputs(inputs);
|
||||
const payload = {
|
||||
folderVariant: folder_selector.value,
|
||||
buttonVariant: button_selector.value,
|
||||
@ -37,10 +30,7 @@
|
||||
if (response.ok) {
|
||||
window.location.reload();
|
||||
}
|
||||
}).catch(err => {
|
||||
console.err(err);
|
||||
window.pride_flags.util.settings.unblockInputs(inputs);
|
||||
});
|
||||
})
|
||||
}
|
||||
submit_button.forEach(node => node.addEventListener('click', e => save()));
|
||||
|
||||
|
@ -3,25 +3,18 @@
|
||||
const button_selector = document.querySelectorAll('.pride_flags_user_settings .user-settings.button-flavour select')[0];
|
||||
const submit_button = document.querySelectorAll('.pride_flags_user_settings .settings-pride-submit');
|
||||
const container = document.querySelector('.pride_flags_user_settings .settings-section');
|
||||
const inputs = [
|
||||
folder_selector,
|
||||
button_selector,
|
||||
];
|
||||
|
||||
function load() {
|
||||
window.pride_flags.util.settings.blockInputs(inputs);
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings'))
|
||||
.then(res => res.json())
|
||||
.then(({folderVariant, buttonVariant}) => {
|
||||
folder_selector.value = folderVariant;
|
||||
button_selector.value = buttonVariant;
|
||||
window.pride_flags.util.settings.unblockInputs(inputs);
|
||||
container.classList.remove('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
function save() {
|
||||
window.pride_flags.util.settings.blockInputs(inputs);
|
||||
const payload = {
|
||||
folderVariant: folder_selector.value,
|
||||
buttonVariant: button_selector.value,
|
||||
@ -37,10 +30,7 @@
|
||||
if (response.ok) {
|
||||
window.location.reload();
|
||||
}
|
||||
}).catch(err => {
|
||||
window.pride_flags.util.settings.unblockInputs(inputs);
|
||||
console.err(err);
|
||||
});
|
||||
})
|
||||
}
|
||||
submit_button.forEach(node => node.addEventListener('click', e => save()));
|
||||
|
||||
|
34
js/pride.js
34
js/pride.js
@ -1,4 +1,3 @@
|
||||
(function(window) {
|
||||
const flags = [
|
||||
{
|
||||
id: 'pride',
|
||||
@ -18,6 +17,7 @@
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
id: 'bi',
|
||||
// colors: ['#C42A6F', '#915392', '#1437A1'],
|
||||
colors: ['#D60270', '#9B4F96', '#0038A8'],
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
@ -59,14 +59,6 @@
|
||||
</svg>`;
|
||||
};
|
||||
|
||||
const generateCssBackgroundRules = (type, variant) => `
|
||||
--image-background-pride-${type}: var(--image-background-pride-${variant});
|
||||
--image-background-pride-${type}-gradient: var(--image-background-pride-gradient-${variant});
|
||||
`;
|
||||
const setDisabledState = (nodes, state) => nodes.forEach(node => node.disabled = !!state);
|
||||
const blockInputs = nodes => setDisabledState(nodes, true);
|
||||
const blockInputs = nodes => setDisabledState(nodes, false);
|
||||
|
||||
flags.forEach(flag => {
|
||||
const svg_html = makeLinearGradientSvg(flag.id, flag.colors, flag.opacity ?? '0.8', flag.transform ?? 'rotate(0)');
|
||||
const container = document.createElement('div');
|
||||
@ -93,20 +85,12 @@
|
||||
document.head.prepend(node);
|
||||
}
|
||||
const style_settings = document.querySelector('head > style#pride_flag_settings');
|
||||
const rules = `body {
|
||||
${(folderVariant !== 'none') ? generateCssBackgroundRules('folder', folderVariant) : ''}
|
||||
${(buttonVariant !== 'none') ? generateCssBackgroundRules('button', buttonVariant) : ''}
|
||||
}`;
|
||||
style_settings.textContent = rules;
|
||||
style_settings.textContent = `
|
||||
body {
|
||||
--image-background-pride-button: var(--image-background-pride-${buttonVariant});
|
||||
--image-background-pride-folder: var(--image-background-pride-${folderVariant});
|
||||
--image-background-pride-button-gradient: var(--image-background-pride-gradient-${buttonVariant});
|
||||
--image-background-pride-folder-gradient: var(--image-background-pride-gradient-${folderVariant});
|
||||
}
|
||||
`;
|
||||
});
|
||||
window.pride_flags = {
|
||||
flags,
|
||||
"util" : {
|
||||
"settings": {
|
||||
blockInputs,
|
||||
unblockInputs,
|
||||
"_setDisabledState": setDisabledState,
|
||||
},
|
||||
},
|
||||
};
|
||||
})(window);
|
||||
|
@ -6,14 +6,4 @@ namespace OCA\PrideFlags;
|
||||
|
||||
abstract class AppConstants {
|
||||
public const APP_ID = 'pride_flags';
|
||||
public enum Variants: string {
|
||||
case PRIDE = "Pride";
|
||||
case TRANS = "Trans Pride";
|
||||
case PAN = "Pansexual Pride";
|
||||
case BI = "Bisexual Pride";
|
||||
case ASEXUAL = "Asexual Pride";
|
||||
case LESBIAN = "Lesbian Pride";
|
||||
case NONBINARY = "Non-binary Pride";
|
||||
case NONE = "No customisation";
|
||||
}
|
||||
}
|
||||
|
@ -18,17 +18,12 @@ class AppSettings {
|
||||
}
|
||||
|
||||
public function setStringSetting($userId, string $key, string $value): void {
|
||||
// Check for valid Variant here
|
||||
if (AppConstants\Variants::tryFrom($value) != null) {
|
||||
$this->config->setUserValue(AppConstants::APP_ID, $userId, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function setAppStringSetting(string $key, string $value): void {
|
||||
if (AppConstants\Variants::tryFrom($value) != null) {
|
||||
$this->config->setAppValue(AppConstants::APP_ID, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAll($userId): array {
|
||||
return [
|
||||
|
@ -1,8 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
use OCA\PrideFlags\AppConstants;
|
||||
|
||||
?>
|
||||
<div class="pride_flags_user_settings">
|
||||
<div class="settings-section section hidden">
|
||||
@ -10,17 +7,25 @@ use OCA\PrideFlags\AppConstants;
|
||||
<div class="user-settings folder-flavour" style="margin-left: 40px; display: flex;">
|
||||
<label for="user-settings-folder-flavour-select" style="display: flex; width: 100px;">Folders</label>
|
||||
<select id="user-settings-folder-flavour-select" style="display: flex; width: 200px;">
|
||||
<?php foreach (AppConstants\Variants::cases() as $variant): ?>
|
||||
<option value="<?= strtolower($variant->name) ?>"><?= $variant->value ?></option>
|
||||
<?php endforeach ?>
|
||||
<option value='pride'>Pride</option>
|
||||
<option value='trans'>Trans Pride</option>
|
||||
<option value='pan'>Pansexual Pride</option>
|
||||
<option value='nonbinary'>Non-binary Pride</option>
|
||||
<option value='bi'>Bisexual Pride</option>
|
||||
<option value='asexual'>Asexual Pride</option>
|
||||
<option value='lesbian'>Lesbian Pride</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="user-settings button-flavour" style="margin-left: 40px; display: flex;">
|
||||
<label for="user-settings-button-flavour-select" style="display: flex; width: 100px;">Buttons</label>
|
||||
<select id="user-settings-button-flavour-select" style="display: flex; width: 200px;">
|
||||
<?php foreach (AppConstants\Variants::cases() as $variant): ?>
|
||||
<option value="<?= strtolower($variant->name) ?>"><?= $variant->value ?></option>
|
||||
<?php endforeach ?>
|
||||
<option value='pride'>Pride</option>
|
||||
<option value='trans'>Trans Pride</option>
|
||||
<option value='pan'>Pansexual Pride</option>
|
||||
<option value='nonbinary'>Non-binary Pride</option>
|
||||
<option value='bi'>Bisexual Pride</option>
|
||||
<option value='asexual'>Asexual Pride</option>
|
||||
<option value='lesbian'>Lesbian Pride</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="settings-pride-submit button primary" style="margin-left: 40px; display: flex; width: 80px; text-align: center;">Save</button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user