diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-10-19 18:11:09 -0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-10-25 15:11:12 +0000 |
commit | 09f3e9869a27adc8c07c305a2aa5107690aa1d04 (patch) | |
tree | 6712f2293f864e0d314e3c340c90be272ded22fa /install/ui/add.js | |
parent | b4ebcad0e0f27ffcad73aa9bd7246f89d0dd7c9f (diff) | |
download | freeipa-09f3e9869a27adc8c07c305a2aa5107690aa1d04.tar.gz freeipa-09f3e9869a27adc8c07c305a2aa5107690aa1d04.tar.xz freeipa-09f3e9869a27adc8c07c305a2aa5107690aa1d04.zip |
Fixed inconsistent required/optional attributes.
The dialogs and details pages have been modified to use the * symbol
to mark required fields. The automount map and the DNS zone dialogs
have been modified to update the required fields according to the
input type.
Ticket #1696, #1973
Diffstat (limited to 'install/ui/add.js')
-rw-r--r-- | install/ui/add.js | 152 |
1 files changed, 88 insertions, 64 deletions
diff --git a/install/ui/add.js b/install/ui/add.js index 17418aaba..fd99b02c5 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -35,7 +35,72 @@ IPA.add_dialog = function (spec) { that.retry = typeof spec.retry !== 'undefined' ? spec.retry : true; that.command = null; - function show_edit_page(entity,result){ + that.show_edit_page = spec.show_edit_page || show_edit_page; + + var init = function() { + that.create_button({ + name: 'add', + label: IPA.messages.buttons.add, + click: function() { + that.hide_message(); + that.add( + function(data, text_status, xhr) { + var facet = IPA.current_entity.get_facet(); + var table = facet.table; + table.refresh(); + that.close(); + }, + that.on_error); + } + }); + + that.create_button({ + name: 'add_and_add_another', + label: IPA.messages.buttons.add_and_add_another, + click: function() { + that.hide_message(); + that.add( + function(data, text_status, xhr) { + var label = that.entity.metadata.label_singular; + var message = IPA.messages.dialogs.add_confirmation; + message = message.replace('${entity}', label); + that.show_message(message); + + var facet = IPA.current_entity.get_facet(); + var table = facet.table; + table.refresh(); + that.reset(); + }, + that.on_error); + } + }); + + that.create_button({ + name: 'add_and_edit', + label: IPA.messages.buttons.add_and_edit, + click: function() { + that.hide_message(); + that.add( + function(data, text_status, xhr) { + that.close(); + var result = data.result.result; + that.show_edit_page(that.entity, result); + }, + that.on_error); + } + }); + + that.create_button({ + name: 'cancel', + label: IPA.messages.buttons.cancel, + click: function() { + that.hide_message(); + that.close(); + } + }); + }; + + function show_edit_page(entity,result) { var pkey_name = entity.metadata.primary_key; var pkey = result[pkey_name]; if (pkey instanceof Array) { @@ -44,8 +109,6 @@ IPA.add_dialog = function (spec) { IPA.nav.show_entity_page(that.entity, 'default', pkey); } - that.show_edit_page = spec.show_edit_page || show_edit_page; - that.add = function(on_success, on_error) { var pkey_name = that.entity.metadata.primary_key; @@ -110,67 +173,28 @@ IPA.add_dialog = function (spec) { command.execute(); }; - /*dialog initialization*/ - that.create_button({ - name: 'add', - label: IPA.messages.buttons.add, - click: function() { - that.hide_message(); - that.add( - function(data, text_status, xhr) { - var facet = IPA.current_entity.get_facet(); - var table = facet.table; - table.refresh(); - that.close(); - }, - that.on_error); - } - }); - - that.create_button({ - name: 'add_and_add_another', - label: IPA.messages.buttons.add_and_add_another, - click: function() { - that.hide_message(); - that.add( - function(data, text_status, xhr) { - var label = that.entity.metadata.label_singular; - var message = IPA.messages.dialogs.add_confirmation; - message = message.replace('${entity}', label); - that.show_message(message); - - var facet = IPA.current_entity.get_facet(); - var table = facet.table; - table.refresh(); - that.reset(); - }, - that.on_error); - } - }); - - that.create_button({ - name: 'add_and_edit', - label: IPA.messages.buttons.add_and_edit, - click: function() { - that.hide_message(); - that.add( - function(data, text_status, xhr) { - that.close(); - var result = data.result.result; - that.show_edit_page(that.entity, result); - }, - that.on_error); - } - }); - - that.create_button({ - name: 'cancel', - label: IPA.messages.buttons.cancel, - click: function() { - that.hide_message(); - that.close(); - } - }); + that.create = function() { + that.dialog_create(); + + var div = $('<div/>', { + }).appendTo(that.container); + + $('<span/>', { + 'class': 'required-indicator', + text: IPA.required_indicator + }).appendTo(div); + + div.append(' '); + + $('<span/>', { + text: IPA.messages.widget.validation.required + }).appendTo(div); + }; + + // methods that should be invoked by subclasses + that.add_dialog_create = that.create; + + init(); return that; }; |