From 630809b91fe84ad543b58bc200d4cdc5204be2fc Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 21 May 2019 11:16:12 +0200 Subject: [PATCH] moved abuses panel to admin zone + fix loading template --- .../controllers/{ => admin}/abuses.js | 2 +- app/assets/javascripts/router.js.erb | 26 +++++++++---------- app/assets/javascripts/services/abuse.js | 4 +-- app/assets/templates/abuses/index.html | 13 ---------- app/assets/templates/admin/abuses/index.html | 23 ++++++++++++++++ .../admin/project_elements/index.html.erb | 10 ++++--- .../admin/project_elements/licences.html.erb | 2 +- .../admin/project_elements/materials.html.erb | 2 +- .../admin/project_elements/themes.html.erb | 2 +- app/assets/templates/projects/index.html.erb | 1 - config/locales/app.admin.en.yml | 15 ++++++----- config/locales/app.admin.es.yml | 15 ++++++----- config/locales/app.admin.fr.yml | 15 ++++++----- config/locales/app.admin.pt.yml | 15 ++++++----- config/locales/app.public.en.yml | 1 - config/locales/app.public.es.yml | 1 - config/locales/app.public.fr.yml | 1 - config/locales/app.public.pt.yml | 1 - 18 files changed, 85 insertions(+), 64 deletions(-) rename app/assets/javascripts/controllers/{ => admin}/abuses.js (86%) delete mode 100644 app/assets/templates/abuses/index.html create mode 100644 app/assets/templates/admin/abuses/index.html diff --git a/app/assets/javascripts/controllers/abuses.js b/app/assets/javascripts/controllers/admin/abuses.js similarity index 86% rename from app/assets/javascripts/controllers/abuses.js rename to app/assets/javascripts/controllers/admin/abuses.js index e0ec6b46f..787a78515 100644 --- a/app/assets/javascripts/controllers/abuses.js +++ b/app/assets/javascripts/controllers/admin/abuses.js @@ -4,6 +4,6 @@ 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; + $scope.abuses = abusesPromise.abuses; } ]); diff --git a/app/assets/javascripts/router.js.erb b/app/assets/javascripts/router.js.erb index 5d6d3d9d2..a5119b1ac 100644 --- a/app/assets/javascripts/router.js.erb +++ b/app/assets/javascripts/router.js.erb @@ -311,19 +311,6 @@ angular.module('application.router', ['ui.router']) 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 .state('app.public.machines_list', { @@ -683,6 +670,19 @@ angular.module('application.router', ['ui.router']) translations: ['Translations', function (Translations) { return Translations.query('app.admin.project_elements').$promise; }] } }) + .state('app.admin.manage_abuses', { + url: '/admin/abuses', + views: { + 'main@': { + templateUrl: '<%= asset_path "admin/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; }] + } + }) // trainings .state('app.admin.trainings', { diff --git a/app/assets/javascripts/services/abuse.js b/app/assets/javascripts/services/abuse.js index 0c7a76902..560ba1fa7 100644 --- a/app/assets/javascripts/services/abuse.js +++ b/app/assets/javascripts/services/abuse.js @@ -3,8 +3,8 @@ Application.Services.factory('Abuse', ['$resource', function ($resource) { return $resource('/api/abuses/:id', { id: '@id' }, { - update: { - method: 'PUT' + query: { + isArray: false } } ); diff --git a/app/assets/templates/abuses/index.html b/app/assets/templates/abuses/index.html deleted file mode 100644 index 81f642ea8..000000000 --- a/app/assets/templates/abuses/index.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-

{{ 'manage_abuses.abuses_list' }}

-
-
- -
-
> -
    -
  • {{abuse.id}}
  • -
-
-
\ No newline at end of file diff --git a/app/assets/templates/admin/abuses/index.html b/app/assets/templates/admin/abuses/index.html new file mode 100644 index 000000000..eeeff6fed --- /dev/null +++ b/app/assets/templates/admin/abuses/index.html @@ -0,0 +1,23 @@ +
+
+
+
+ +
+
+
+
+

{{ 'manage_abuses.abuses_list' }}

+
+
+
+
+ +
+
+ {{ 'manage_abuses.no_reports' }} +
    +
  • {{abuse.id}}
  • +
+
+
\ No newline at end of file diff --git a/app/assets/templates/admin/project_elements/index.html.erb b/app/assets/templates/admin/project_elements/index.html.erb index 8e8da7799..4b9ce21e5 100644 --- a/app/assets/templates/admin/project_elements/index.html.erb +++ b/app/assets/templates/admin/project_elements/index.html.erb @@ -7,10 +7,14 @@
-

{{ 'projects_elements_management' }}

+

{{ 'project_elements.projects_elements_management' }}

+
+
+
+
+ {{ 'project_elements.manage_abuses' }}
- @@ -26,7 +30,7 @@ - + diff --git a/app/assets/templates/admin/project_elements/licences.html.erb b/app/assets/templates/admin/project_elements/licences.html.erb index 78c8c82e7..ac0352d92 100644 --- a/app/assets/templates/admin/project_elements/licences.html.erb +++ b/app/assets/templates/admin/project_elements/licences.html.erb @@ -1,4 +1,4 @@ - + diff --git a/app/assets/templates/admin/project_elements/materials.html.erb b/app/assets/templates/admin/project_elements/materials.html.erb index 320fdc238..6ea552964 100644 --- a/app/assets/templates/admin/project_elements/materials.html.erb +++ b/app/assets/templates/admin/project_elements/materials.html.erb @@ -1,4 +1,4 @@ - +
diff --git a/app/assets/templates/admin/project_elements/themes.html.erb b/app/assets/templates/admin/project_elements/themes.html.erb index 3be7eaa0b..0650bb470 100644 --- a/app/assets/templates/admin/project_elements/themes.html.erb +++ b/app/assets/templates/admin/project_elements/themes.html.erb @@ -1,4 +1,4 @@ - +
diff --git a/app/assets/templates/projects/index.html.erb b/app/assets/templates/projects/index.html.erb index e1b34dc42..f927f20b2 100644 --- a/app/assets/templates/projects/index.html.erb +++ b/app/assets/templates/projects/index.html.erb @@ -14,7 +14,6 @@ diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 59e33d7c5..6373ca36f 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -64,11 +64,13 @@ en: project_elements: # management of the projects' components - projects_elements_management: "Projects elements management" - add_a_material: "Add a material" - add_a_new_theme: "Add a new theme" - licences: "Licences" - add_a_new_licence: "Add a new licence" + project_elements: + projects_elements_management: "Projects elements management" + add_a_material: "Add a material" + add_a_new_theme: "Add a new theme" + licences: "Licences" + add_a_new_licence: "Add a new licence" + manage_abuses: "Manage the reports" trainings: # track and monitor the trainings @@ -758,4 +760,5 @@ en: manage_abuses: # process and delete abuses reports manage_abuses: - abuses_list: "Abuses list" + abuses_list: "Reports list" + no_reports: "No reports for now" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index 003ceff57..70513fefd 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -64,11 +64,13 @@ es: project_elements: # management of the projects' components - projects_elements_management: "Gestión de elementos de proyectos" - add_a_material: "Añadir un material" - add_a_new_theme: "Añadir un nuevo tema" - licences: "Licencias" - add_a_new_licence: "Agregar una nueva licencia" + project_elements: + projects_elements_management: "Gestión de elementos de proyectos" + add_a_material: "Añadir un material" + add_a_new_theme: "Añadir un nuevo tema" + licences: "Licencias" + add_a_new_licence: "Agregar una nueva licencia" + manage_abuses: "Administrar informes" trainings: # track and monitor the trainings @@ -758,4 +760,5 @@ es: manage_abuses: # process and delete abuses reports manage_abuses: - abuses_list: "Abuses list" # translation_missing + abuses_list: "Lista de informes" + no_reports: "No informes por ahora" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 2273704aa..0c756a8e9 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -64,11 +64,13 @@ fr: project_elements: # gestion des éléments constituant les projets - projects_elements_management: "Gestion des éléments projets" - add_a_material: "Ajouter un matériau" - add_a_new_theme: "Ajouter une nouvelle thématique" - licences: "Licences" - add_a_new_licence: "Ajouter une nouvelle licence" + project_elements: + projects_elements_management: "Gestion des éléments projets" + add_a_material: "Ajouter un matériau" + add_a_new_theme: "Ajouter une nouvelle thématique" + licences: "Licences" + add_a_new_licence: "Ajouter une nouvelle licence" + manage_abuses: "Gérer les signalements" trainings: # suivre et surveiller les formations @@ -758,4 +760,5 @@ fr: manage_abuses: # traiter et supprimer les rapports d'abus manage_abuses: - abuses_list: "Liste des abus" \ No newline at end of file + abuses_list: "Liste des signalements" + no_reports: "Aucun signalement pour le moment" \ No newline at end of file diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index 1db902fb7..037e36dc5 100755 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -64,11 +64,13 @@ pt: project_elements: # management of the projects' components - projects_elements_management: "Gerenciar projetos e elementos" - add_a_material: "Adicionar um material" - add_a_new_theme: "Adicionar um novo tema" - licences: "Licenças" - add_a_new_licence: "Adicionar uma nova licença" + project_elements: + projects_elements_management: "Gerenciar projetos e elementos" + add_a_material: "Adicionar um material" + add_a_new_theme: "Adicionar um novo tema" + licences: "Licenças" + add_a_new_licence: "Adicionar uma nova licença" + manage_abuses: "Gerenciar relatórios" trainings: # track and monitor the trainings @@ -758,4 +760,5 @@ pt: manage_abuses: # process and delete abuses reports manage_abuses: - abuses_list: "Abuses list" # translation_missing + abuses_list: "Lista de relatórios" + no_reports: "Não há relatos de agora" diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index 792d94a83..12516262e 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -165,7 +165,6 @@ en: all_materials: "All materials" load_next_projects: "Load next projects" rough_draft: "Rough draft" - manage_abuses: "Manage abuses reports" projects_show: # details of a projet diff --git a/config/locales/app.public.es.yml b/config/locales/app.public.es.yml index ab3aaa5c9..c0230e2c0 100644 --- a/config/locales/app.public.es.yml +++ b/config/locales/app.public.es.yml @@ -164,7 +164,6 @@ es: all_materials: "Todo el material" load_next_projects: "Cargar más proyectos" rough_draft: "Borrador" - manage_abuses: "Manage abuses reports" #translation_missing projects_show: # details of a projet diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index 802213d7c..3a423ba83 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -165,7 +165,6 @@ fr: all_materials: "Tous les matériaux" load_next_projects: "Charger les projets suivants" rough_draft: "Brouillon" - manage_abuses: "Gérer les rapports d'abus" projects_show: # détails d'un projet diff --git a/config/locales/app.public.pt.yml b/config/locales/app.public.pt.yml index e3d47d621..d408e4e84 100755 --- a/config/locales/app.public.pt.yml +++ b/config/locales/app.public.pt.yml @@ -165,7 +165,6 @@ pt: all_materials: "Todos os materiais" load_next_projects: "Carregar próximos projetos" rough_draft: "Rascunho" - manage_abuses: "Manage abuses reports" #translation_missing projects_show: # details of a projet