summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2011-12-05 16:23:38 +0100
committerEndi S. Dewata <edewata@redhat.com>2011-12-08 02:10:34 +0000
commit0e8b57b08988f0121348e30a6d8aafe2aad07759 (patch)
treec688516c09e1488de22212cc4e5c4a037296e9d3
parentc1d0f72c20f5ae09c9872fa4434ba5040248b6b3 (diff)
downloadfreeipa-0e8b57b08988f0121348e30a6d8aafe2aad07759.tar.gz
freeipa-0e8b57b08988f0121348e30a6d8aafe2aad07759.tar.xz
freeipa-0e8b57b08988f0121348e30a6d8aafe2aad07759.zip
Search facets show translated boolean values
Created format method for getting translated messages for boolean values - IPA.boolean_format. Used in hosts, sudo rules, hbac rules and hbac test. https://fedorahosted.org/freeipa/ticket/2027
-rw-r--r--install/ui/hbac.js5
-rw-r--r--install/ui/hbactest.js19
-rw-r--r--install/ui/host.js3
-rw-r--r--install/ui/sudo.js5
-rw-r--r--install/ui/widget.js21
5 files changed, 45 insertions, 8 deletions
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index 21333fa7b..3d2124e40 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -40,7 +40,10 @@ IPA.hbac.rule_entity = function(spec) {
search_all: true,
columns: [
'cn',
- 'ipaenabledflag',
+ {
+ name: 'ipaenabledflag',
+ format: IPA.boolean_format
+ },
'description'
]
}).
diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js
index 57ded45ba..d9a854f11 100644
--- a/install/ui/hbactest.js
+++ b/install/ui/hbactest.js
@@ -61,7 +61,8 @@ IPA.hbac.test_entity = function(spec) {
'description',
{
name: 'has_keytab',
- label: IPA.messages.objects.host.enrolled
+ label: IPA.messages.objects.host.enrolled,
+ format: IPA.boolean_format
}
]
}).
@@ -89,7 +90,8 @@ IPA.hbac.test_entity = function(spec) {
'description',
{
name: 'has_keytab',
- label: IPA.messages.objects.host.enrolled
+ label: IPA.messages.objects.host.enrolled,
+ format: IPA.boolean_format
}
]
}).
@@ -102,7 +104,10 @@ IPA.hbac.test_entity = function(spec) {
facet_group: 'default',
columns: [
'cn',
- 'ipaenabledflag',
+ {
+ name: 'ipaenabledflag',
+ format: IPA.boolean_format
+ },
'description'
]
}).
@@ -118,9 +123,13 @@ IPA.hbac.test_entity = function(spec) {
'cn',
{
name: 'matched',
- label: IPA.messages.objects.hbactest.matched
+ label: IPA.messages.objects.hbactest.matched,
+ format: IPA.boolean_format
+ },
+ {
+ name: 'ipaenabledflag',
+ format: IPA.boolean_format
},
- 'ipaenabledflag',
'description'
]
});
diff --git a/install/ui/host.js b/install/ui/host.js
index 94dd6465f..7427a9b16 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -39,7 +39,8 @@ IPA.host.entity = function(spec) {
'description',
{
name: 'has_keytab',
- label: IPA.messages.objects.host.enrolled
+ label: IPA.messages.objects.host.enrolled,
+ format: IPA.boolean_format
}
]
}).
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 2d3baf95e..5e1dedc7e 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -38,7 +38,10 @@ IPA.sudo.rule_entity = function(spec) {
that.builder.search_facet({
columns: [
'cn',
- 'ipaenabledflag',
+ {
+ name: 'ipaenabledflag',
+ format: IPA.boolean_format
+ },
'description'
]
}).
diff --git a/install/ui/widget.js b/install/ui/widget.js
index ef2c6eb6e..a8ad5cd8e 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -902,6 +902,27 @@ IPA.textarea_widget = function (spec) {
return that;
};
+IPA.boolean_format = function(value) {
+
+ if (value === undefined || value === null) return '';
+
+ if (value instanceof Array) {
+ value = value[0];
+ }
+
+ var normalized_value = typeof value === 'string' ? value.toLowerCase() : '';
+
+ if (value === false || normalized_value === 'false') {
+ return IPA.messages['false'];
+ }
+
+ if (value === true || normalized_value === 'true') {
+ return IPA.messages['true'];
+ }
+
+ return value;
+};
+
/*
The entity name must be set in the spec either directly or via entity.name
*/