diff --git a/horizon/static/horizon/js/horizon.tables.js b/horizon/static/horizon/js/horizon.tables.js index 5068ac3b36..215666ce07 100644 --- a/horizon/static/horizon/js/horizon.tables.js +++ b/horizon/static/horizon/js/horizon.tables.js @@ -175,8 +175,10 @@ horizon.datatables = { var $this = $(this); var $action_buttons = $this.find('.table_actions button[data-batch-action="true"]'); var $more_dropdown = $this.find('.table_actions_menu > a.dropdown-toggle'); - if (disable_button === undefined) { - disable_button = $this.find(".table-row-multi-select").filter(":checked").length == 0; + if (disable_button === undefined) { + var checkboxes = $this.find(".table-row-multi-select"); + var checked = checkboxes.filter(":checked"); + disable_button = (checkboxes.length > 0 && checked.length == 0); } $action_buttons.toggleClass("disabled", disable_button); $more_dropdown.toggleClass("disabled", disable_button); diff --git a/horizon/tables/base.py b/horizon/tables/base.py index b8c9914df9..0a57d9b59a 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -908,6 +908,11 @@ class DataTableOptions(object): from this list will take precedence over actions from the ``table_actions`` list. + .. attribute:: table_actions_menu_label + + A label of a menu button for ``table_actions_menu``. The default is + "Actions" or "More Actions" depending on ``table_actions``. + .. attribute:: row_actions A list similar to ``table_actions`` except tailored to appear for @@ -1048,6 +1053,9 @@ class DataTableOptions(object): self.table_actions = getattr(options, 'table_actions', []) self.row_actions = getattr(options, 'row_actions', []) self.table_actions_menu = getattr(options, 'table_actions_menu', []) + self.table_actions_menu_label = getattr(options, + 'table_actions_menu_label', + None) self.cell_class = getattr(options, 'cell_class', Cell) self.row_class = getattr(options, 'row_class', Row) self.column_class = getattr(options, 'column_class', Column) @@ -1517,6 +1525,9 @@ class DataTable(object): extra_context['table_actions_menu'].append(action) elif action != extra_context.get('filter'): extra_context['table_actions_buttons'].append(action) + if self._meta.table_actions_menu_label: + extra_context['table_actions_menu_label'] = \ + self._meta.table_actions_menu_label context = template.RequestContext(self.request, extra_context) self.set_multiselect_column_visibility(len(bound_actions) > 0) return table_actions_template.render(context) diff --git a/horizon/templates/horizon/common/_data_table_table_actions.html b/horizon/templates/horizon/common/_data_table_table_actions.html index 4be3814822..2ef16a81b6 100644 --- a/horizon/templates/horizon/common/_data_table_table_actions.html +++ b/horizon/templates/horizon/common/_data_table_table_actions.html @@ -49,9 +49,9 @@
{% if table_actions_buttons|length > 0 %} - {% trans "More Actions" %} + {{ table_actions_menu_label|default:_("More Actions") }} {% else %} - {% trans "Actions" %} + {{ table_actions_menu_label|default:_("Actions") }} {% endif %} diff --git a/openstack_dashboard/dashboards/project/api_access/tables.py b/openstack_dashboard/dashboards/project/api_access/tables.py index b2e2144942..cddddc14e6 100644 --- a/openstack_dashboard/dashboards/project/api_access/tables.py +++ b/openstack_dashboard/dashboards/project/api_access/tables.py @@ -34,8 +34,8 @@ def pretty_service_names(name): class DownloadEC2(tables.LinkAction): name = "download_ec2" - verbose_name = _("Download EC2 Credentials") - verbose_name_plural = _("Download EC2 Credentials") + verbose_name = _("EC2 Credentials") + verbose_name_plural = _("EC2 Credentials") icon = "download" url = "horizon:project:api_access:ec2" policy_rules = (("compute", "os_compute_api:os-certificates:create"),) @@ -46,16 +46,16 @@ class DownloadEC2(tables.LinkAction): class DownloadCloudsYaml(tables.LinkAction): name = "download_clouds_yaml" - verbose_name = _("Download OpenStack clouds.yaml File") - verbose_name_plural = _("Download OpenStack clouds.yaml File") + verbose_name = _("OpenStack clouds.yaml File") + verbose_name_plural = _("OpenStack clouds.yaml File") icon = "download" url = "horizon:project:api_access:clouds.yaml" class DownloadOpenRC(tables.LinkAction): name = "download_openrc" - verbose_name = _("Download OpenStack RC File v3") - verbose_name_plural = _("Download OpenStack RC File v3") + verbose_name = _("OpenStack RC File (Identity API v3)") + verbose_name_plural = _("OpenStack RC File (Identity API v3)") icon = "download" url = "horizon:project:api_access:openrc" @@ -65,8 +65,8 @@ class DownloadOpenRC(tables.LinkAction): class DownloadOpenRCv2(tables.LinkAction): name = "download_openrc_v2" - verbose_name = _("Download OpenStack RC File v2.0") - verbose_name_plural = _("Download OpenStack RC File v2.0") + verbose_name = _("OpenStack RC File (Identity API v2.0)") + verbose_name_plural = _("OpenStack RC File (Identity API v2.0)") icon = "download" url = "horizon:project:api_access:openrcv2" @@ -113,6 +113,9 @@ class EndpointsTable(tables.DataTable): name = "endpoints" verbose_name = _("API Endpoints") multi_select = False - table_actions = (DownloadCloudsYaml, DownloadOpenRCv2, DownloadOpenRC, - DownloadEC2, - ViewCredentials, RecreateCredentials) + table_actions = (ViewCredentials, RecreateCredentials) + table_actions_menu = (DownloadCloudsYaml, + DownloadOpenRCv2, + DownloadOpenRC, + DownloadEC2) + table_actions_menu_label = _('Download OpenStack RC File')