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