Merge "Allow some translations to be made."
This commit is contained in:
commit
a775c654ba
@ -869,7 +869,9 @@ class DeleteAction(BatchAction):
|
||||
def __init__(self, **kwargs):
|
||||
super(DeleteAction, self).__init__(**kwargs)
|
||||
self.name = kwargs.get('name', self.name)
|
||||
if not hasattr(self, "action_present"):
|
||||
self.action_present = kwargs.get('action_present', _("Delete"))
|
||||
if not hasattr(self, "action_past"):
|
||||
self.action_past = kwargs.get('action_past', _("Deleted"))
|
||||
self.icon = "remove"
|
||||
|
||||
|
@ -21,6 +21,7 @@ from django import shortcuts
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import string_concat # noqa
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import messages
|
||||
@ -69,13 +70,25 @@ class AllocateIP(tables.LinkAction):
|
||||
|
||||
class ReleaseIPs(tables.BatchAction):
|
||||
name = "release"
|
||||
action_present = _("Release")
|
||||
action_past = _("Released")
|
||||
data_type_singular = _("Floating IP")
|
||||
data_type_plural = _("Floating IPs")
|
||||
classes = ('btn-danger',)
|
||||
icon = "arrow-up"
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Release floating IP",
|
||||
u"Release floating IPs",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Floating IP released",
|
||||
u"Floating IPs released",
|
||||
count
|
||||
)
|
||||
|
||||
def allowed(self, request, fip=None):
|
||||
if api.base.is_service_enabled(request, "network"):
|
||||
policy = (("network", "delete_floatingip"),)
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
from django.utils.translation import string_concat # noqa
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
@ -22,10 +23,24 @@ from openstack_dashboard.usage import quotas
|
||||
|
||||
|
||||
class DeleteKeyPairs(tables.DeleteAction):
|
||||
data_type_singular = _("Key Pair")
|
||||
data_type_plural = _("Key Pairs")
|
||||
policy_rules = (("compute", "compute_extension:keypairs:delete"),)
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete key pair",
|
||||
u"Delete key pairs",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Key pair deleted",
|
||||
u"Key pairs deleted",
|
||||
count
|
||||
)
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
api.nova.keypair_delete(request, obj_id)
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
@ -27,8 +28,22 @@ POLICY_CHECK = getattr(settings, "POLICY_CHECK_FUNCTION",
|
||||
|
||||
|
||||
class DeleteGroup(tables.DeleteAction):
|
||||
data_type_singular = _("Security Group")
|
||||
data_type_plural = _("Security Groups")
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete security group",
|
||||
u"Delete security groups",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Security group deleted",
|
||||
u"Security groups deleted",
|
||||
count
|
||||
)
|
||||
|
||||
def get_policy_target(self, request, datum=None):
|
||||
project_id = None
|
||||
|
Loading…
Reference in New Issue
Block a user