1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

ability to delete processed reports

This commit is contained in:
Sylvain 2019-05-21 12:24:45 +02:00
parent dfb0ea12f0
commit 9c2598d405
7 changed files with 59 additions and 3 deletions

View File

@ -1,13 +1,42 @@
/**
* Controller used in abuses management page
*/
Application.Controllers.controller('AbusesController', ['$scope', '$state', 'Abuse', 'abusesPromise', 'growl', '_t',
function ($scope, $state, Abuse, abusesPromise, growl, _t) {
Application.Controllers.controller('AbusesController', ['$scope', '$state', 'Abuse', 'abusesPromise', 'dialogs', 'growl', '_t',
function ($scope, $state, Abuse, abusesPromise, dialogs, growl, _t) {
/* PUBLIC SCOPE */
// List of all reported abuses
$scope.abuses = [];
/**
* Callback handling a click on the button: confirm before delete
*/
$scope.confirmProcess = function (abuseId) {
dialogs.confirm(
{
resolve: {
object () {
return {
title: _t('manage_abuses.confirmation_required'),
msg: _t('manage_abuses.report_will_be_destroyed')
};
}
}
},
function () { // cancel confirmed
Abuse.remove({ id: abuseId }, function () { // successfully canceled
growl.success(_t('manage_abuses.report_removed'));
Abuse.query({}, function (abuses) {
$scope.abuses = abuses.abuses.filter(a => a.signaled_type === 'Project');
});
}
, function () { // error while canceling
growl.error(_t('manage_abuses.failed_to_remove'));
});
}
);
};
/* PRIVATE SCOPE */
/**
* Kind of constructor: these actions will be realized first when the controller is loaded

View File

@ -3,11 +3,19 @@ li.abuse {
list-style: none;
border: 1px solid #ddd;
border-radius: 2px;
margin-bottom: 2em;
.signaled {
background-color: #f5f5f5;
border-bottom: 1px solid #ddd;
padding: 1em;
position: relative;
button {
position: absolute;
right: 1em;
top: 0.5em;
}
}
.report {

View File

@ -24,6 +24,9 @@
<a ui-sref="app.admin.members_edit({id:abuse.signaled.author.id})">{{abuse.signaled.author.full_name}}</a>,
<span translate>{{ 'manage_abuses.at_date' }}</span>
<span>{{abuse.signaled.published_at | amDateFormat:'L' }}</span>
<button class="btn btn-success" ng-click="confirmProcess(abuse.id)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="report">
<span translate>{{ 'manage_abuses.at_date' }}</span>

View File

@ -765,3 +765,7 @@ en:
published_by: "published by"
at_date: "on"
has_reported: "made the following report:"
confirmation_required: "Confirm the processing of the report"
report_will_be_destroyed: "Once the report has been processed, it will be deleted. This can't be undone, continue?"
report_removed: "The report has been deleted"
failed_to_remove: "An error occurred, unable to delete the report"

View File

@ -765,3 +765,7 @@ es:
published_by: "published by" # translation_missing
at_date: "on" # translation_missing
has_reported: "made the following report:" # translation_missing
confirmation_required: "Confirm the processing of the report" # translation_missing
report_will_be_destroyed: "Once the report has been processed, it will be deleted. This can't be undone, continue?" # translation_missing
report_removed: "The report has been deleted" # translation_missing
failed_to_remove: "An error occurred, unable to delete the report" # translation_missing

View File

@ -764,4 +764,8 @@ fr:
no_reports: "Aucun signalement pour le moment"
published_by: "publié par"
at_date: "le"
has_reported: "a effectué le signalement suivant:"
has_reported: "a effectué le signalement suivant:"
confirmation_required: "Confirmez le traitement du signalement"
report_will_be_destroyed: "Une fois le signalement traité, le rapport sera supprimé. Cette action est irréversible, continuer ?"
report_removed: "Le rapport a bien été supprimé"
failed_to_remove: "Une erreur est survenue, impossible de supprimer le rapport"

View File

@ -765,3 +765,7 @@ pt:
published_by: "published by" # translation_missing
at_date: "on" # translation_missing
has_reported: "made the following report:" # translation_missing
confirmation_required: "Confirm the processing of the report" # translation_missing
report_will_be_destroyed: "Once the report has been processed, it will be deleted. This can't be undone, continue?" # translation_missing
report_removed: "The report has been deleted" # translation_missing
failed_to_remove: "An error occurred, unable to delete the report" # translation_missing