mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-630: Expand the getFieldHeader() utility function to accept arbitrary field names.
This commit is contained in:
@@ -73,8 +73,10 @@ angular.module('form').directive('guacFormField', [function formField() {
|
|||||||
var fieldContent = $element.find('.form-field');
|
var fieldContent = $element.find('.form-field');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces the translation string for the header of the current
|
* Produces the translation string for the header of the field with
|
||||||
* field. The translation string will be of the form:
|
* the given name. If no name is supplied, then the name of the
|
||||||
|
* current field will be used. The translation string will be of
|
||||||
|
* the form:
|
||||||
*
|
*
|
||||||
* <code>NAMESPACE.FIELD_HEADER_NAME<code>
|
* <code>NAMESPACE.FIELD_HEADER_NAME<code>
|
||||||
*
|
*
|
||||||
@@ -82,18 +84,24 @@ angular.module('form').directive('guacFormField', [function formField() {
|
|||||||
* directive and <code>NAME</code> is the field name transformed
|
* directive and <code>NAME</code> is the field name transformed
|
||||||
* via translationStringService.canonicalize().
|
* via translationStringService.canonicalize().
|
||||||
*
|
*
|
||||||
|
* @param {String} [name]
|
||||||
|
* The name of the field to produce the translation header
|
||||||
|
* string for. If omitted, the name of the current field will
|
||||||
|
* be used.
|
||||||
|
*
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
* The translation string which produces the translated header
|
* The translation string which produces the translated header
|
||||||
* of the field.
|
* of the field.
|
||||||
*/
|
*/
|
||||||
$scope.getFieldHeader = function getFieldHeader() {
|
$scope.getFieldHeader = function getFieldHeader(name) {
|
||||||
|
|
||||||
// If no field, or no name, then no header
|
// If no field, or no name, then no header
|
||||||
if (!$scope.field || !$scope.field.name)
|
name = name || ($scope.field && $scope.field.name);
|
||||||
|
if (!name)
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return translationStringService.canonicalize($scope.namespace || 'MISSING_NAMESPACE')
|
return translationStringService.canonicalize($scope.namespace || 'MISSING_NAMESPACE')
|
||||||
+ '.FIELD_HEADER_' + translationStringService.canonicalize($scope.field.name);
|
+ '.FIELD_HEADER_' + translationStringService.canonicalize(name);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user