webui: fix switching between multiple_choice_section choices

- required indicators are not present for all sections except the last
- validation has wrong color for the same sections

There was only one layout for all choices. Layout should not be reused
because `create` method will reset layout's rows therefore it worked
properly only for the last choice.

https://fedorahosted.org/freeipa/ticket/4327

Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
This commit is contained in:
Petr Vobornik committed 2014-05-05 17:54:36 +02:00
1 parent 7eff8ad7dc
commit 093c72d60e
1 file changed
+4 -3
+4 -3
View File
@@ -4534,7 +4534,7 @@ IPA.multiple_choice_section = function(spec) {
var that = IPA.composite_widget(spec);
that.choices = $.ordered_map().put_array(spec.choices, 'name');
that.layout = IPA.build(spec.layout || IPA.fluid_layout);
that.layout = spec.layout || IPA.fluid_layout;
that.create = function(container) {
@@ -4563,7 +4563,7 @@ IPA.multiple_choice_section = function(spec) {
that.create_choice = function(choice) {
var widgets, i, widget, field, section, choice_el, header, radio,
var widgets, i, widget, field, section, layout, choice_el, header, radio,
enabled, radio_id;
widgets = [];
@@ -4610,7 +4610,8 @@ IPA.multiple_choice_section = function(spec) {
'for': radio_id
}).appendTo(header);
section = that.layout.create(widgets);
layout = IPA.build(that.layout);
section = layout.create(widgets);
section.appendTo(choice_el);
choice_el.appendTo(that.choice_container);
};