[PATCH] 733 webui: rename tooltip to title - use title for input's elements 'title' attribute - tooltip for Bootstrap's tooltip component
https://fedorahosted.org/freeipa/ticket/4471 [PATCH] 734 webui: tooltip support Allow to set 'tooltip' attribute in spec. It displays info icon with Bootstrap's tooltip near field's label. https://fedorahosted.org/freeipa/ticket/4471 [PATCH] 735 webui: better authentication types description Tooltips were added to "User authentication types" and "Default user objectclasses" to describe their relationship and a meaning of not-setting a value. https://fedorahosted.org/freeipa/ticket/4471 -- Petr Vobornik
From fa44465303b0fe70ef3da3c6e8f8109cbda288bb Mon Sep 17 00:00:00 2001 From: Petr Vobornik <pvobo...@redhat.com> Date: Thu, 24 Jul 2014 15:33:04 +0200 Subject: [PATCH] webui: better authentication types description Tooltips were added to "User authentication types" and "Default user objectclasses" to describe their relationship and a meaning of not-setting a value. https://fedorahosted.org/freeipa/ticket/4471 --- install/ui/src/freeipa/serverconfig.js | 7 ++++++- install/ui/src/freeipa/user.js | 7 ++++++- install/ui/test/data/ipa_init.json | 7 +++++++ ipalib/plugins/internal.py | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/serverconfig.js b/install/ui/src/freeipa/serverconfig.js index 89c89eda95f84d1c569b83e9a25b864e7b2f7215..d134c88824533ce83f8b0dc11ca3a059601b6f7d 100644 --- a/install/ui/src/freeipa/serverconfig.js +++ b/install/ui/src/freeipa/serverconfig.js @@ -77,7 +77,12 @@ return { $type: 'checkboxes', name: 'ipauserauthtype', flags: ['w_if_no_aci'], - options: ['password', 'radius', 'otp'] + options: [ + { label: '@i18n:authtype.type_password', value: 'password' }, + { label: '@i18n:authtype.type_radius', value: 'radius' }, + { label: '@i18n:authtype.type_otp', value: 'otp' } + ], + tooltip: '@i18n:authtype.config_tooltip' }, { $type: 'checkbox', diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 337405050d14436f3c0526bb2970b471935fffd4..b595d06678edc3709103647a148db09c66e4b88c 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -153,7 +153,12 @@ return { $type: 'checkboxes', name: 'ipauserauthtype', flags: ['w_if_no_aci'], - options: ['password', 'radius', 'otp'] + options: [ + { label: '@i18n:authtype.type_password', value: 'password' }, + { label: '@i18n:authtype.type_radius', value: 'radius' }, + { label: '@i18n:authtype.type_otp', value: 'otp' } + ], + tooltip: '@i18n:authtype.user_tooltip' } ] }, diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 8a482134d70976ecfe4748dd102351a64dbd4dd6..987f1270a46206b3ec882d40def59ee0e517b48b 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -48,6 +48,13 @@ "removed": "${count} item(s) removed", "show_results": "Show Results" }, + "authtype": { + "config_tooltip": "Implicit method (password) will be used if no method is chosen.", + "type_otp": "Two factor authentication (password + OTP)", + "type_password": "Password", + "type_radius": "Radius", + "user_tooltip": "Per-user setting, overwrites the global setting if any option is checked." + }, "buttons": { "about": "About", "add": "Add", diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index 1a8d9cad3427ee75e7774f67c2b4c08eaba8479e..15315de17a2959db581be0bfa0b0860445255e01 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -190,6 +190,13 @@ class i18n_messages(Command): "removed": _("${count} item(s) removed"), "show_results": _("Show Results"), }, + "authtype": { + "config_tooltip": _("Implicit method (password) will be used if no method is chosen."), + "type_otp": _("Two factor authentication (password + OTP)"), + "type_password": _("Password"), + "type_radius": _("Radius"), + "user_tooltip": _("Per-user setting, overwrites the global setting if any option is checked."), + }, "buttons": { "about": _("About"), "add": _("Add"), -- 1.9.3
From 3d1f6057e76a8e6083ce83dcb5950af84fd6608c Mon Sep 17 00:00:00 2001 From: Petr Vobornik <pvobo...@redhat.com> Date: Thu, 24 Jul 2014 15:30:03 +0200 Subject: [PATCH] webui: tooltip support Allow to set 'tooltip' attribute in spec. It displays info icon with Bootstrap's tooltip near field's label. https://fedorahosted.org/freeipa/ticket/4471 --- install/ui/src/freeipa/widget.js | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 8324a879519cfe0d933b85c9a6a6eb909fe14a09..7b1f1404189bdb2103e9535bcfcdc4f51d99a5ac 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -85,6 +85,18 @@ IPA.widget = function(spec) { var that = new Evented(); /** + * Normalize tooltip + * @protected + */ + that._normalize_tooltip = function(tt_spec) { + var tt = typeof tt_spec === 'string' ? { title: tt_spec } : tt_spec; + if (tt) { + tt.title = text.get(tt.title); + } + return tt; + }; + + /** * Widget name. Should be container unique. */ that.name = spec.name; @@ -114,6 +126,27 @@ IPA.widget = function(spec) { that.measurement_unit = spec.measurement_unit; /** + * Tooltip text + * + * ''' + * var tooltip = { + * title: 'Helper text', + * placement: 'right' + * // possible placements: left, top, bottom, right + * }; + * + * // or just string, it will be normalized later: + * tooltip = "Helper text"; + * + * ''' + * + * Check Bootstrap documentation for more tooltip options. + * + * @property {Object|string} + */ + that.tooltip = that._normalize_tooltip(spec.tooltip); + + /** * Parent entity * @deprecated * @property {IPA.entity} @@ -4409,6 +4442,19 @@ IPA.layout = function(spec) { return ''; }; + that.create_tooltip_icon = function(widget) { + + if (!widget.tooltip) return null; + + var el = $('<span/>', { + 'data-toggle': 'tooltip' + }).append($('<i/>', { + 'class': 'fa fa-info-circle' + })); + $(el).tooltip(widget.tooltip); + return el; + }; + return that; }; @@ -4546,6 +4592,8 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) { 'class': '', text: label_text }).appendTo(label_cont); + var tooltip = that.create_tooltip_icon(widget); + if (tooltip) label_el.append(' ').append(tooltip); var input = widget.get_input && widget.get_input(); -- 1.9.3
From 02fb6995f1e5af664c83fd0d5fdb9ea25df7035a Mon Sep 17 00:00:00 2001 From: Petr Vobornik <pvobo...@redhat.com> Date: Thu, 24 Jul 2014 16:01:44 +0200 Subject: [PATCH] webui: rename tooltip to title - use title for input's elements 'title' attribute - tooltip for Bootstrap's tooltip component https://fedorahosted.org/freeipa/ticket/4471 --- install/ui/src/freeipa/dialog.js | 2 +- install/ui/src/freeipa/dns.js | 2 +- install/ui/src/freeipa/facet.js | 36 ++++++++++++--------------- install/ui/src/freeipa/field.js | 8 +++--- install/ui/src/freeipa/host.js | 2 +- install/ui/src/freeipa/idrange.js | 20 +++++++-------- install/ui/src/freeipa/navigation/MenuItem.js | 2 +- install/ui/src/freeipa/widget.js | 18 +++++++------- 8 files changed, 43 insertions(+), 47 deletions(-) diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index 22bda3e99fa1b43cbae9f85bcec00a905f773cac..f430e5604e0d0b58e48db3be026208322eb32d56 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -405,7 +405,7 @@ IPA.dialog = function(spec) { that.title_node = $('<h4/>', { 'class': 'modal-title', - text: that.title + text: that.title || '' }).appendTo(that.header_node); return that.header_node; diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js index ae6a5986ef1fb0d8d51e2a276b99f71db4c7dc77..c5e7b24d8dd567ef66b401538160fc19add110d4 100644 --- a/install/ui/src/freeipa/dns.js +++ b/install/ui/src/freeipa/dns.js @@ -666,7 +666,7 @@ IPA.dnszone_name_widget = function(spec) { IPA.force_dnszone_add_checkbox_widget = function(spec) { var metadata = IPA.get_command_option('dnszone_add', spec.name); spec.label = metadata.label; - spec.tooltip = metadata.doc; + spec.title = metadata.doc; return IPA.checkbox_widget(spec); }; diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index 50c12d49c4716e2e8d799663b79e04fdeb4d3d86..594f9af5c1c7092bc2cd13485db45e204bc4fe65 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -1118,9 +1118,9 @@ exp.facet_header = IPA.facet_header = function(spec) { that.update_breadcrumb(limited_value); var title_info = { - title: that.facet.label, + text: that.facet.label, pkey: limited_value, - pkey_tooltip: value + pkey_title: value }; that.title_widget.update(title_info); }; @@ -1277,7 +1277,7 @@ exp.facet_header = IPA.facet_header = function(spec) { } that.title_widget.create(container); - that.title_widget.update({ title: that.facet.label }); + that.title_widget.update({ text: that.facet.label }); if (!that.facet.disable_facet_tabs) { that.facet_tabs = $('<div/>', { @@ -1349,7 +1349,7 @@ exp.facet_header = IPA.facet_header = function(spec) { /** * Reflect facet's action state summary into title widget class and icon - * tooltip. + * title. */ that.update_summary = function() { var summary = that.facet.action_state.summary(); @@ -1357,7 +1357,7 @@ exp.facet_header = IPA.facet_header = function(spec) { if (summary.state.length > 0) { var css_class = summary.state.join(' '); that.title_widget.set_class(css_class); - that.title_widget.set_icon_tooltip(summary.description); + that.title_widget.set_icon_title(summary.description); } }; @@ -1409,30 +1409,26 @@ exp.facet_title = IPA.facet_title = function(spec) { * * @param {Object} data * @param {string} data.pkey + * @param {string} data.text * @param {string} data.title - * @param {string} data.tooltip - * @param {string} data.icon_tooltip + * @param {string} data.icon_title * @param {string} data.css_class css class for title container */ that.update = function(data) { - var tooltip = data.tooltip || data.title; - var pkey_tooltip = data.pkey_tooltip || data.pkey; - var icon_tooltip = data.icon_tooltip || ''; - - that.title.text(data.title); - that.title.prop('title', tooltip); + that.title.text(data.text); + that.title.prop('title', data.title || ''); that.title_container.toggleClass('no-pkey', !data.pkey); if (data.pkey) { - that.title.text(data.title + ': '); + that.title.text(data.text + ': '); that.pkey.text(data.pkey); - that.pkey.attr('title', pkey_tooltip); + that.pkey.attr('title', data.pkey_title || data.pkey); } if (data.css_class) that.set_class(data.css_class); - that.set_icon_tooltip(icon_tooltip); + that.set_icon_title(data.icon_title || ''); }; /** @@ -1487,12 +1483,12 @@ exp.facet_title = IPA.facet_title = function(spec) { }; /** - * Set icon tooltip + * Set icon title * - * @param {string} tooltip + * @param {string} title */ - that.set_icon_tooltip = function(tooltip) { - that.icon.attr('title', tooltip); + that.set_icon_title = function(title) { + that.icon.attr('title', title); }; return that; diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index 5905bbab601565d401e847de454ef86b0cd3ab97..ea22d6d061fe31ee1737ec385a959984a8249c21 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -112,10 +112,10 @@ field.field = IPA.field = function(spec) { that.label = text.get(spec.label); /** - * Tooltip + * Title * @property {string} */ - that.tooltip = text.get(spec.tooltip); + that.title = text.get(spec.title); /** * Measurement unit @@ -299,8 +299,8 @@ field.field = IPA.field = function(spec) { if (!that.label) { that.label = that.metadata.label || ''; } - if (!that.tooltip) { - that.tooltip = that.metadata.doc || ''; + if (!that.title) { + that.title = that.metadata.doc || ''; } } diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 0740a3b49ad7ec9384dd3e879f2195278dbdb700..4ccebe4c33c772319da500d2b7980e5b8f7d950c 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -531,7 +531,7 @@ IPA.host_dnsrecord_entity_link_widget = function(spec) { IPA.force_host_add_checkbox_widget = function(spec) { var metadata = IPA.get_command_option('host_add', spec.name); spec.label = metadata.label; - spec.tooltip = metadata.doc; + spec.title = metadata.doc; return IPA.checkbox_widget(spec); }; diff --git a/install/ui/src/freeipa/idrange.js b/install/ui/src/freeipa/idrange.js index c7dc5c6832a484060a18197ba567cfd0f7e6b42c..a2c182fdba5879f6b3fbfba61c162d694cd1f2ec 100644 --- a/install/ui/src/freeipa/idrange.js +++ b/install/ui/src/freeipa/idrange.js @@ -56,27 +56,27 @@ return { { name: 'ipabaseid', label: '@i18n:objects.idrange.ipabaseid', - tooltip: '@mo-param:idrange:ipabaseid:label' + title: '@mo-param:idrange:ipabaseid:label' }, { name: 'ipaidrangesize', label: '@i18n:objects.idrange.ipaidrangesize', - tooltip: '@mo-param:idrange:ipaidrangesize:label' + title: '@mo-param:idrange:ipaidrangesize:label' }, { name: 'ipabaserid', label: '@i18n:objects.idrange.ipabaserid', - tooltip: '@mo-param:idrange:ipabaserid:label' + title: '@mo-param:idrange:ipabaserid:label' }, { name: 'ipasecondarybaserid', label: '@i18n:objects.idrange.ipasecondarybaserid', - tooltip: '@mo-param:idrange:ipasecondarybaserid:label' + title: '@mo-param:idrange:ipasecondarybaserid:label' }, { name: 'ipanttrusteddomainsid', label: '@i18n:objects.idrange.ipanttrusteddomainsid', - tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label' + title: '@mo-param:idrange:ipanttrusteddomainsid:label' } ] } @@ -91,17 +91,17 @@ return { { name: 'ipabaseid', label: '@i18n:objects.idrange.ipabaseid', - tooltip: '@mo-param:idrange:ipabaseid:label' + title: '@mo-param:idrange:ipabaseid:label' }, { name: 'ipaidrangesize', label: '@i18n:objects.idrange.ipaidrangesize', - tooltip: '@mo-param:idrange:ipaidrangesize:label' + title: '@mo-param:idrange:ipaidrangesize:label' }, { name: 'ipabaserid', label: '@i18n:objects.idrange.ipabaserid', - tooltip: '@mo-param:idrange:ipabaserid:label' + title: '@mo-param:idrange:ipabaserid:label' }, { name: 'iparangetype', @@ -135,12 +135,12 @@ return { { name: 'ipasecondarybaserid', label: '@i18n:objects.idrange.ipasecondarybaserid', - tooltip: '@mo-param:idrange:ipasecondarybaserid:label' + title: '@mo-param:idrange:ipasecondarybaserid:label' }, { name: 'ipanttrusteddomainsid', label: '@i18n:objects.idrange.ipanttrusteddomainsid', - tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label', + title: '@mo-param:idrange:ipanttrusteddomainsid:label', enabled: false } ], diff --git a/install/ui/src/freeipa/navigation/MenuItem.js b/install/ui/src/freeipa/navigation/MenuItem.js index 1b2358cf69344748eca8dacdd60f804a64bfae73..8534d2ec2066b47ca691383d460f106ab4a9010d 100644 --- a/install/ui/src/freeipa/navigation/MenuItem.js +++ b/install/ui/src/freeipa/navigation/MenuItem.js @@ -48,7 +48,7 @@ var MenuItem = { label: '', /** - * Title/Tooltip + * Title */ title: '', diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index da901d9e9762375fe2c901a8046f5a36be0de79b..8324a879519cfe0d933b85c9a6a6eb909fe14a09 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -102,10 +102,10 @@ IPA.widget = function(spec) { that.label = text.get(spec.label); /** - * Helper text + * Title text * @property {string} */ - that.tooltip = text.get(spec.tooltip); + that.title = text.get(spec.title); /** * Measurement unit @@ -732,7 +732,7 @@ IPA.text_widget = function(spec) { id: id, 'class': 'form-control', size: that.size, - title: that.tooltip, + title: that.title, placeholder: that.placeholder, keyup: function() { that.on_value_changed(); @@ -1313,7 +1313,7 @@ IPA.option_widget_base = function(spec, that) { // classic properties that.name = spec.name; that.label = spec.label; - that.tooltip = spec.tooltip; + that.title = spec.title; that.sort = spec.sort === undefined ? false : spec.sort; that.value_changed = that.value_changed || IPA.observer(); @@ -1488,12 +1488,12 @@ IPA.option_widget_base = function(spec, that) { name: input_name, disabled: !enabled, value: option.value, - title: option.tooltip || that.tooltip, + title: option.title || that.title || '', change: that.on_input_change }, opt_cont); option.label_node = construct.create('label', { - title: option.tooltip || that.tooltip, + title: option.title || that.title || '', 'for': id }, opt_cont); option.label_node.textContent = option.label || ''; @@ -2093,7 +2093,7 @@ IPA.textarea_widget = function (spec) { cols: that.cols, 'class': 'form-control', readOnly: !!that.read_only, - title: that.tooltip, + title: that.title || '', placeholder: that.placeholder, keyup: function() { that.on_value_changed(); @@ -3485,7 +3485,7 @@ IPA.combobox_widget = function(spec) { name: that.name, 'class': 'form-control', id: id, - title: that.tooltip, + title: that.title, keydown: that.on_input_keydown, mousedown: that.on_no_close, click: function() { @@ -4251,7 +4251,7 @@ IPA.button_widget = function(spec) { that.button = IPA.button({ id: that.id, name: that.name, - title: that.tooltip, + title: that.title, label: that.label, 'class': that['class'], button_class: that.button_class, -- 1.9.3
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel