Merge "Fix concatenation in more misc actions"
This commit is contained in:
commit
3a5e682500
@ -10,6 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
|
||||
@ -22,8 +24,23 @@ class EagerPuppiesTable(tables.DataTable):
|
||||
|
||||
|
||||
class SellPuppy(tables.DeleteAction):
|
||||
data_type_singular = 'Puppy'
|
||||
data_type_plural = 'Puppies'
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
# Translators: test code, don't really have to translate
|
||||
return ungettext_lazy(
|
||||
u"Sell Puppy",
|
||||
u"Sell Puppies",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
# Translators: test code, don't really have to translate
|
||||
return ungettext_lazy(
|
||||
u"Sold Puppy",
|
||||
u"Sold Puppies",
|
||||
count
|
||||
)
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
pass
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
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 tables
|
||||
from horizon.utils import filters as utils_filters
|
||||
@ -20,9 +21,23 @@ from openstack_dashboard import api
|
||||
|
||||
|
||||
class EvacuateHost(tables.LinkAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Evacuate Host",
|
||||
u"Evacuate Hosts",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Evacuated Host",
|
||||
u"Evacuated Hosts",
|
||||
count
|
||||
)
|
||||
|
||||
name = "evacuate"
|
||||
data_type_singular = _("Host")
|
||||
data_type_plural = _("Hosts")
|
||||
verbose_name = _("Evacuate Host")
|
||||
url = "horizon:admin:hypervisors:compute:evacuate_host"
|
||||
classes = ("ajax-modal", "btn-migrate")
|
||||
@ -31,8 +46,6 @@ class EvacuateHost(tables.LinkAction):
|
||||
def __init__(self, **kwargs):
|
||||
super(EvacuateHost, self).__init__(**kwargs)
|
||||
self.name = kwargs.get('name', self.name)
|
||||
self.action_present = kwargs.get('action_present', _("Evacuate"))
|
||||
self.action_past = kwargs.get('action_past', _("Evacuated"))
|
||||
|
||||
def allowed(self, request, instance):
|
||||
if not api.nova.extension_supported('AdminActions', request):
|
||||
|
@ -19,6 +19,7 @@ from django.template import defaultfilters as filters
|
||||
from django.utils import http
|
||||
from django.utils import safestring
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import messages
|
||||
@ -103,8 +104,22 @@ class MakePrivateContainer(tables.Action):
|
||||
|
||||
|
||||
class DeleteContainer(tables.DeleteAction):
|
||||
data_type_singular = _("Container")
|
||||
data_type_plural = _("Containers")
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Container",
|
||||
u"Delete Containers",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Container",
|
||||
u"Deleted Containers",
|
||||
count
|
||||
)
|
||||
|
||||
success_url = "horizon:project:containers:index"
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
@ -312,9 +327,23 @@ class UpdateObject(tables.LinkAction):
|
||||
|
||||
|
||||
class DeleteObject(tables.DeleteAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Object",
|
||||
u"Delete Objects",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Object",
|
||||
u"Deleted Objects",
|
||||
count
|
||||
)
|
||||
|
||||
name = "delete_object"
|
||||
data_type_singular = _("Object")
|
||||
data_type_plural = _("Objects")
|
||||
allowed_data_types = ("objects", "subfolders",)
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
|
@ -15,6 +15,7 @@ from django.http import Http404 # noqa
|
||||
from django.template.defaultfilters import title # noqa
|
||||
from django.utils.http import urlencode # noqa
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import messages
|
||||
from horizon import tables
|
||||
@ -47,8 +48,22 @@ class ChangeStackTemplate(tables.LinkAction):
|
||||
|
||||
|
||||
class DeleteStack(tables.DeleteAction):
|
||||
data_type_singular = _("Stack")
|
||||
data_type_plural = _("Stacks")
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Stack",
|
||||
u"Delete Stacks",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Stack",
|
||||
u"Deleted Stacks",
|
||||
count
|
||||
)
|
||||
|
||||
policy_rules = (("orchestration", "cloudformation:DeleteStack"),)
|
||||
|
||||
def delete(self, request, stack_id):
|
||||
|
Loading…
Reference in New Issue
Block a user