mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
feat: #9705, use radio buttons for flag reasons
This commit is contained in:
@@ -77,9 +77,6 @@
|
||||
"modal-reason-custom": "Reason for reporting this content...",
|
||||
"modal-submit": "Submit Report",
|
||||
"modal-submit-success": "Content has been flagged for moderation.",
|
||||
"modal-submit-confirm": "Confirm Submission",
|
||||
"modal-submit-confirm-text": "You have a custom reason specified already. Are you sure you wish to submit via quick-report?",
|
||||
"modal-submit-confirm-text-help": "Submitting a quick report will overwrite any custom reasons defined.",
|
||||
|
||||
"bulk-actions": "Bulk Actions",
|
||||
"bulk-resolve": "Resolve Flag(s)",
|
||||
|
||||
@@ -17,33 +17,28 @@ define('flags', ['hooks', 'components', 'api'], function (hooks, components, api
|
||||
flagCommit = flagModal.find('#flag-post-commit');
|
||||
flagReason = flagModal.find('#flag-reason-custom');
|
||||
|
||||
// Quick-report buttons
|
||||
flagModal.on('click', '.flag-reason', function () {
|
||||
var reportText = $(this).text();
|
||||
|
||||
if (flagReason.val().length === 0) {
|
||||
return createFlag(data.type, data.id, reportText);
|
||||
flagModal.on('click', 'input[name="flag-reason"]', function () {
|
||||
if ($(this).attr('id') === 'flag-reason-other') {
|
||||
flagReason.removeAttr('disabled');
|
||||
if (!flagReason.val().length) {
|
||||
flagCommit.attr('disabled', true);
|
||||
}
|
||||
} else {
|
||||
flagReason.attr('disabled', true);
|
||||
flagCommit.removeAttr('disabled');
|
||||
}
|
||||
|
||||
// Custom reason has text, confirm submission
|
||||
bootbox.confirm({
|
||||
title: '[[flags:modal-submit-confirm]]',
|
||||
message: '<p>[[flags:modal-submit-confirm-text]]</p><p class="help-block">[[flags:modal-submit-confirm-text-help]]</p>',
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
createFlag(data.type, data.id, reportText);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Custom reason report submission
|
||||
flagCommit.on('click', function () {
|
||||
createFlag(data.type, data.id, flagModal.find('#flag-reason-custom').val());
|
||||
var selected = $('input[name="flag-reason"]:checked');
|
||||
var reason = selected.val();
|
||||
if (selected.attr('id') === 'flag-reason-other') {
|
||||
reason = flagReason.val();
|
||||
}
|
||||
createFlag(data.type, data.id, reason);
|
||||
});
|
||||
|
||||
flagModal.on('click', '.toggle-custom', function () {
|
||||
flagReason.prop('disabled', false);
|
||||
flagModal.on('click', '#flag-reason-other', function () {
|
||||
flagReason.focus();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user