Skip to content

Commit

Permalink
rename "enable" action to "toggle"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iartarisi committed Jul 17, 2013
1 parent c0ace11 commit 4c847ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions openstack_dashboard/dashboards/admin/users/tables.py
Expand Up @@ -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():
Expand Down
8 changes: 4 additions & 4 deletions openstack_dashboard/dashboards/admin/users/tests.py
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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,
Expand Down

0 comments on commit 4c847ed

Please sign in to comment.