aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2016-11-03 12:11:48 +0100
committerThomas Citharel <tcit@tcit.fr>2017-06-23 09:22:54 +0200
commit36f30fa31e0d2373f5c39851ea9138493fbde341 (patch)
treef6bba0092e72e21a3f10579250f9b2ec1e41ed70
parente7d2d1bd8ff956c324641070801e1460c06ffaa1 (diff)
downloadwallabag-36f30fa31e0d2373f5c39851ea9138493fbde341.tar.gz
wallabag-36f30fa31e0d2373f5c39851ea9138493fbde341.tar.zst
wallabag-36f30fa31e0d2373f5c39851ea9138493fbde341.zip
Added groups management
-rw-r--r--app/config/routing.yml9
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml46
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig3
-rw-r--r--src/Wallabag/GroupBundle/Controller/ManageController.php137
-rw-r--r--src/Wallabag/GroupBundle/Form/GroupType.php39
-rw-r--r--src/Wallabag/GroupBundle/Form/NewGroupType.php37
-rw-r--r--src/Wallabag/GroupBundle/Resources/views/Manage/edit.html.twig44
-rw-r--r--src/Wallabag/GroupBundle/Resources/views/Manage/index.html.twig44
-rw-r--r--src/Wallabag/GroupBundle/Resources/views/Manage/new.html.twig37
-rw-r--r--tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php64
22 files changed, 696 insertions, 4 deletions
diff --git a/app/config/routing.yml b/app/config/routing.yml
index 9c916f7d..74c21429 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -7,6 +7,11 @@ wallabag_import:
7 type: annotation 7 type: annotation
8 prefix: /import 8 prefix: /import
9 9
10wallabag_group:
11 resource: "@WallabagGroupBundle/Controller/"
12 type: annotation
13 prefix: /groups
14
10wallabag_user: 15wallabag_user:
11 resource: "@WallabagUserBundle/Controller/" 16 resource: "@WallabagUserBundle/Controller/"
12 type: annotation 17 type: annotation
@@ -41,10 +46,6 @@ homepage:
41fos_user: 46fos_user:
42 resource: "@FOSUserBundle/Resources/config/routing/all.xml" 47 resource: "@FOSUserBundle/Resources/config/routing/all.xml"
43 48
44fos_user_group:
45 resource: "@FOSUserBundle/Resources/config/routing/group.xml"
46 prefix: /group
47
48fos_oauth_server_token: 49fos_oauth_server_token:
49 resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml" 50 resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml"
50 51
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index ea7fb086..8d023efa 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Tilbage til de ulæste artikler' 33 back_to_unread: 'Tilbage til de ulæste artikler'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Tilføj ny artikel' 38 add_new_entry: 'Tilføj ny artikel'
38 search: 'Søg' 39 search: 'Søg'
@@ -496,6 +497,25 @@ developer:
496 # paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.' 497 # paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.'
497 # back: 'Back' 498 # back: 'Back'
498 499
500group:
501 # page_title: Groups management
502 # new_group: Create a new group
503 # edit_group: Edit an existing group
504 # description: "Here you can manage all groups (create, edit and delete)"
505 # list:
506 # actions: Actions
507 # edit_action: Edit
508 # yes: Yes
509 # no: No
510 # create_new_one: Create a new group
511 # form:
512 # name_label: 'Name'
513 # roles_label: 'Roles'
514 # save: Save
515 # delete: Delete
516 # delete_confirm: Are you sure?
517 # back_to_list: Back to list
518
499user: 519user:
500 # page_title: Users management 520 # page_title: Users management
501 # new_user: Create a new user 521 # new_user: Create a new user
@@ -602,3 +622,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index fcda6ae6..44f11ab4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Zurück zu ungelesenen Artikeln' 33 back_to_unread: 'Zurück zu ungelesenen Artikeln'
34 users_management: 'Benutzerverwaltung' 34 users_management: 'Benutzerverwaltung'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Neuen Artikel hinzufügen' 38 add_new_entry: 'Neuen Artikel hinzufügen'
38 search: 'Suche' 39 search: 'Suche'
@@ -496,6 +497,25 @@ developer:
496 paragraph_8: 'Wenn du alle API-Endpunkte sehen willst, werfe einen Blick auf die <a href="%link%">API-Dokumentation</a>.' 497 paragraph_8: 'Wenn du alle API-Endpunkte sehen willst, werfe einen Blick auf die <a href="%link%">API-Dokumentation</a>.'
497 back: 'Zurück' 498 back: 'Zurück'
498 499
500group:
501 # page_title: Groups management
502 # new_group: Create a new group
503 # edit_group: Edit an existing group
504 # description: "Here you can manage all groups (create, edit and delete)"
505 # list:
506 # actions: Actions
507 # edit_action: Edit
508 # yes: Yes
509 # no: No
510 # create_new_one: Create a new group
511 # form:
512 # name_label: 'Name'
513 # roles_label: 'Roles'
514 # save: Save
515 # delete: Delete
516 # delete_confirm: Are you sure?
517 # back_to_list: Back to list
518
499user: 519user:
500 page_title: Benutzerverwaltung 520 page_title: Benutzerverwaltung
501 new_user: Erstelle einen neuen Benutzer 521 new_user: Erstelle einen neuen Benutzer
@@ -602,3 +622,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 54427e23..0d8cde7a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Back to unread articles' 33 back_to_unread: 'Back to unread articles'
34 users_management: 'Users management' 34 users_management: 'Users management'
35 site_credentials: 'Site credentials' 35 site_credentials: 'Site credentials'
36 groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Add a new entry' 38 add_new_entry: 'Add a new entry'
38 search: 'Search' 39 search: 'Search'
@@ -496,6 +497,25 @@ developer:
496 paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.' 497 paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.'
497 back: 'Back' 498 back: 'Back'
498 499
500group:
501 page_title: Groups management
502 new_group: Create a new group
503 edit_group: Edit an existing group
504 description: "Here you can manage all groups (create, edit and delete)"
505 list:
506 actions: Actions
507 edit_action: Edit
508 yes: Yes
509 no: No
510 create_new_one: Create a new group
511 form:
512 name_label: 'Name'
513 roles_label: 'Roles'
514 save: Save
515 delete: Delete
516 delete_confirm: Are you sure?
517 back_to_list: Back to list
518
499user: 519user:
500 page_title: Users management 520 page_title: Users management
501 new_user: Create a new user 521 new_user: Create a new user
@@ -602,3 +622,8 @@ flashes:
602 added: 'Site credential for "%host%" added' 622 added: 'Site credential for "%host%" added'
603 updated: 'Site credential for "%host%" updated' 623 updated: 'Site credential for "%host%" updated'
604 deleted: 'Site credential for "%host%" deleted' 624 deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 added: 'Group "%name%" added'
628 updated: 'Group "%name%" updated'
629 deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 96998f53..e632e7e1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -33,6 +33,8 @@ menu:
33 back_to_unread: 'Volver a los artículos sin leer' 33 back_to_unread: 'Volver a los artículos sin leer'
34 users_management: 'Configuración de usuarios' 34 users_management: 'Configuración de usuarios'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # users_management: 'Users management'
37 # groups_management: 'Groups management'
36 top: 38 top:
37 add_new_entry: 'Añadir un nuevo artículo' 39 add_new_entry: 'Añadir un nuevo artículo'
38 search: 'Buscar' 40 search: 'Buscar'
@@ -496,6 +498,25 @@ developer:
496 paragraph_8: 'Si quiere ver todos los métodos del API, puede verlos en <a href="%link%">nuestra documentación del API</a>.' 498 paragraph_8: 'Si quiere ver todos los métodos del API, puede verlos en <a href="%link%">nuestra documentación del API</a>.'
497 back: 'Volver' 499 back: 'Volver'
498 500
501group:
502 # page_title: Groups management
503 # new_group: Create a new group
504 # edit_group: Edit an existing group
505 # description: "Here you can manage all groups (create, edit and delete)"
506 # list:
507 # actions: Actions
508 # edit_action: Edit
509 # yes: Yes
510 # no: No
511 # create_new_one: Create a new group
512 # form:
513 # name_label: 'Name'
514 # roles_label: 'Roles'
515 # save: Save
516 # delete: Delete
517 # delete_confirm: Are you sure?
518 # back_to_list: Back to list
519
499user: 520user:
500 page_title: Gestión de usuarios 521 page_title: Gestión de usuarios
501 new_user: Crear un usuario 522 new_user: Crear un usuario
@@ -601,3 +622,8 @@ flashes:
601 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
602 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
603 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 16c4f3a0..61fe8a17 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'بازگشت به خوانده‌نشده‌ها' 33 back_to_unread: 'بازگشت به خوانده‌نشده‌ها'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'افزودن مقالهٔ تازه' 38 add_new_entry: 'افزودن مقالهٔ تازه'
38 search: 'جستجو' 39 search: 'جستجو'
@@ -496,6 +497,25 @@ developer:
496 # paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.' 497 # paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.'
497 # back: 'بازگشت' 498 # back: 'بازگشت'
498 499
500group:
501 # page_title: Groups management
502 # new_group: Create a new group
503 # edit_group: Edit an existing group
504 # description: "Here you can manage all groups (create, edit and delete)"
505 # list:
506 # actions: Actions
507 # edit_action: Edit
508 # yes: Yes
509 # no: No
510 # create_new_one: Create a new group
511 # form:
512 # name_label: 'Name'
513 # roles_label: 'Roles'
514 # save: Save
515 # delete: Delete
516 # delete_confirm: Are you sure?
517 # back_to_list: Back to list
518
499user: 519user:
500 # page_title: Users management 520 # page_title: Users management
501 # new_user: Create a new user 521 # new_user: Create a new user
@@ -602,3 +622,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 6eac4c36..be8751ff 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -16,6 +16,7 @@ security:
16 16
17menu: 17menu:
18 left: 18 left:
19<<<<<<< 5da541f5bdeec8ad968ba75a30ca2d19ea64d1f2
19 unread: "Non lus" 20 unread: "Non lus"
20 starred: "Favoris" 21 starred: "Favoris"
21 archive: "Lus" 22 archive: "Lus"
@@ -33,6 +34,23 @@ menu:
33 back_to_unread: "Retour aux articles non lus" 34 back_to_unread: "Retour aux articles non lus"
34 users_management: "Gestion des utilisateurs" 35 users_management: "Gestion des utilisateurs"
35 site_credentials: 'Accès aux sites' 36 site_credentials: 'Accès aux sites'
37 unread: 'Non lus'
38 starred: 'Favoris'
39 archive: 'Lus'
40 all_articles: 'Tous les articles'
41 config: 'Configuration'
42 tags: 'Tags'
43 internal_settings: 'Configuration interne'
44 import: 'Importer'
45 howto: 'Aide'
46 developer: 'Développeur'
47 logout: 'Déconnexion'
48 about: 'À propos'
49 search: 'Recherche'
50 save_link: 'Sauvegarder un nouvel article'
51 back_to_unread: 'Retour aux articles non lus'
52 users_management: 'Gestion des utilisateurs'
53 groups_management: 'Gestion des groupes'
36 top: 54 top:
37 add_new_entry: "Sauvegarder un nouvel article" 55 add_new_entry: "Sauvegarder un nouvel article"
38 search: "Rechercher" 56 search: "Rechercher"
@@ -496,6 +514,25 @@ developer:
496 paragraph_8: "Si vous voulez toutes les méthodes de l’API, jetez un oeil <a href=\"%link%\">à la documentation de l’API</a>." 514 paragraph_8: "Si vous voulez toutes les méthodes de l’API, jetez un oeil <a href=\"%link%\">à la documentation de l’API</a>."
497 back: "Retour" 515 back: "Retour"
498 516
517group:
518 page_title: Gestion des groupes
519 new_group: Créer un nouveau group
520 edit_group: Éditer un nouveau groupe
521 description: Ici vous pouvez gérer vos groupes (création, mise à jour et suppression)
522 list:
523 actions: Actions
524 edit_action: Éditer
525 yes: Oui
526 no: Non
527 create_new_one: Créer un nouveau groupe
528 form:
529 name_label: 'Nom'
530 roles_label: 'Rôles'
531 save: Sauvegarder
532 delete: Supprimer
533 delete_confirm: Êtes-vous sur ?
534 back_to_list: Revenir à la liste
535
499user: 536user:
500 page_title: "Gestion des utilisateurs" 537 page_title: "Gestion des utilisateurs"
501 new_user: "Créer un nouvel utilisateur" 538 new_user: "Créer un nouvel utilisateur"
@@ -601,3 +638,12 @@ flashes:
601 added: 'Accès au site "%host%" ajouté' 638 added: 'Accès au site "%host%" ajouté'
602 updated: 'Accès au site "%host%" mis à jour' 639 updated: 'Accès au site "%host%" mis à jour'
603 deleted: 'Accès au site "%host%" supprimé' 640 deleted: 'Accès au site "%host%" supprimé'
641
642 added: "Utilisateur \"%username%\" ajouté"
643 updated: "Utilisateur \"%username%\" mis à jour"
644 deleted: "Utilisateur \"%username%\" supprimé"
645 group:
646 notice:
647 added: "Groupe \"%name%\" ajouté"
648 updated: "Groupe \"%name%\" mis à jour"
649 deleted: "Groupe \"%name%\" supprimé"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 8dff4c6d..a909d2c1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Torna ai contenuti non letti' 33 back_to_unread: 'Torna ai contenuti non letti'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Aggiungi un nuovo contenuto' 38 add_new_entry: 'Aggiungi un nuovo contenuto'
38 search: 'Cerca' 39 search: 'Cerca'
@@ -496,6 +497,25 @@ developer:
496 paragraph_8: 'Se vuoi visualizzare tutti gli API endpoints, dai una occhiata alla <a href="%link%">documentazione delle API</a>.' 497 paragraph_8: 'Se vuoi visualizzare tutti gli API endpoints, dai una occhiata alla <a href="%link%">documentazione delle API</a>.'
497 back: 'Indietro' 498 back: 'Indietro'
498 499
500group:
501 # page_title: Groups management
502 # new_group: Create a new group
503 # edit_group: Edit an existing group
504 # description: "Here you can manage all groups (create, edit and delete)"
505 # list:
506 # actions: Actions
507 # edit_action: Edit
508 # yes: Yes
509 # no: No
510 # create_new_one: Create a new group
511 # form:
512 # name_label: 'Name'
513 # roles_label: 'Roles'
514 # save: Save
515 # delete: Delete
516 # delete_confirm: Are you sure?
517 # back_to_list: Back to list
518
499user: 519user:
500 # page_title: Users management 520 # page_title: Users management
501 # new_user: Create a new user 521 # new_user: Create a new user
@@ -602,3 +622,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 1cf70233..a3c935ca 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Tornar als articles pas legits' 33 back_to_unread: 'Tornar als articles pas legits'
34 users_management: 'Gestion dels utilizaires' 34 users_management: 'Gestion dels utilizaires'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Enregistrar un novèl article' 38 add_new_entry: 'Enregistrar un novèl article'
38 search: 'Cercar' 39 search: 'Cercar'
@@ -496,6 +497,26 @@ developer:
496 paragraph_8: "Se volètz totas las adreças d'accès de l'API, donatz un còp d’uèlh <a href=\"%link%\">a la documentacion de l'API</a>." 497 paragraph_8: "Se volètz totas las adreças d'accès de l'API, donatz un còp d’uèlh <a href=\"%link%\">a la documentacion de l'API</a>."
497 back: 'Retorn' 498 back: 'Retorn'
498 499
500
501group:
502 # page_title: Groups management
503 # new_group: Create a new group
504 # edit_group: Edit an existing group
505 # description: "Here you can manage all groups (create, edit and delete)"
506 # list:
507 # actions: Actions
508 # edit_action: Edit
509 # yes: Yes
510 # no: No
511 # create_new_one: Create a new group
512 # form:
513 # name_label: 'Name'
514 # roles_label: 'Roles'
515 # save: Save
516 # delete: Delete
517 # delete_confirm: Are you sure?
518 # back_to_list: Back to list
519
499user: 520user:
500 page_title: 'Gestion dels utilizaires' 521 page_title: 'Gestion dels utilizaires'
501 new_user: 'Crear un novèl utilizaire' 522 new_user: 'Crear un novèl utilizaire'
@@ -602,3 +623,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 623 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 624 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 625 # deleted: 'Site credential for "%host%" deleted'
626 group:
627 notice:
628 # added: 'Group "%name%" added'
629 # updated: 'Group "%name%" updated'
630 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index d3af4fd5..d252d448 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Powrót do nieprzeczytanych artykułów' 33 back_to_unread: 'Powrót do nieprzeczytanych artykułów'
34 users_management: 'Zarządzanie użytkownikami' 34 users_management: 'Zarządzanie użytkownikami'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Dodaj nowy wpis' 38 add_new_entry: 'Dodaj nowy wpis'
38 search: 'Szukaj' 39 search: 'Szukaj'
@@ -496,6 +497,25 @@ developer:
496 paragraph_8: 'Jeżeli chcesz wyświetlić wszystkie punkty końcowe API, zobacz <a href="%link%">Dokumentacja naszego API</a>.' 497 paragraph_8: 'Jeżeli chcesz wyświetlić wszystkie punkty końcowe API, zobacz <a href="%link%">Dokumentacja naszego API</a>.'
497 back: 'Cofnij' 498 back: 'Cofnij'
498 499
500group:
501 # page_title: Groups management
502 # new_group: Create a new group
503 # edit_group: Edit an existing group
504 # description: "Here you can manage all groups (create, edit and delete)"
505 # list:
506 # actions: Actions
507 # edit_action: Edit
508 # yes: Yes
509 # no: No
510 # create_new_one: Create a new group
511 # form:
512 # name_label: 'Name'
513 # roles_label: 'Roles'
514 # save: Save
515 # delete: Delete
516 # delete_confirm: Are you sure?
517 # back_to_list: Back to list
518
499user: 519user:
500 page_title: Zarządzanie użytkownikami 520 page_title: Zarządzanie użytkownikami
501 new_user: Stwórz nowego użytkownika 521 new_user: Stwórz nowego użytkownika
@@ -602,3 +622,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 4ab5f144..ccb3debb 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Voltar para os artigos não lidos' 33 back_to_unread: 'Voltar para os artigos não lidos'
34 users_management: 'Gestão de Usuários' 34 users_management: 'Gestão de Usuários'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Adicionar uma nova entrada' 38 add_new_entry: 'Adicionar uma nova entrada'
38 search: 'Pesquisa' 39 search: 'Pesquisa'
@@ -601,3 +602,8 @@ flashes:
601 # added: 'Site credential for "%host%" added' 602 # added: 'Site credential for "%host%" added'
602 # updated: 'Site credential for "%host%" updated' 603 # updated: 'Site credential for "%host%" updated'
603 # deleted: 'Site credential for "%host%" deleted' 604 # deleted: 'Site credential for "%host%" deleted'
605 group:
606 notice:
607 # added: 'Group "%name%" added'
608 # updated: 'Group "%name%" updated'
609 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 3952eae8..29ae81cd 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Înapoi la articolele necitite' 33 back_to_unread: 'Înapoi la articolele necitite'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Introdu un nou articol' 38 add_new_entry: 'Introdu un nou articol'
38 search: 'Căutare' 39 search: 'Căutare'
@@ -496,6 +497,25 @@ developer:
496 # paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.' 497 # paragraph_8: 'If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.'
497 # back: 'Back' 498 # back: 'Back'
498 499
500group:
501 # page_title: Groups management
502 # new_group: Create a new group
503 # edit_group: Edit an existing group
504 # description: "Here you can manage all groups (create, edit and delete)"
505 # list:
506 # actions: Actions
507 # edit_action: Edit
508 # yes: Yes
509 # no: No
510 # create_new_one: Create a new group
511 # form:
512 # name_label: 'Name'
513 # roles_label: 'Roles'
514 # save: Save
515 # delete: Delete
516 # delete_confirm: Are you sure?
517 # back_to_list: Back to list
518
499user: 519user:
500 # page_title: Users management 520 # page_title: Users management
501 # new_user: Create a new user 521 # new_user: Create a new user
@@ -602,3 +622,8 @@ flashes:
602 # added: 'Site credential for "%host%" added' 622 # added: 'Site credential for "%host%" added'
603 # updated: 'Site credential for "%host%" updated' 623 # updated: 'Site credential for "%host%" updated'
604 # deleted: 'Site credential for "%host%" deleted' 624 # deleted: 'Site credential for "%host%" deleted'
625 group:
626 notice:
627 # added: 'Group "%name%" added'
628 # updated: 'Group "%name%" updated'
629 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 74f76c72..4ac867a0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Okunmayan makalelere geri dön' 33 back_to_unread: 'Okunmayan makalelere geri dön'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # groups_management: 'Groups management'
36 top: 37 top:
37 add_new_entry: 'Yeni bir makale ekle' 38 add_new_entry: 'Yeni bir makale ekle'
38 search: 'Ara' 39 search: 'Ara'
@@ -580,3 +581,8 @@ flashes:
580 # added: 'Site credential for "%host%" added' 581 # added: 'Site credential for "%host%" added'
581 # updated: 'Site credential for "%host%" updated' 582 # updated: 'Site credential for "%host%" updated'
582 # deleted: 'Site credential for "%host%" deleted' 583 # deleted: 'Site credential for "%host%" deleted'
584 group:
585 notice:
586 # added: 'Group "%name%" added'
587 # updated: 'Group "%name%" updated'
588 # deleted: 'Group "%name%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
index 17fa13bb..545dab90 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
@@ -44,6 +44,7 @@
44 <li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li> 44 <li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li>
45 {% if is_granted('ROLE_SUPER_ADMIN') %} 45 {% if is_granted('ROLE_SUPER_ADMIN') %}
46 <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li> 46 <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li>
47 <li class="menu groups"><a href="{{ path('group_index') }}">{{ 'menu.left.groups_management'|trans }}</a></li>
47 <li class="menu internal"><a href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a></li> 48 <li class="menu internal"><a href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a></li>
48 {% endif %} 49 {% endif %}
49 <li class="menu import"><a href="{{ path('import') }}">{{ 'menu.left.import'|trans }}</a></li> 50 <li class="menu import"><a href="{{ path('import') }}">{{ 'menu.left.import'|trans }}</a></li>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index 60907e11..575c77f2 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -75,6 +75,9 @@
75 <li class="bold {% if currentRoute starts with 'user_' %}active{% endif %}"> 75 <li class="bold {% if currentRoute starts with 'user_' %}active{% endif %}">
76 <a class="waves-effect" href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a> 76 <a class="waves-effect" href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a>
77 </li> 77 </li>
78 <li class="bold {% if currentRoute starts with 'group_' %}active{% endif %}">
79 <a class="waves-effect" href="{{ path('group_index') }}">{{ 'menu.left.groups_management'|trans }}</a>
80 </li>
78 81
79 <li class="bold border-bottom {% if currentRoute == 'craue_config_settings_modify' %}active{% endif %}"> 82 <li class="bold border-bottom {% if currentRoute == 'craue_config_settings_modify' %}active{% endif %}">
80 <a class="waves-effect" href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a> 83 <a class="waves-effect" href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a>
diff --git a/src/Wallabag/GroupBundle/Controller/ManageController.php b/src/Wallabag/GroupBundle/Controller/ManageController.php
new file mode 100644
index 00000000..7015a465
--- /dev/null
+++ b/src/Wallabag/GroupBundle/Controller/ManageController.php
@@ -0,0 +1,137 @@
1<?php
2
3namespace Wallabag\GroupBundle\Controller;
4
5use Symfony\Component\HttpFoundation\Request;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9use Wallabag\GroupBundle\Entity\Group;
10
11/**
12 * Group controller.
13 */
14class ManageController extends Controller
15{
16 /**
17 * Lists all Group entities.
18 *
19 * @Route("/", name="group_index")
20 * @Method("GET")
21 */
22 public function indexAction()
23 {
24 $em = $this->getDoctrine()->getManager();
25
26 $groups = $em->getRepository('WallabagGroupBundle:Group')->findAll();
27
28 return $this->render('WallabagGroupBundle:Manage:index.html.twig', array(
29 'groups' => $groups,
30 ));
31 }
32
33 /**
34 * Creates a new Group entity.
35 *
36 * @Route("/new", name="group_new")
37 * @Method({"GET", "POST"})
38 */
39 public function newAction(Request $request)
40 {
41 $group = new Group('');
42
43 $form = $this->createForm('Wallabag\GroupBundle\Form\NewGroupType', $group);
44 $form->handleRequest($request);
45
46 if ($form->isSubmitted() && $form->isValid()) {
47 $em = $this->getDoctrine()->getManager();
48 $em->persist($group);
49 $em->flush();
50
51 $this->get('session')->getFlashBag()->add(
52 'notice',
53 $this->get('translator')->trans('flashes.group.notice.added', ['%name%' => $group->getName()])
54 );
55
56 return $this->redirectToRoute('group_edit', array('id' => $group->getId()));
57 }
58
59 return $this->render('WallabagGroupBundle:Manage:new.html.twig', array(
60 'group' => $group,
61 'form' => $form->createView(),
62 ));
63 }
64
65 /**
66 * Displays a form to edit an existing Group entity.
67 *
68 * @Route("/{id}/edit", name="group_edit")
69 * @Method({"GET", "POST"})
70 */
71 public function editAction(Request $request, Group $group)
72 {
73 $deleteForm = $this->createDeleteForm($group);
74 $editForm = $this->createForm('Wallabag\GroupBundle\Form\GroupType', $group);
75 $editForm->handleRequest($request);
76
77 if ($editForm->isSubmitted() && $editForm->isValid()) {
78 $em = $this->getDoctrine()->getManager();
79 $em->persist($group);
80 $em->flush();
81
82 $this->get('session')->getFlashBag()->add(
83 'notice',
84 $this->get('translator')->trans('flashes.group.notice.updated', ['%name%' => $group->getName()])
85 );
86
87 return $this->redirectToRoute('group_edit', array('id' => $group->getId()));
88 }
89
90 return $this->render('WallabagGroupBundle:Manage:edit.html.twig', array(
91 'group' => $group,
92 'edit_form' => $editForm->createView(),
93 'delete_form' => $deleteForm->createView(),
94 ));
95 }
96
97 /**
98 * Deletes a Group entity.
99 *
100 * @Route("/{id}", name="group_delete")
101 * @Method("DELETE")
102 */
103 public function deleteAction(Request $request, Group $group)
104 {
105 $form = $this->createDeleteForm($group);
106 $form->handleRequest($request);
107
108 if ($form->isSubmitted() && $form->isValid()) {
109 $this->get('session')->getFlashBag()->add(
110 'notice',
111 $this->get('translator')->trans('flashes.group.notice.deleted', ['%name%' => $group->getName()])
112 );
113
114 $em = $this->getDoctrine()->getManager();
115 $em->remove($group);
116 $em->flush();
117 }
118
119 return $this->redirectToRoute('group_index');
120 }
121
122 /**
123 * Creates a form to delete a Group entity.
124 *
125 * @param Group $group The Group entity
126 *
127 * @return \Symfony\Component\Form\Form The form
128 */
129 private function createDeleteForm(Group $group)
130 {
131 return $this->createFormBuilder()
132 ->setAction($this->generateUrl('group_delete', array('id' => $group->getId())))
133 ->setMethod('DELETE')
134 ->getForm()
135 ;
136 }
137}
diff --git a/src/Wallabag/GroupBundle/Form/GroupType.php b/src/Wallabag/GroupBundle/Form/GroupType.php
new file mode 100644
index 00000000..c2ad764b
--- /dev/null
+++ b/src/Wallabag/GroupBundle/Form/GroupType.php
@@ -0,0 +1,39 @@
1<?php
2
3namespace Wallabag\GroupBundle\Form;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolver;
8use Symfony\Component\Form\Extension\Core\Type\SubmitType;
9use Symfony\Component\Form\Extension\Core\Type\TextType;
10
11class GroupType extends AbstractType
12{
13 /**
14 * @param FormBuilderInterface $builder
15 * @param array $options
16 */
17 public function buildForm(FormBuilderInterface $builder, array $options)
18 {
19 $builder
20 ->add('name', TextType::class, [
21 'required' => false,
22 'label' => 'group.form.name_label',
23 ])
24 ->add('save', SubmitType::class, [
25 'label' => 'group.form.save',
26 ])
27 ;
28 }
29
30 /**
31 * @param OptionsResolver $resolver
32 */
33 public function configureOptions(OptionsResolver $resolver)
34 {
35 $resolver->setDefaults(array(
36 'data_class' => 'Wallabag\GroupBundle\Entity\Group',
37 ));
38 }
39}
diff --git a/src/Wallabag/GroupBundle/Form/NewGroupType.php b/src/Wallabag/GroupBundle/Form/NewGroupType.php
new file mode 100644
index 00000000..29b20fe0
--- /dev/null
+++ b/src/Wallabag/GroupBundle/Form/NewGroupType.php
@@ -0,0 +1,37 @@
1<?php
2
3namespace Wallabag\GroupBundle\Form;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\Extension\Core\Type\SubmitType;
7use Symfony\Component\Form\Extension\Core\Type\TextType;
8use Symfony\Component\Form\FormBuilderInterface;
9use Symfony\Component\OptionsResolver\OptionsResolver;
10
11class NewGroupType extends AbstractType
12{
13 public function buildForm(FormBuilderInterface $builder, array $options)
14 {
15 $builder
16 ->add('name', TextType::class, [
17 'required' => true,
18 'label' => 'group.form.name_label',
19 ])
20 ->add('save', SubmitType::class, [
21 'label' => 'group.form.save',
22 ])
23 ;
24 }
25
26 public function configureOptions(OptionsResolver $resolver)
27 {
28 $resolver->setDefaults([
29 'data_class' => 'Wallabag\GroupBundle\Entity\Group',
30 ]);
31 }
32
33 public function getBlockPrefix()
34 {
35 return 'new_group';
36 }
37}
diff --git a/src/Wallabag/GroupBundle/Resources/views/Manage/edit.html.twig b/src/Wallabag/GroupBundle/Resources/views/Manage/edit.html.twig
new file mode 100644
index 00000000..7de68c35
--- /dev/null
+++ b/src/Wallabag/GroupBundle/Resources/views/Manage/edit.html.twig
@@ -0,0 +1,44 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'group.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'group.edit_group'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(edit_form) }}
16 {{ form_errors(edit_form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(edit_form.name) }}
21 {{ form_errors(edit_form.name) }}
22 {{ form_widget(edit_form.name) }}
23 </div>
24 </div>
25
26 <br/>
27
28 {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
29 {{ form_widget(edit_form._token) }}
30 </form>
31 <p>
32 {{ form_start(delete_form) }}
33 <button onclick="return confirm('{{ 'group.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'group.form.delete'|trans }}</button>
34 {{ form_end(delete_form) }}
35 </p>
36 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('group_index') }}">{{ 'group.form.back_to_list'|trans }}</a></p>
37 </div>
38 </div>
39 </div>
40 </div>
41 </div>
42 </div>
43
44{% endblock %}
diff --git a/src/Wallabag/GroupBundle/Resources/views/Manage/index.html.twig b/src/Wallabag/GroupBundle/Resources/views/Manage/index.html.twig
new file mode 100644
index 00000000..ce2a4556
--- /dev/null
+++ b/src/Wallabag/GroupBundle/Resources/views/Manage/index.html.twig
@@ -0,0 +1,44 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'group.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <p class="help">{{ 'group.description'|trans|raw }}</p>
13
14 <table class="bordered">
15 <thead>
16 <tr>
17 <th>{{ 'group.form.name_label'|trans }}</th>
18 <th>{{ 'group.form.roles_label'|trans }}</th>
19 <th>{{ 'group.list.actions'|trans }}</th>
20 </tr>
21 </thead>
22 <tbody>
23 {% for group in groups %}
24 <tr>
25 <td>{{ group.name }}</td>
26 <td></td>
27 <td>
28 <a href="{{ path('group_edit', { 'id': group.id }) }}">{{ 'group.list.edit_action'|trans }}</a>
29 </td>
30 </tr>
31 {% endfor %}
32 </tbody>
33 </table>
34 <br />
35 <p>
36 <a href="{{ path('group_new') }}" class="waves-effect waves-light btn">{{ 'group.list.create_new_one'|trans }}</a>
37 </p>
38 </div>
39 </div>
40 </div>
41 </div>
42 </div>
43
44{% endblock %}
diff --git a/src/Wallabag/GroupBundle/Resources/views/Manage/new.html.twig b/src/Wallabag/GroupBundle/Resources/views/Manage/new.html.twig
new file mode 100644
index 00000000..3f1c2ad5
--- /dev/null
+++ b/src/Wallabag/GroupBundle/Resources/views/Manage/new.html.twig
@@ -0,0 +1,37 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'group.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'group.new_group'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(form) }}
16 {{ form_errors(form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(form.name) }}
21 {{ form_errors(form.name) }}
22 {{ form_widget(form.name) }}
23 </div>
24 </div>
25
26 {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
27 {{ form_rest(form) }}
28 </form>
29 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('group_index') }}">{{ 'group.form.back_to_list'|trans }}</a></p>
30 </div>
31 </div>
32 </div>
33 </div>
34 </div>
35 </div>
36
37{% endblock %}
diff --git a/tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php b/tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php
new file mode 100644
index 00000000..fc1852ef
--- /dev/null
+++ b/tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php
@@ -0,0 +1,64 @@
1<?php
2
3namespace Wallabag\GroupBundle\Tests\Controller;
4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6
7class ManageControllerTest extends WallabagCoreTestCase
8{
9 public function testLogin()
10 {
11 $client = $this->getClient();
12
13 $client->request('GET', '/groups/');
14
15 $this->assertEquals(302, $client->getResponse()->getStatusCode());
16 $this->assertContains('login', $client->getResponse()->headers->get('location'));
17 }
18
19 public function testCompleteScenario()
20 {
21 $this->logInAs('admin');
22 $client = $this->getClient();
23
24 // Create a new group in the database
25 $crawler = $client->request('GET', '/groups/');
26 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /groups/');
27 $crawler = $client->click($crawler->selectLink('group.list.create_new_one')->link());
28
29 // Fill in the form and submit it
30 $form = $crawler->selectButton('group.form.save')->form(array(
31 'new_group[name]' => 'test_group',
32 ));
33
34 $client->submit($form);
35 $client->followRedirect();
36 $crawler = $client->request('GET', '/groups/');
37
38 // Check data in the show view
39 $this->assertGreaterThan(0, $crawler->filter('td:contains("test_group")')->count(), 'Missing element td:contains("test_group")');
40
41 // Edit the group
42 $crawler = $client->click($crawler->selectLink('group.list.edit_action')->last()->link());
43
44 $form = $crawler->selectButton('group.form.save')->form(array(
45 'group[name]' => 'test_group',
46 ));
47
48 $client->submit($form);
49 $crawler = $client->followRedirect();
50
51 // Check the element contains an attribute with value equals "test_group"
52 $this->assertGreaterThan(0, $crawler->filter('[value="test_group"]')->count(), 'Missing element [value="test_group"]');
53
54 $crawler = $client->request('GET', '/groups/');
55 $crawler = $client->click($crawler->selectLink('group.list.edit_action')->last()->link());
56
57 // Delete the group
58 $client->submit($crawler->selectButton('group.form.delete')->form());
59 $crawler = $client->followRedirect();
60
61 // Check the user has been delete on the list
62 $this->assertNotRegExp('/test_group/', $client->getResponse()->getContent());
63 }
64}