Fix concatenation in identity related actions
Fix concatenation and pluralization issues from Delete Groups, Remove Users, Add Users, Delete Projects, and Delete Domains actions. Change-Id: I7ba06a1acd720165af23a6fb475d061d2cab0e8a partial-bug: 1307476
This commit is contained in:
parent
11a59735f5
commit
3e97f885f8
|
@ -18,6 +18,7 @@ from django.conf import settings
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from keystoneclient import exceptions
|
||||
|
||||
|
@ -87,9 +88,23 @@ class EditDomainLink(tables.LinkAction):
|
|||
|
||||
|
||||
class DeleteDomainsAction(tables.DeleteAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Domain",
|
||||
u"Delete Domains",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Domain",
|
||||
u"Deleted Domains",
|
||||
count
|
||||
)
|
||||
|
||||
name = "delete"
|
||||
data_type_singular = _("Domain")
|
||||
data_type_plural = _("Domains")
|
||||
policy_rules = (('identity', 'identity:delete_domain'),)
|
||||
|
||||
def allowed(self, request, datum):
|
||||
|
|
|
@ -17,6 +17,7 @@ import logging
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.template import defaultfilters
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
|
@ -58,9 +59,23 @@ class EditGroupLink(tables.LinkAction):
|
|||
|
||||
|
||||
class DeleteGroupsAction(tables.DeleteAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Group",
|
||||
u"Delete Groups",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Group",
|
||||
u"Deleted Groups",
|
||||
count
|
||||
)
|
||||
|
||||
name = "delete"
|
||||
data_type_singular = _("Group")
|
||||
data_type_plural = _("Groups")
|
||||
policy_rules = (("identity", "identity:delete_group"),)
|
||||
|
||||
def allowed(self, request, datum):
|
||||
|
@ -120,11 +135,23 @@ class UserFilterAction(tables.FilterAction):
|
|||
|
||||
|
||||
class RemoveMembers(tables.DeleteAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Remove User",
|
||||
u"Remove Users",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Removed User",
|
||||
u"Removed Users",
|
||||
count
|
||||
)
|
||||
|
||||
name = "removeGroupMember"
|
||||
action_present = _("Remove")
|
||||
action_past = _("Removed")
|
||||
data_type_singular = _("User")
|
||||
data_type_plural = _("Users")
|
||||
policy_rules = (("identity", "identity:remove_user_from_group"),)
|
||||
|
||||
def allowed(self, request, user=None):
|
||||
|
@ -179,11 +206,23 @@ class GroupMembersTable(UsersTable):
|
|||
|
||||
|
||||
class AddMembers(tables.BatchAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Add User",
|
||||
u"Add Users",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Added User",
|
||||
u"Added Users",
|
||||
count
|
||||
)
|
||||
|
||||
name = "addMember"
|
||||
action_present = _("Add")
|
||||
action_past = _("Added")
|
||||
data_type_singular = _("User")
|
||||
data_type_plural = _("Users")
|
||||
icon = "plus"
|
||||
requires_input = True
|
||||
success_url = constants.GROUPS_MANAGE_URL
|
||||
|
|
|
@ -14,6 +14,7 @@ from django.core.exceptions import ValidationError # noqa
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
|
@ -109,8 +110,22 @@ class ModifyQuotas(tables.LinkAction):
|
|||
|
||||
|
||||
class DeleteTenantsAction(tables.DeleteAction):
|
||||
data_type_singular = _("Project")
|
||||
data_type_plural = _("Projects")
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Project",
|
||||
u"Delete Projects",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Project",
|
||||
u"Deleted Projects",
|
||||
count
|
||||
)
|
||||
|
||||
policy_rules = (("identity", "identity:delete_project"),)
|
||||
|
||||
def allowed(self, request, project):
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
|
@ -44,8 +45,21 @@ class EditRoleLink(tables.LinkAction):
|
|||
|
||||
|
||||
class DeleteRolesAction(tables.DeleteAction):
|
||||
data_type_singular = _("Role")
|
||||
data_type_plural = _("Roles")
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Role",
|
||||
u"Delete Roles",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Role",
|
||||
u"Deleted Roles",
|
||||
count
|
||||
)
|
||||
policy_rules = (("identity", "identity:delete_role"),)
|
||||
|
||||
def allowed(self, request, role):
|
||||
|
|
Loading…
Reference in New Issue