mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
feat: refactor group title editing
add new titles
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
"uploadRateLimitThreshold": 10,
|
"uploadRateLimitThreshold": 10,
|
||||||
"uploadRateLimitCooldown": 60,
|
"uploadRateLimitCooldown": 60,
|
||||||
"allowUserHomePage": 1,
|
"allowUserHomePage": 1,
|
||||||
"allowMultipleBadges": 0,
|
"allowMultipleBadges": 1,
|
||||||
"maximumFileSize": 2048,
|
"maximumFileSize": 2048,
|
||||||
"stripEXIFData": 1,
|
"stripEXIFData": 1,
|
||||||
"orphanExpiryDays": 0,
|
"orphanExpiryDays": 0,
|
||||||
|
|||||||
@@ -103,10 +103,10 @@
|
|||||||
"nodebb-plugin-ntfy": "1.7.3",
|
"nodebb-plugin-ntfy": "1.7.3",
|
||||||
"nodebb-plugin-spam-be-gone": "2.2.1",
|
"nodebb-plugin-spam-be-gone": "2.2.1",
|
||||||
"nodebb-rewards-essentials": "1.0.0",
|
"nodebb-rewards-essentials": "1.0.0",
|
||||||
"nodebb-theme-harmony": "1.2.27",
|
"nodebb-theme-harmony": "1.2.28",
|
||||||
"nodebb-theme-lavender": "7.1.7",
|
"nodebb-theme-lavender": "7.1.7",
|
||||||
"nodebb-theme-peace": "2.2.0",
|
"nodebb-theme-peace": "2.2.1",
|
||||||
"nodebb-theme-persona": "13.3.8",
|
"nodebb-theme-persona": "13.3.9",
|
||||||
"nodebb-widget-essentials": "7.0.15",
|
"nodebb-widget-essentials": "7.0.15",
|
||||||
"nodemailer": "6.9.10",
|
"nodemailer": "6.9.10",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
|
|||||||
@@ -155,6 +155,10 @@
|
|||||||
|
|
||||||
"grouptitle": "Group Title",
|
"grouptitle": "Group Title",
|
||||||
"group-order-help": "Select a group and use the arrows to order titles",
|
"group-order-help": "Select a group and use the arrows to order titles",
|
||||||
|
"show-group-title": "Show group title",
|
||||||
|
"hide-group-title": "Hide group title",
|
||||||
|
"order-group-up": "Order group up",
|
||||||
|
"order-group-down": "Order group down",
|
||||||
"no-group-title": "No group title",
|
"no-group-title": "No group title",
|
||||||
|
|
||||||
"select-skin": "Select a Skin",
|
"select-skin": "Select a Skin",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ define('forum/account/edit', [
|
|||||||
handleEmailConfirm();
|
handleEmailConfirm();
|
||||||
updateSignature();
|
updateSignature();
|
||||||
updateAboutMe();
|
updateAboutMe();
|
||||||
handleGroupSort();
|
handleGroupControls();
|
||||||
|
|
||||||
if (!ajaxify.data.isSelf && ajaxify.data.canEdit) {
|
if (!ajaxify.data.isSelf && ajaxify.data.canEdit) {
|
||||||
$(`a[href="${config.relative_path}/user/${ajaxify.data.userslug}/edit/email"]`).on('click', () => {
|
$(`a[href="${config.relative_path}/user/${ajaxify.data.userslug}/edit/email"]`).on('click', () => {
|
||||||
@@ -42,12 +42,15 @@ define('forum/account/edit', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
function updateProfile() {
|
function updateProfile() {
|
||||||
|
function getGroupSelection() {
|
||||||
|
const els = $('[component="group/badge/list"] [component="group/badge/item"][data-selected="true"]');
|
||||||
|
return els.map((i, el) => $(el).attr('data-value')).get();
|
||||||
|
}
|
||||||
|
|
||||||
const userData = $('form[component="profile/edit/form"]').serializeObject();
|
const userData = $('form[component="profile/edit/form"]').serializeObject();
|
||||||
userData.uid = ajaxify.data.uid;
|
userData.uid = ajaxify.data.uid;
|
||||||
userData.groupTitle = userData.groupTitle || '';
|
userData.groupTitle = userData.groupTitle || '';
|
||||||
userData.groupTitle = JSON.stringify(
|
userData.groupTitle = JSON.stringify(getGroupSelection());
|
||||||
Array.isArray(userData.groupTitle) ? userData.groupTitle : [userData.groupTitle]
|
|
||||||
);
|
|
||||||
|
|
||||||
hooks.fire('action:profile.update', userData);
|
hooks.fire('action:profile.update', userData);
|
||||||
|
|
||||||
@@ -142,26 +145,34 @@ define('forum/account/edit', [
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleGroupSort() {
|
function handleGroupControls() {
|
||||||
function move(direction) {
|
const { allowMultipleBadges } = ajaxify.data;
|
||||||
const selected = $('#groupTitle').val();
|
$('[component="group/toggle/hide"]').on('click', function () {
|
||||||
if (!ajaxify.data.allowMultipleBadges || (Array.isArray(selected) && selected.length > 1)) {
|
const groupEl = $(this).parents('[component="group/badge/item"]');
|
||||||
return;
|
groupEl.attr('data-selected', 'false');
|
||||||
|
$(this).addClass('hidden');
|
||||||
|
groupEl.find('[component="group/toggle/show"]').removeClass('hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[component="group/toggle/show"]').on('click', function () {
|
||||||
|
if (!allowMultipleBadges) {
|
||||||
|
$('[component="group/badge/list"] [component="group/toggle/show"]').removeClass('hidden');
|
||||||
|
$('[component="group/badge/list"] [component="group/toggle/hide"]').addClass('hidden');
|
||||||
|
$('[component="group/badge/list"] [component="group/badge/item"]').attr('data-selected', 'false');
|
||||||
}
|
}
|
||||||
const el = $('#groupTitle').find(':selected');
|
const groupEl = $(this).parents('[component="group/badge/item"]');
|
||||||
if (el.length && el.val()) {
|
groupEl.attr('data-selected', 'true');
|
||||||
if (direction > 0) {
|
$(this).addClass('hidden');
|
||||||
el.insertAfter(el.next());
|
groupEl.find('[component="group/toggle/hide"]').removeClass('hidden');
|
||||||
} else if (el.prev().val()) {
|
});
|
||||||
el.insertBefore(el.prev());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$('[component="group/order/up"]').on('click', function () {
|
$('[component="group/order/up"]').on('click', function () {
|
||||||
move(-1);
|
const el = $(this).parents('[component="group/badge/item"]');
|
||||||
|
el.insertBefore(el.prev());
|
||||||
});
|
});
|
||||||
$('[component="group/order/down"]').on('click', function () {
|
$('[component="group/order/down"]').on('click', function () {
|
||||||
move(1);
|
const el = $(this).parents('[component="group/badge/item"]');
|
||||||
|
el.insertAfter(el.next());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user