hz-page-header should allow string interpolations

As noted by Thai in his review for the patch
https://review.openstack.org/#/c/213879/, the hz-page-header
directive should be updated to allow string interpolations
such as {$ ... $} in order to support angular translate.

This patch can be tested by setting DISABLED = False in
_1051_project_ng_images_panel.py and _3031_identity_users_panel.py
and checking the header translation with the pseudo
translation tool.

Change-Id: If9778f361d2bb1682e258578b7525bb734b8f8b6
Closes-Bug: 1485778
This commit is contained in:
Paulo Ewerton 2015-09-15 20:00:34 +00:00 committed by Paulo Ewerton Gomes Fragoso
parent 0d9feb2ee8
commit c55f0df912
6 changed files with 10 additions and 16 deletions

View File

@ -35,13 +35,13 @@
* Default usage to provide a title header and a description that are
* translated by the angular gettext translate filter.:
*
* <hz-page-header header="'My Header' | translate" description="'foo' | translate"/>
* <hz-page-header header="{$ 'My Header' | translate $}" description="{$ 'foo' | translate $}"/>
*
* If you have additional content that you want to include beneath the
* title header and description, then include that content inside the
* directives. Example:
*
* <hz-page-header header="'My Header' | translate" description="'foo' | translate">
* <hz-page-header header="{$ 'My Header' | translate $}" description="{$ 'foo' | translate $}">
* <a href="http://www.openstack.org">Go to OpenStack</a>
* </hz-page-header>
*/
@ -49,8 +49,8 @@
var directive = {
restrict: 'E',
scope: {
header: '=',
description: '='
header: '@',
description: '@'
},
templateUrl: basePath + 'hz-page-header.html',
transclude: true

View File

@ -36,10 +36,8 @@
}));
it('defines basic elements', function () {
$scope.scopeTitle = 'A Title';
$scope.scopeDesc = 'A Description';
var markup = '<hz-page-header header="scopeTitle" ' +
'description="scopeDesc"><a href="#">A href</a></hz-page-header>';
var markup = '<hz-page-header header="A Title" ' +
'description="A Description"><a href="#">A href</a></hz-page-header>';
var $element = digestMarkup($scope, $compile, markup);

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Users" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_domain_page_header.html" with title=_("Users") %}
{% endblock page_header %}
{% block main %}
<ng-include src="'{{ STATIC_URL }}dashboard/identity/users/table/table.html'"></ng-include>
{% endblock %}

View File

@ -1,3 +1,5 @@
<hz-page-header header="{$ 'Users' | translate $}"></hz-page-header>
<table ng-controller="identityUsersTableController as table"
hz-table ng-cloak
st-table="table.iusers"

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Images" %}{% endblock %}
{% block page_header %}
<hz-page-header header="'{% trans "Images" %}'"></hz-page-header>
{% endblock page_header %}
{% block main %}
<ng-include src="'{{ STATIC_URL }}app/core/images/table/images-table.html'"></ng-include>
{% endblock %}

View File

@ -1,3 +1,5 @@
<hz-page-header header="{$ 'Images' | translate $}"></hz-page-header>
<table ng-controller="imagesTableController as table"
hz-table ng-cloak
st-table="table.images"