mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
[ongoing] abuses management interface
This commit is contained in:
parent
10a87eb4cb
commit
dd4b6e2cb1
9
app/assets/javascripts/controllers/abuses.js
Normal file
9
app/assets/javascripts/controllers/abuses.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Controller used in abuses management page
|
||||||
|
*/
|
||||||
|
Application.Controllers.controller('AbusesController', ['$scope', '$state', 'Abuse', 'abusesPromise', 'growl', '_t',
|
||||||
|
function ($scope, $state, Abuse, abusesPromise, growl, _t) {
|
||||||
|
// List of all reported abuses
|
||||||
|
$scope.abuses = abusesPromise;
|
||||||
|
}
|
||||||
|
]);
|
@ -1,2 +0,0 @@
|
|||||||
// TODO: This file was created by bulk-decaffeinate.
|
|
||||||
// Sanity-check the conversion and remove this comment.
|
|
@ -311,6 +311,19 @@ angular.module('application.router', ['ui.router'])
|
|||||||
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.projects_edit', 'app.shared.project']).$promise; }]
|
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.projects_edit', 'app.shared.project']).$promise; }]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('app.admin.manage_abuses', {
|
||||||
|
url: '/abuses',
|
||||||
|
views: {
|
||||||
|
'main@': {
|
||||||
|
templateUrl: '<%= asset_path "abuses/index.html" %>',
|
||||||
|
controller: 'AbusesController'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
abusesPromise: ['Abuse', function(Abuse) { return Abuse.query().$promise; }],
|
||||||
|
translations: ['Translations', function(Translations) { return Translations.query('app.admin.manage_abuses').$promise; }]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// machines
|
// machines
|
||||||
.state('app.public.machines_list', {
|
.state('app.public.machines_list', {
|
||||||
|
13
app/assets/templates/abuses/index.html
Normal file
13
app/assets/templates/abuses/index.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<section class="heading b-b">
|
||||||
|
<div class="row no-gutter">
|
||||||
|
<h1 translate>{{ 'manage_abuses.abuses_list' }}</h1>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="m-lg">
|
||||||
|
<div class="row m-b-md">>
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="abuse in abuses">{{abuse.id}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
@ -14,6 +14,7 @@
|
|||||||
<div class="col-xs-12 col-sm-12 col-md-3 b-t hide-b-md" ng-if="isAuthorized(['admin','member'])">
|
<div class="col-xs-12 col-sm-12 col-md-3 b-t hide-b-md" ng-if="isAuthorized(['admin','member'])">
|
||||||
<section class="heading-actions wrapper">
|
<section class="heading-actions wrapper">
|
||||||
<a class="btn btn-lg btn-warning bg-white b-2x rounded m-t-sm upper text-sm" ui-sref="app.logged.projects_new" role="button" translate>{{ 'projects_list.add_a_project' }}</a>
|
<a class="btn btn-lg btn-warning bg-white b-2x rounded m-t-sm upper text-sm" ui-sref="app.logged.projects_new" role="button" translate>{{ 'projects_list.add_a_project' }}</a>
|
||||||
|
<a class="btn btn-ng btn-warning b-2x rounded m-t-sm upper text-sm" ng-if="isAuthorized(['admin'])" ui-sref="app.admin.manage_abuses" role="button" translate>{{ 'projects_list.manage_abuses' }}</a>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
# Typical action is an user reporting an abuse on a project
|
# Typical action is an user reporting an abuse on a project
|
||||||
class API::AbusesController < API::ApiController
|
class API::AbusesController < API::ApiController
|
||||||
before_action :authenticate_user!, except: :create
|
before_action :authenticate_user!, except: :create
|
||||||
|
before_action :set_abuse, only: %i[destroy]
|
||||||
|
|
||||||
|
def index
|
||||||
|
authorize Abuse
|
||||||
|
@abuses = Abuse.all
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@abuse = Abuse.new(abuse_params)
|
@abuse = Abuse.new(abuse_params)
|
||||||
@ -14,8 +20,18 @@ class API::AbusesController < API::ApiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
authorize Abuse
|
||||||
|
@abuse.destroy
|
||||||
|
head :no_content
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def set_abuse
|
||||||
|
@abuse = Abuse.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def abuse_params
|
def abuse_params
|
||||||
params.require(:abuse).permit(:signaled_type, :signaled_id, :first_name, :last_name, :email, :message)
|
params.require(:abuse).permit(:signaled_type, :signaled_id, :first_name, :last_name, :email, :message)
|
||||||
end
|
end
|
||||||
|
12
app/policies/abuse_policy.rb
Normal file
12
app/policies/abuse_policy.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Check the access policies for API::AbusesController
|
||||||
|
class AbusePolicy < ApplicationPolicy
|
||||||
|
def index?
|
||||||
|
user.admin?
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy?
|
||||||
|
user.admin?
|
||||||
|
end
|
||||||
|
end
|
5
app/views/api/abuses/index.json.jbuilder
Normal file
5
app/views/api/abuses/index.json.jbuilder
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
json.abuses do
|
||||||
|
json.array!(@abuses) do |abuse|
|
||||||
|
json.extract! abuse, :id, :signaled_id, :signaled_type
|
||||||
|
end
|
||||||
|
end
|
@ -63,7 +63,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- RSS -->
|
<!-- RSS -->
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.projects_list.the_fablab_projects') %>" href="<%= rss_projects_path %>.xml">
|
<link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.projects_list.projects_list.the_fablab_projects') %>" href="<%= rss_projects_path %>.xml">
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.events_list.the_fablab_s_events') %>" href="<%= rss_events_path %>.xml">
|
<link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.events_list.the_fablab_s_events') %>" href="<%= rss_events_path %>.xml">
|
||||||
|
|
||||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||||
|
@ -754,3 +754,8 @@ en:
|
|||||||
space_edit:
|
space_edit:
|
||||||
edit_the_space_NAME: "Edit the space: {{NAME}}" # angular interpolation
|
edit_the_space_NAME: "Edit the space: {{NAME}}" # angular interpolation
|
||||||
validate_the_changes: "Validate the changes"
|
validate_the_changes: "Validate the changes"
|
||||||
|
|
||||||
|
manage_abuses:
|
||||||
|
# process and delete abuses reports
|
||||||
|
manage_abuses:
|
||||||
|
abuses_list: "Abuses list"
|
||||||
|
@ -754,3 +754,8 @@ es:
|
|||||||
space_edit:
|
space_edit:
|
||||||
edit_the_space_NAME: "Edit the space: {{NAME}}" # angular interpolation # translation_missing
|
edit_the_space_NAME: "Edit the space: {{NAME}}" # angular interpolation # translation_missing
|
||||||
validate_the_changes: "Validar los cambios"
|
validate_the_changes: "Validar los cambios"
|
||||||
|
|
||||||
|
manage_abuses:
|
||||||
|
# process and delete abuses reports
|
||||||
|
manage_abuses:
|
||||||
|
abuses_list: "Abuses list" # translation_missing
|
||||||
|
@ -754,3 +754,8 @@ fr:
|
|||||||
space_edit:
|
space_edit:
|
||||||
edit_the_space_NAME: "Modifier l'espace : {{NAME}}" # angular interpolation
|
edit_the_space_NAME: "Modifier l'espace : {{NAME}}" # angular interpolation
|
||||||
validate_the_changes: "Valider les modifications"
|
validate_the_changes: "Valider les modifications"
|
||||||
|
|
||||||
|
manage_abuses:
|
||||||
|
# traiter et supprimer les rapports d'abus
|
||||||
|
manage_abuses:
|
||||||
|
abuses_list: "Liste des abus"
|
@ -754,3 +754,8 @@ pt:
|
|||||||
space_edit:
|
space_edit:
|
||||||
edit_the_space_NAME: "Editar o espaço: {{NAME}}" # angular interpolation
|
edit_the_space_NAME: "Editar o espaço: {{NAME}}" # angular interpolation
|
||||||
validate_the_changes: "Validar mudanças"
|
validate_the_changes: "Validar mudanças"
|
||||||
|
|
||||||
|
manage_abuses:
|
||||||
|
# process and delete abuses reports
|
||||||
|
manage_abuses:
|
||||||
|
abuses_list: "Abuses list" # translation_missing
|
||||||
|
@ -150,6 +150,7 @@ en:
|
|||||||
# projects gallery
|
# projects gallery
|
||||||
projects_list:
|
projects_list:
|
||||||
the_fablab_projects: "The Fab Lab projects"
|
the_fablab_projects: "The Fab Lab projects"
|
||||||
|
add_a_project: "Add a project"
|
||||||
search_over_the_whole_network: "Search over the whole Fab Manager network"
|
search_over_the_whole_network: "Search over the whole Fab Manager network"
|
||||||
tooltip_openlab_projects_switch: "The search over the whole network lets you search over the projects of every Fab-manager using this feature !"
|
tooltip_openlab_projects_switch: "The search over the whole network lets you search over the projects of every Fab-manager using this feature !"
|
||||||
openlab_search_not_available_at_the_moment: "Search over the whole network is not available at the moment. You still can search over the projects of this platform."
|
openlab_search_not_available_at_the_moment: "Search over the whole network is not available at the moment. You still can search over the projects of this platform."
|
||||||
@ -160,9 +161,11 @@ en:
|
|||||||
my_projects: "My projects"
|
my_projects: "My projects"
|
||||||
projects_to_whom_i_take_part_in: "Projects to whom I take part in"
|
projects_to_whom_i_take_part_in: "Projects to whom I take part in"
|
||||||
all_machines: "All machines"
|
all_machines: "All machines"
|
||||||
|
all_themes: "All themes"
|
||||||
all_materials: "All materials"
|
all_materials: "All materials"
|
||||||
load_next_projects: "Load next projects"
|
load_next_projects: "Load next projects"
|
||||||
rough_draft: "Rough draft"
|
rough_draft: "Rough draft"
|
||||||
|
manage_abuses: "Manage abuses reports"
|
||||||
|
|
||||||
projects_show:
|
projects_show:
|
||||||
# details of a projet
|
# details of a projet
|
||||||
|
@ -149,6 +149,7 @@ es:
|
|||||||
# projects gallery
|
# projects gallery
|
||||||
projects_list:
|
projects_list:
|
||||||
the_fablab_projects: "Los proyectos del FabLab"
|
the_fablab_projects: "Los proyectos del FabLab"
|
||||||
|
add_a_project: "Añadir un proyecto"
|
||||||
search_over_the_whole_network: "Buscar en toda la red de FabLab"
|
search_over_the_whole_network: "Buscar en toda la red de FabLab"
|
||||||
tooltip_openlab_projects_switch: "La busqueda en toda la red le permite buscar los proyectos de todos los FabLab que usan esta característica"
|
tooltip_openlab_projects_switch: "La busqueda en toda la red le permite buscar los proyectos de todos los FabLab que usan esta característica"
|
||||||
openlab_search_not_available_at_the_moment: "La busqueda en toda la red no está disponible en este momento. Puede seguir buscando proyectos en este FabLab."
|
openlab_search_not_available_at_the_moment: "La busqueda en toda la red no está disponible en este momento. Puede seguir buscando proyectos en este FabLab."
|
||||||
@ -159,9 +160,11 @@ es:
|
|||||||
my_projects: "Mis proyectos"
|
my_projects: "Mis proyectos"
|
||||||
projects_to_whom_i_take_part_in: "Proyectos de los que formo parte"
|
projects_to_whom_i_take_part_in: "Proyectos de los que formo parte"
|
||||||
all_machines: "Todas las máquinas"
|
all_machines: "Todas las máquinas"
|
||||||
|
all_themes: "Todos los temas"
|
||||||
all_materials: "Todo el material"
|
all_materials: "Todo el material"
|
||||||
load_next_projects: "Cargar más proyectos"
|
load_next_projects: "Cargar más proyectos"
|
||||||
rough_draft: "Borrador"
|
rough_draft: "Borrador"
|
||||||
|
manage_abuses: "Manage abuses reports" #translation_missing
|
||||||
|
|
||||||
projects_show:
|
projects_show:
|
||||||
# details of a projet
|
# details of a projet
|
||||||
|
@ -150,6 +150,7 @@ fr:
|
|||||||
# galerie des projets
|
# galerie des projets
|
||||||
projects_list:
|
projects_list:
|
||||||
the_fablab_projects: "Les projets du FabLab"
|
the_fablab_projects: "Les projets du FabLab"
|
||||||
|
add_a_project: "Ajouter un projet"
|
||||||
search_over_the_whole_network: "Chercher sur tout le réseau Fab Manager"
|
search_over_the_whole_network: "Chercher sur tout le réseau Fab Manager"
|
||||||
tooltip_openlab_projects_switch: "La recherche sur tout le réseau vous permet de rechercher parmis les projets de tous les Fab-managers utilisant cette fonctionnalité !"
|
tooltip_openlab_projects_switch: "La recherche sur tout le réseau vous permet de rechercher parmis les projets de tous les Fab-managers utilisant cette fonctionnalité !"
|
||||||
openlab_search_not_available_at_the_moment: "La recherche sur tout le réseau n'est pas disponible pour le moment. Vous pouvez cependant effectuer une recherche parmis les projets de cette plateforme."
|
openlab_search_not_available_at_the_moment: "La recherche sur tout le réseau n'est pas disponible pour le moment. Vous pouvez cependant effectuer une recherche parmis les projets de cette plateforme."
|
||||||
@ -160,9 +161,11 @@ fr:
|
|||||||
my_projects: "Mes projets"
|
my_projects: "Mes projets"
|
||||||
projects_to_whom_i_take_part_in: "Les projets auxquels je collabore"
|
projects_to_whom_i_take_part_in: "Les projets auxquels je collabore"
|
||||||
all_machines: "Toutes les machines"
|
all_machines: "Toutes les machines"
|
||||||
|
all_themes: "Toutes les thématiques"
|
||||||
all_materials: "Tous les matériaux"
|
all_materials: "Tous les matériaux"
|
||||||
load_next_projects: "Charger les projets suivants"
|
load_next_projects: "Charger les projets suivants"
|
||||||
rough_draft: "Brouillon"
|
rough_draft: "Brouillon"
|
||||||
|
manage_abuses: "Gérer les rapports d'abus"
|
||||||
|
|
||||||
projects_show:
|
projects_show:
|
||||||
# détails d'un projet
|
# détails d'un projet
|
||||||
|
@ -150,6 +150,7 @@ pt:
|
|||||||
# projects gallery
|
# projects gallery
|
||||||
projects_list:
|
projects_list:
|
||||||
the_fablab_projects: "Projetos do Fab Lab"
|
the_fablab_projects: "Projetos do Fab Lab"
|
||||||
|
add_a_project: "Adicionar projeto"
|
||||||
search_over_the_whole_network: "Pesquisar em todos os FabLabs"
|
search_over_the_whole_network: "Pesquisar em todos os FabLabs"
|
||||||
tooltip_openlab_projects_switch: "A busca em todos os FabLabs busca projetos em todos os FabLabs que usam o Fab-manager !"
|
tooltip_openlab_projects_switch: "A busca em todos os FabLabs busca projetos em todos os FabLabs que usam o Fab-manager !"
|
||||||
openlab_search_not_available_at_the_moment: "A busca em toda a rede de FabLabs não está disponível no momento. Você pode procurar por projetos nesta plataforma."
|
openlab_search_not_available_at_the_moment: "A busca em toda a rede de FabLabs não está disponível no momento. Você pode procurar por projetos nesta plataforma."
|
||||||
@ -160,9 +161,11 @@ pt:
|
|||||||
my_projects: "Meus Projetos"
|
my_projects: "Meus Projetos"
|
||||||
projects_to_whom_i_take_part_in: "Projetos que eu participo"
|
projects_to_whom_i_take_part_in: "Projetos que eu participo"
|
||||||
all_machines: "Todas as máquinas"
|
all_machines: "Todas as máquinas"
|
||||||
|
all_themes: "Todos temas"
|
||||||
all_materials: "Todos os materiais"
|
all_materials: "Todos os materiais"
|
||||||
load_next_projects: "Carregar próximos projetos"
|
load_next_projects: "Carregar próximos projetos"
|
||||||
rough_draft: "Rascunho"
|
rough_draft: "Rascunho"
|
||||||
|
manage_abuses: "Manage abuses reports" #translation_missing
|
||||||
|
|
||||||
projects_show:
|
projects_show:
|
||||||
# details of a projet
|
# details of a projet
|
||||||
|
@ -123,7 +123,7 @@ Rails.application.routes.draw do
|
|||||||
get 'active', action: 'active', on: :collection
|
get 'active', action: 'active', on: :collection
|
||||||
post 'send_code', action: 'send_code', on: :collection
|
post 'send_code', action: 'send_code', on: :collection
|
||||||
end
|
end
|
||||||
resources :abuses, only: [:create]
|
resources :abuses, only: %i[index create destroy]
|
||||||
resources :open_api_clients, only: %i[index create update destroy] do
|
resources :open_api_clients, only: %i[index create update destroy] do
|
||||||
patch :reset_token, on: :member
|
patch :reset_token, on: :member
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user