mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
display reports in interface
This commit is contained in:
parent
630809b91f
commit
7bbea22e76
@ -3,7 +3,21 @@
|
||||
*/
|
||||
Application.Controllers.controller('AbusesController', ['$scope', '$state', 'Abuse', 'abusesPromise', 'growl', '_t',
|
||||
function ($scope, $state, Abuse, abusesPromise, growl, _t) {
|
||||
/* PUBLIC SCOPE */
|
||||
|
||||
// List of all reported abuses
|
||||
$scope.abuses = abusesPromise.abuses;
|
||||
$scope.abuses = [];
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
/**
|
||||
* Kind of constructor: these actions will be realized first when the controller is loaded
|
||||
*/
|
||||
const initialize = function () {
|
||||
// we display only abuses related to projects
|
||||
$scope.abuses = abusesPromise.abuses.filter(a => a.signaled_type === 'Project');
|
||||
};
|
||||
|
||||
// !!! MUST BE CALLED AT THE END of the controller
|
||||
return initialize();
|
||||
}
|
||||
]);
|
||||
|
@ -17,7 +17,22 @@
|
||||
<div class="row m-b-md">
|
||||
<span ng-show="abuses.length === 0" translate>{{ 'manage_abuses.no_reports' }}</span>
|
||||
<ul ng-show="abuses.length > 0">
|
||||
<li ng-repeat="abuse in abuses">{{abuse.id}}</li>
|
||||
<li ng-repeat="abuse in abuses">
|
||||
<div class="signaled">
|
||||
<a ui-sref="app.public.projects_show({id:abuse.signaled.slug})">{{abuse.signaled.name}}</a>,
|
||||
<span translate>{{ 'manage_abuses.published_by' }}</span>
|
||||
<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>
|
||||
</div>
|
||||
<div class="report">
|
||||
<span translate>{{ 'manage_abuses.at_date' }}</span>
|
||||
<span>{{abuse.created_at | amDateFormat:'L' }}</span>,
|
||||
<a href="mailto:{{abuse.email}}">{{abuse.first_name}} {{abuse.last_name}}</a>
|
||||
<span translate>{{ 'manage_abuses.has_reported' }}</span>
|
||||
<cite>{{ abuse.message }}</cite>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
@ -1,5 +1,17 @@
|
||||
json.abuses do
|
||||
json.array!(@abuses) do |abuse|
|
||||
json.extract! abuse, :id, :signaled_id, :signaled_type
|
||||
json.extract! abuse, :id, :signaled_id, :signaled_type, :first_name, :last_name, :email, :message, :created_at
|
||||
case abuse.signaled_type
|
||||
when 'Project'
|
||||
json.signaled do
|
||||
json.extract! abuse.signaled, :name, :slug, :published_at
|
||||
json.author do
|
||||
json.id abuse.signaled.author.id
|
||||
json.full_name abuse.signaled.author.profile.full_name
|
||||
end
|
||||
end
|
||||
else
|
||||
json.signaled abuse.signaled
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -762,3 +762,6 @@ en:
|
||||
manage_abuses:
|
||||
abuses_list: "Reports list"
|
||||
no_reports: "No reports for now"
|
||||
published_by: "published by"
|
||||
at_date: "on"
|
||||
has_reported: "made the following report:"
|
||||
|
@ -762,3 +762,6 @@ es:
|
||||
manage_abuses:
|
||||
abuses_list: "Lista de informes"
|
||||
no_reports: "No informes por ahora"
|
||||
published_by: "published by" # translation_missing
|
||||
at_date: "on" # translation_missing
|
||||
has_reported: "made the following report:" # translation_missing
|
||||
|
@ -761,4 +761,7 @@ fr:
|
||||
# traiter et supprimer les rapports d'abus
|
||||
manage_abuses:
|
||||
abuses_list: "Liste des signalements"
|
||||
no_reports: "Aucun signalement pour le moment"
|
||||
no_reports: "Aucun signalement pour le moment"
|
||||
published_by: "publié par"
|
||||
at_date: "le"
|
||||
has_reported: "a effectué le signalement suivant:"
|
@ -762,3 +762,6 @@ pt:
|
||||
manage_abuses:
|
||||
abuses_list: "Lista de relatórios"
|
||||
no_reports: "Não há relatos de agora"
|
||||
published_by: "published by" # translation_missing
|
||||
at_date: "on" # translation_missing
|
||||
has_reported: "made the following report:" # translation_missing
|
||||
|
Loading…
Reference in New Issue
Block a user