]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Added group in user form
authorNicolas Lœuillet <nicolas@loeuillet.org>
Wed, 9 Nov 2016 12:32:58 +0000 (13:32 +0100)
committerThomas Citharel <tcit@tcit.fr>
Fri, 23 Jun 2017 07:24:20 +0000 (09:24 +0200)
20 files changed:
src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
src/Wallabag/GroupBundle/Entity/Group.php
src/Wallabag/GroupBundle/Form/GroupType.php
src/Wallabag/GroupBundle/Resources/views/Manage/edit.html.twig
src/Wallabag/GroupBundle/Resources/views/Manage/index.html.twig
src/Wallabag/UserBundle/Entity/User.php
src/Wallabag/UserBundle/Form/NewUserType.php
src/Wallabag/UserBundle/Form/UserType.php
src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig
src/Wallabag/UserBundle/Resources/views/Manage/index.html.twig
src/Wallabag/UserBundle/Resources/views/Manage/new.html.twig

index 8d023efa3a157a439cd8b808c7bebad5eeb8b555..7068969b10309070ddd0ff99500a48bf72301aed 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'Gentag adgangskode'
         plain_password_label: '????'
         email_label: 'Emailadresse'
-        # group: 'Group'
         # enabled_label: 'Enabled'
         # last_login_label: 'Last login'
         # twofactor_label: Two factor authentication
index 44f11ab4cadbc94502d0eba328fed64f9384648c..976aa511228c06431c2c978768622d1406b6199b 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'Neues Kennwort wiederholen'
         plain_password_label: '????'
         email_label: 'E-Mail-Adresse'
-        # group: 'Group'
         enabled_label: 'Aktiviert'
         last_login_label: 'Letzter Login'
         twofactor_label: Zwei-Faktor-Authentifizierung
index 0d8cde7ab9ad97fa6b77f798d6cee9fdd18ff3c0..8f507c4017b7b2d06a29802921a0e46f55cca7d6 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'Repeat new password'
         plain_password_label: '????'
         email_label: 'Email'
-        group: 'Group'
         enabled_label: 'Enabled'
         last_login_label: 'Last login'
         twofactor_label: Two factor authentication
index 61fe8a17b6e31cfd0a3684b569c3ba53e35be04b..45711a84cef57370b101ff13af52f38c6422b618 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'رمز تازه را دوباره بنویسید'
         plain_password_label: '????'
         email_label: 'نشانی ایمیل'
-        # group: 'Group'
         # enabled_label: 'Enabled'
         # last_login_label: 'Last login'
         # twofactor_label: Two factor authentication
index be8751ff971a4affd6de63e7c152f3d938c5be4d..beb8f3245a76a325143f49f158b7b50ddc002765 100644 (file)
@@ -16,7 +16,6 @@ security:
 
 menu:
     left:
-<<<<<<< 5da541f5bdeec8ad968ba75a30ca2d19ea64d1f2
         unread: "Non lus"
         starred: "Favoris"
         archive: "Lus"
index a909d2c1cdaa55e04af0ffedbdd981b2a87f2bc1..c563498354f63fdb34f370afe45801b9f12cd3ca 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'Ripeti password'
         plain_password_label: '????'
         email_label: 'E-mail'
-        # group: 'Group'
         # enabled_label: 'Enabled'
         # last_login_label: 'Last login'
         # twofactor_label: Two factor authentication
index a3c935caaeabb6178f88e2aafeb8936aa07ff5eb..dfc28896e568a28ccb4ddc9db00d90a8e3505f88 100644 (file)
@@ -535,7 +535,6 @@ user:
         repeat_new_password_label: 'Confirmatz vòstre novèl senhal'
         plain_password_label: 'Senhal en clar'
         email_label: 'Adreça de corrièl'
-        # group: 'Group'
         enabled_label: 'Actiu'
         last_login_label: 'Darrièra connexion'
         twofactor_label: 'Autentificacion doble-factor'
index d252d4485ba8f2fcafb4aa83490f3b16b9dea103..1b376073527716bb331e9a0d2290f4b60185e0ab 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'Powtórz nowe hasło'
         plain_password_label: 'Jawne hasło'
         email_label: 'Adres email'
-        # group: 'Group'
         enabled_label: 'Włączony'
         last_login_label: 'Ostatnie logowanie'
         twofactor_label: Autoryzacja dwuetapowa
index 29ae81cd6dc14c22cfd04d54dce2adbdfb12da37..1f89627d8904fe903dee7ab951d00cee02946ee7 100644 (file)
@@ -534,7 +534,6 @@ user:
         repeat_new_password_label: 'Repeat new password'
         plain_password_label: '????'
         email_label: 'E-mail'
-        # group: 'Group'
         # enabled_label: 'Enabled'
         # last_login_label: 'Last login'
         # twofactor_label: Two factor authentication
index 4ac867a0f356c514b05e3346e203254a12949b7e..932ae549a3415ce67ff8abaa5692aa21ca91147e 100644 (file)
@@ -513,7 +513,6 @@ user:
         repeat_new_password_label: 'Yeni şifrenin tekrarı'
         plain_password_label: '????'
         email_label: 'E-posta'
-        # group: 'Group'
         # enabled_label: 'Enabled'
         # last_login_label: 'Last login'
         # twofactor_label: Two factor authentication
index e889f74e0170b9b02f8b241ee37224208beae1cf..1381d1eaf34bd37ffee041bf11a8c300e053c64d 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Wallabag\GroupBundle\Entity;
 
+use Doctrine\Common\Collections\ArrayCollection;
 use FOS\UserBundle\Model\Group as BaseGroup;
 use Doctrine\ORM\Mapping as ORM;
 use Wallabag\UserBundle\Entity\User;
index 749c15e9090559a27e4ed3b3dcb87412876ec1c6..c2ad764bc2f39df7306b3005c115a07b5d02fbab 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Wallabag\GroupBundle\Form;
 
-use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 use Symfony\Component\Form\AbstractType;
 use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -22,12 +21,6 @@ class GroupType extends AbstractType
                 'required' => false,
                 'label' => 'group.form.name_label',
             ])
-            ->add('users', EntityType::class, array(
-                'class' => 'WallabagUserBundle:User',
-                'choice_label' => 'username',
-                'multiple' => true,
-                'expanded' => true,
-            ))
             ->add('save', SubmitType::class, [
                 'label' => 'group.form.save',
             ])
index 791a7a189b271ff46636821a43a3942070243047..7de68c353587d0101365e1c9735b99e24a65c79c 100644 (file)
                                     </div>
                                 </div>
 
-                                <div class="row">
-                                    <div class="input-field col s12">
-                                        {{ form_label(edit_form.users) }}
-                                        {{ form_errors(edit_form.users) }}
-                                        {{ form_widget(edit_form.users) }}
-                                    </div>
-                                </div>
-
                                 <br/>
 
                                 {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
index ce2a4556b4cad9e9d6d323b7e35ac3fe2992e3d1..58af3a756664667c68c76f62c3f6d61da28562ba 100644 (file)
                     <div class="input-field col s12">
                         <p class="help">{{ 'group.description'|trans|raw }}</p>
 
-                        <table class="bordered">
-                            <thead>
-                                <tr>
-                                    <th>{{ 'group.form.name_label'|trans }}</th>
-                                    <th>{{ 'group.form.roles_label'|trans }}</th>
-                                    <th>{{ 'group.list.actions'|trans }}</th>
-                                </tr>
-                            </thead>
-                            <tbody>
-                            {% for group in groups %}
-                                <tr>
-                                    <td>{{ group.name }}</td>
-                                    <td></td>
-                                    <td>
-                                        <a href="{{ path('group_edit', { 'id': group.id }) }}">{{ 'group.list.edit_action'|trans }}</a>
-                                    </td>
-                                </tr>
-                            {% endfor %}
-                            </tbody>
-                        </table>
+                        {% if groups is not empty %}
+                            <table class="bordered">
+                                <thead>
+                                    <tr>
+                                        <th>{{ 'group.form.name_label'|trans }}</th>
+                                        <th>{{ 'group.form.roles_label'|trans }}</th>
+                                        <th>{{ 'group.list.actions'|trans }}</th>
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                {% for group in groups %}
+                                    <tr>
+                                        <td>{{ group.name }}</td>
+                                        <td></td>
+                                        <td>
+                                            <a href="{{ path('group_edit', { 'id': group.id }) }}">{{ 'group.list.edit_action'|trans }}</a>
+                                        </td>
+                                    </tr>
+                                {% endfor %}
+                                </tbody>
+                            </table>
+                        {% endif %}
                         <br />
                         <p>
                             <a href="{{ path('group_new') }}" class="waves-effect waves-light btn">{{ 'group.list.create_new_one'|trans }}</a>
index dc10f1c44e8fa17939c3c7c798c5f5a61eada32e..ff658ca5f70f2d0e048c8afefe2c3567c3378b4a 100644 (file)
@@ -98,7 +98,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
     private $authCode;
 
     /**
-     * @ORM\ManyToMany(targetEntity="Wallabag\GroupBundle\Entity\Group", inversedBy="users")
+     * @ORM\ManyToMany(targetEntity="Wallabag\GroupBundle\Entity\Group", inversedBy="users", cascade={"persist"})
      * @ORM\JoinTable(name="user_group",
      *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
      *      inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}
index ad5a2405924ae8b6211f9ac4c6928e7f7d31e385..ee8324d75b3b0b2b4fc99ac09ca6860a69739c69 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Wallabag\UserBundle\Form;
 
+use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 use Symfony\Component\Form\AbstractType;
 use Symfony\Component\Form\Extension\Core\Type\EmailType;
 use Symfony\Component\Form\Extension\Core\Type\PasswordType;
@@ -38,6 +39,12 @@ class NewUserType extends AbstractType
             ->add('email', EmailType::class, [
                 'label' => 'user.form.email_label',
             ])
+            ->add('groups', EntityType::class, array(
+                'class' => 'WallabagGroupBundle:Group',
+                'choice_label' => 'name',
+                'multiple' => true,
+                'expanded' => true,
+            ))
             ->add('save', SubmitType::class, [
                 'label' => 'user.form.save',
             ])
index d8cdbaf95429ba9a74fffb79682fe288da4d1ea7..04632f2aab234ed8b136d6bad1468a3740b0938f 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Wallabag\UserBundle\Form;
 
+use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 use Symfony\Component\Form\AbstractType;
 use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -27,6 +28,12 @@ class UserType extends AbstractType
                 'required' => true,
                 'label' => 'user.form.username_label',
             ])
+            ->add('groups', EntityType::class, array(
+                'class' => 'WallabagGroupBundle:Group',
+                'choice_label' => 'name',
+                'multiple' => true,
+                'expanded' => true,
+            ))
             ->add('email', EmailType::class, [
                 'required' => true,
                 'label' => 'user.form.email_label',
index 3ffd15f5d4b015b14e59e32034792621fff463a7..3c8b9d05548977b80b63b4515618e12b3fe01731 100644 (file)
                                     </div>
                                 </div>
 
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.groups) }}
+                                        {{ form_errors(edit_form.groups) }}
+                                        {{ form_widget(edit_form.groups) }}
+                                    </div>
+                                </div>
+
                                 <div class="row">
                                     <div class="input-field col s12">
                                         {{ form_widget(edit_form.enabled) }}
index 9d5abcaf60b0beaa217be7378dea9d294aafe33c..5fc6163efa199c46eb19691ecfa811aa4ad59ec4 100644 (file)
@@ -30,7 +30,7 @@
                                 {{ form_rest(searchForm) }}
                             </form>
                         </div>
-
+                        
                     </div>
 
                     <table class="bordered">
index 8c894c04009c3f6006c04db0a714be41bc65537b..285894ad588b62c5231e8eb78216fa3d98da134c 100644 (file)
                                     </div>
                                 </div>
 
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_errors(form.groups) }}
+                                        {{ form_widget(form.groups) }}
+                                    </div>
+                                </div>
+
                                 {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
                                 {{ form_rest(form) }}
                             </form>