summaryrefslogtreecommitdiffstats
path: root/install/ui/association.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-08-19 10:20:40 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-08-23 16:11:42 +0000
commitfca0f4dd6576f82376a7d98cfc95641c75cd68cb (patch)
tree51aee3c15a7e84219031b2980123569af6d81ff7 /install/ui/association.js
parenta797f907ee43bb73fb649f200a27183c44a885a0 (diff)
downloadfreeipa-fca0f4dd6576f82376a7d98cfc95641c75cd68cb.tar.gz
freeipa-fca0f4dd6576f82376a7d98cfc95641c75cd68cb.tar.xz
freeipa-fca0f4dd6576f82376a7d98cfc95641c75cd68cb.zip
Updated add and delete association dialog titles.
The association table widget and facet have been modified to accept titles for the add and delete dialogs. The table and facet definitions have been modified to specify the appropriate titles. Some unused code have been removed. Ticket #1629
Diffstat (limited to 'install/ui/association.js')
-rw-r--r--install/ui/association.js45
1 files changed, 27 insertions, 18 deletions
diff --git a/install/ui/association.js b/install/ui/association.js
index 4ee4e72ce..4ee36934d 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -278,6 +278,11 @@ IPA.association_config = function (spec) {
IPA.association_table_widget = function (spec) {
spec = spec || {};
+
+ var index = spec.name.indexOf('_');
+ spec.attribute_member = spec.attribute_member || spec.name.substring(0, index);
+ spec.other_entity = spec.other_entity || spec.name.substring(index+1);
+
spec.managed_entity_name = spec.other_entity;
var that = IPA.table_widget(spec);
@@ -289,6 +294,9 @@ IPA.association_table_widget = function (spec) {
that.add_method = spec.add_method || 'add_member';
that.remove_method = spec.remove_method || 'remove_member';
+ that.add_title = spec.add_title || IPA.messages.association.add.member;
+ that.remove_title = spec.remove_title || IPA.messages.association.remove.member;
+
that.adder_columns = $.ordered_map();
that.get_adder_column = function(name) {
@@ -489,11 +497,9 @@ IPA.association_table_widget = function (spec) {
that.create_add_dialog = function() {
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
var label = IPA.metadata.objects[that.other_entity].label;
- var title = IPA.messages.association.add;
- title = title.replace(
- '${entity}',
- that.entity.metadata.label_singular);
+ var title = that.add_title;
+ title = title.replace('${entity}', that.entity.metadata.label_singular);
title = title.replace('${primary_key}', pkey);
title = title.replace('${other_entity}', label);
@@ -561,11 +567,9 @@ IPA.association_table_widget = function (spec) {
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
var label = IPA.metadata.objects[that.other_entity].label;
- var title = IPA.messages.association.remove;
- title = title.replace(
- '${entity}',
- that.entity.metadata.label_singular);
+ var title = that.remove_title;
+ title = title.replace('${entity}', that.entity.metadata.label_singular);
title = title.replace('${primary_key}', pkey);
title = title.replace('${other_entity}', label);
@@ -671,8 +675,8 @@ IPA.association_facet = function (spec) {
link must be set before the call to the base class, to affect the table.
*/
spec.link = spec.link === undefined ? true : spec.link;
-
spec.managed_entity_name = spec.other_entity;
+
var that = IPA.table_facet(spec);
that.entity = spec.entity;
@@ -690,6 +694,9 @@ IPA.association_facet = function (spec) {
that.add_method = spec.add_method || 'add_member';
that.remove_method = spec.remove_method || 'remove_member';
+ that.add_title = spec.add_title || IPA.messages.association.add.member;
+ that.remove_title = spec.remove_title || IPA.messages.association.remove.member;
+
that.adder_columns = $.ordered_map();
that.page_length = spec.page_length === undefined ? 20 : spec.page_length;
@@ -724,7 +731,7 @@ IPA.association_facet = function (spec) {
var i;
var pkey_name;
- if (that.other_entity){
+ if (that.other_entity) {
pkey_name = IPA.metadata.objects[that.other_entity].primary_key;
}
@@ -736,6 +743,12 @@ IPA.association_facet = function (spec) {
});
}
+ if (!that.adder_columns.length) {
+ that.create_adder_column({
+ name: pkey_name,
+ primary_key: true
+ });
+ }
var label = IPA.metadata.objects[that.other_entity] ?
IPA.metadata.objects[that.other_entity].label : that.other_entity;
@@ -911,11 +924,9 @@ IPA.association_facet = function (spec) {
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity;
- var title = IPA.messages.association.add;
- title = title.replace(
- '${entity}',
- that.entity.metadata.label_singular);
+ var title = that.add_title;
+ title = title.replace('${entity}', that.entity.metadata.label_singular);
title = title.replace('${primary_key}', pkey);
title = title.replace('${other_entity}', label);
@@ -970,11 +981,9 @@ IPA.association_facet = function (spec) {
}
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
- var title = IPA.messages.association.remove;
- title = title.replace(
- '${entity}',
- that.entity.metadata.label_singular);
+ var title = that.remove_title;
+ title = title.replace('${entity}', that.entity.metadata.label_singular);
title = title.replace('${primary_key}', pkey);
title = title.replace('${other_entity}', label);