From 4c847ed34b29f374708c9886762f8c86ee03cf0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionu=C8=9B=20Ar=C8=9B=C4=83ri=C8=99i?= Date: Fri, 21 Jun 2013 16:12:27 +0200 Subject: [PATCH] rename "enable" action to "toggle" The previous action caused confusion when it was called "enable" in the WebUI for both a disabled and an enabled user. It created an expectation that its name would change when the state of the user would change. Fixes bug 1202187 Change-Id: I620843df730520b55bfb709aaff1d63ce3f6e772 --- openstack_dashboard/dashboards/admin/users/tables.py | 4 ++-- openstack_dashboard/dashboards/admin/users/tests.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/users/tables.py b/openstack_dashboard/dashboards/admin/users/tables.py index 4bafebf1885..9e30cc295f0 100644 --- a/openstack_dashboard/dashboards/admin/users/tables.py +++ b/openstack_dashboard/dashboards/admin/users/tables.py @@ -36,12 +36,12 @@ def allowed(self, request, user): class ToggleEnabled(tables.BatchAction): - name = "enable" + name = "toggle" action_present = (_("Enable"), _("Disable")) action_past = (_("Enabled"), _("Disabled")) data_type_singular = _("User") data_type_plural = _("Users") - classes = ("btn-enable",) + classes = ("btn-toggle",) def allowed(self, request, user=None): if not api.keystone.keystone_can_edit_user(): diff --git a/openstack_dashboard/dashboards/admin/users/tests.py b/openstack_dashboard/dashboards/admin/users/tests.py index 848785c94ee..b420fff6792 100644 --- a/openstack_dashboard/dashboards/admin/users/tests.py +++ b/openstack_dashboard/dashboards/admin/users/tests.py @@ -291,7 +291,7 @@ def test_enable_user(self): self.mox.ReplayAll() - formData = {'action': 'users__enable__%s' % user.id} + formData = {'action': 'users__toggle__%s' % user.id} res = self.client.post(USERS_INDEX_URL, formData) self.assertRedirectsNoFollow(res, USERS_INDEX_URL) @@ -308,7 +308,7 @@ def test_disable_user(self): self.mox.ReplayAll() - formData = {'action': 'users__enable__%s' % user.id} + formData = {'action': 'users__toggle__%s' % user.id} res = self.client.post(USERS_INDEX_URL, formData) self.assertRedirectsNoFollow(res, USERS_INDEX_URL) @@ -322,7 +322,7 @@ def test_enable_disable_user_exception(self): .AndRaise(self.exceptions.keystone) self.mox.ReplayAll() - formData = {'action': 'users__enable__%s' % user.id} + formData = {'action': 'users__toggle__%s' % user.id} res = self.client.post(USERS_INDEX_URL, formData) self.assertRedirectsNoFollow(res, USERS_INDEX_URL) @@ -334,7 +334,7 @@ def test_disabling_current_user(self): self.mox.ReplayAll() - formData = {'action': 'users__enable__%s' % self.request.user.id} + formData = {'action': 'users__toggle__%s' % self.request.user.id} res = self.client.post(USERS_INDEX_URL, formData, follow=True) self.assertEqual(list(res.context['messages'])[0].message,