From b68f819de75073285c17c28a30afe5b5dbfe5176 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 4 Jul 2014 13:24:47 +0200 Subject: webui: improve usability of attributes widget Attributes widget layour was changed from tiny table which allowed to display only few options to a checkbox list with multiple columns (depends on container). Check all attributes option was removed to force the user to read through the attributes which he selects. Initial version authored by: Adam Misnyovszki https://fedorahosted.org/freeipa/ticket/4253 Reviewed-By: Endi Sukma Dewata --- install/ui/ipa.css | 15 +++++- install/ui/src/freeipa/aci.js | 88 ++------------------------------- install/ui/src/freeipa/widget.js | 1 - ipatests/test_webui/test_delegation.py | 6 +-- ipatests/test_webui/test_rbac.py | 6 +-- ipatests/test_webui/test_selfservice.py | 6 +-- 6 files changed, 26 insertions(+), 96 deletions(-) diff --git a/install/ui/ipa.css b/install/ui/ipa.css index 8d350cc5d..ec79688a2 100644 --- a/install/ui/ipa.css +++ b/install/ui/ipa.css @@ -345,7 +345,7 @@ table.scrollable tbody { .option_widget { list-style-type: none; margin: 0; - padding: 0; + padding: 0 0 0 1px; } .option_widget.nested { @@ -365,6 +365,19 @@ table.scrollable tbody { max-width: 150px; } +.option_widget.columns.attribute_widget { + position: relative; + overflow-y: auto; + max-height: 36em; +} + +.option_widget.columns.attribute_widget > li { + float: left; + width: 50%; + min-width: 90px; + max-width: 200px; +} + .combobox-widget-input { position: relative; } diff --git a/install/ui/src/freeipa/aci.js b/install/ui/src/freeipa/aci.js index 67579026f..ce7d42787 100644 --- a/install/ui/src/freeipa/aci.js +++ b/install/ui/src/freeipa/aci.js @@ -544,6 +544,7 @@ return { aci.attributes_widget = function(spec) { spec = spec || {}; + spec.layout = spec.layout || 'columns attribute_widget'; var that = IPA.checkboxes_widget(spec); @@ -552,83 +553,6 @@ aci.attributes_widget = function(spec) { var id = spec.name; - that.create = function(container) { - that.container = container; - - var attr_container = $('
', { - 'class': 'aci-attribute-table-container' - }).appendTo(container); - - that.$node = that.table = $('', { - id: id, - name: that.name, - 'class': 'table table-bordered table-condensed aci-attribute-table scrollable' - }). - append(''). - append(''). - appendTo(attr_container); - - var tr = $('').appendTo($('thead', that.table)); - - var th = $('
').appendTo(tr); - IPA.standalone_option({ - type: "checkbox", - click: function() { - $('.aci-attribute', that.table). - prop('checked', $(this).prop('checked')); - that.value_changed.notify([], that); - that.emit('value-change', { source: that }); - } - }, th); - - tr.append($('', { - 'class': 'aci-attribute-column', - html: text.get('@i18n:objects.aci.attribute') - })); - - if (that.undo) { - that.create_undo(container); - } - - if (that.object_type) { - that.populate(that.object_type); - } - - that.create_error_link(container); - }; - - that.create_options = function(options) { - var tbody = $('tbody', that.table); - - for (var i=0; i').appendTo(tbody); - - var td = $('').appendTo(tr); - var name = that.get_input_name(); - var id = that._option_next_id + name; - var opt = IPA.standalone_option({ - id: id, - type: 'checkbox', - name: name, - value: value, - 'class': 'aci-attribute', - change: function() { - that.value_changed.notify([], that); - that.emit('value-change', { source: that }); - } - }, td); - td = $('').appendTo(tr); - td.append($('