Merge "Fix concatenation in Network and Router actions"

This commit is contained in:
Jenkins 2014-09-29 07:10:18 +00:00 committed by Gerrit Code Review
commit cdad4940e7
5 changed files with 83 additions and 12 deletions

View File

@ -17,6 +17,7 @@ import logging
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
@ -53,8 +54,22 @@ class SubnetPolicyTargetMixin(policy.PolicyTargetMixin):
class DeleteSubnet(SubnetPolicyTargetMixin, CheckNetworkEditable,
tables.DeleteAction):
data_type_singular = _("Subnet")
data_type_plural = _("Subnets")
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Subnet",
u"Delete Subnets",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Subnet",
u"Deleted Subnets",
count
)
policy_rules = (("network", "delete_subnet"),)
def delete(self, request, obj_id):

View File

@ -17,6 +17,7 @@ from django.core.urlresolvers import reverse
from django import template
from django.template import defaultfilters as filters
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
@ -39,8 +40,22 @@ class CheckNetworkEditable(object):
class DeleteNetwork(policy.PolicyTargetMixin, CheckNetworkEditable,
tables.DeleteAction):
data_type_singular = _("Network")
data_type_plural = _("Networks")
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Network",
u"Delete Networks",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Network",
u"Deleted Networks",
count
)
policy_rules = (("network", "delete_network"),)
def delete(self, request, network_id):

View File

@ -16,6 +16,7 @@ import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from openstack_dashboard.dashboards.project.routers.extensions.routerrules\
import rulemanager
@ -40,8 +41,22 @@ class AddRouterRule(policy.PolicyTargetMixin, tables.LinkAction):
class RemoveRouterRule(policy.PolicyTargetMixin, tables.DeleteAction):
data_type_singular = _("Router Rule")
data_type_plural = _("Router Rules")
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Router Rule",
u"Delete Router Rules",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Router Rule",
u"Deleted Router Rules",
count
)
failure_url = 'horizon:project:routers:detail'
policy_rules = (("network", "update_router"),)

View File

@ -102,11 +102,23 @@ class SetGateway(policy.PolicyTargetMixin, tables.LinkAction):
class ClearGateway(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Clear Gateway",
u"Clear Gateways",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Cleared Gateway",
u"Cleared Gateways",
count
)
name = "cleargateway"
action_present = _("Clear")
action_past = _("Cleared")
data_type_singular = _("Gateway")
data_type_plural = _("Gateways")
classes = ('btn-danger', 'btn-cleargateway')
redirect_url = "horizon:project:routers:index"
policy_rules = (("network", "update_router"),)

View File

@ -17,6 +17,7 @@ import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
@ -35,8 +36,21 @@ class CreateNetworkProfile(tables.LinkAction):
class DeleteNetworkProfile(tables.DeleteAction):
data_type_singular = _("Network Profile")
data_type_plural = _("Network Profiles")
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Network Profile",
u"Delete Network Profiles",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Network Profile",
u"Deleted Network Profiles",
count
)
def delete(self, request, obj_id):
try: