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

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-07-24 16:01:44 +02:00
parent b37854051d
commit 9554b5109c
8 changed files with 43 additions and 47 deletions

View File

@ -405,7 +405,7 @@ IPA.dialog = function(spec) {
that.title_node = $('<h4/>', { that.title_node = $('<h4/>', {
'class': 'modal-title', 'class': 'modal-title',
text: that.title text: that.title || ''
}).appendTo(that.header_node); }).appendTo(that.header_node);
return that.header_node; return that.header_node;

View File

@ -666,7 +666,7 @@ IPA.dnszone_name_widget = function(spec) {
IPA.force_dnszone_add_checkbox_widget = function(spec) { IPA.force_dnszone_add_checkbox_widget = function(spec) {
var metadata = IPA.get_command_option('dnszone_add', spec.name); var metadata = IPA.get_command_option('dnszone_add', spec.name);
spec.label = metadata.label; spec.label = metadata.label;
spec.tooltip = metadata.doc; spec.title = metadata.doc;
return IPA.checkbox_widget(spec); return IPA.checkbox_widget(spec);
}; };

View File

@ -1118,9 +1118,9 @@ exp.facet_header = IPA.facet_header = function(spec) {
that.update_breadcrumb(limited_value); that.update_breadcrumb(limited_value);
var title_info = { var title_info = {
title: that.facet.label, text: that.facet.label,
pkey: limited_value, pkey: limited_value,
pkey_tooltip: value pkey_title: value
}; };
that.title_widget.update(title_info); 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.create(container);
that.title_widget.update({ title: that.facet.label }); that.title_widget.update({ text: that.facet.label });
if (!that.facet.disable_facet_tabs) { if (!that.facet.disable_facet_tabs) {
that.facet_tabs = $('<div/>', { 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 * Reflect facet's action state summary into title widget class and icon
* tooltip. * title.
*/ */
that.update_summary = function() { that.update_summary = function() {
var summary = that.facet.action_state.summary(); var summary = that.facet.action_state.summary();
@ -1357,7 +1357,7 @@ exp.facet_header = IPA.facet_header = function(spec) {
if (summary.state.length > 0) { if (summary.state.length > 0) {
var css_class = summary.state.join(' '); var css_class = summary.state.join(' ');
that.title_widget.set_class(css_class); 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 {Object} data
* @param {string} data.pkey * @param {string} data.pkey
* @param {string} data.text
* @param {string} data.title * @param {string} data.title
* @param {string} data.tooltip * @param {string} data.icon_title
* @param {string} data.icon_tooltip
* @param {string} data.css_class css class for title container * @param {string} data.css_class css class for title container
*/ */
that.update = function(data) { that.update = function(data) {
var tooltip = data.tooltip || data.title; that.title.text(data.text);
var pkey_tooltip = data.pkey_tooltip || data.pkey; that.title.prop('title', data.title || '');
var icon_tooltip = data.icon_tooltip || '';
that.title.text(data.title);
that.title.prop('title', tooltip);
that.title_container.toggleClass('no-pkey', !data.pkey); that.title_container.toggleClass('no-pkey', !data.pkey);
if (data.pkey) { if (data.pkey) {
that.title.text(data.title + ': '); that.title.text(data.text + ': ');
that.pkey.text(data.pkey); 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); 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.set_icon_title = function(title) {
that.icon.attr('title', tooltip); that.icon.attr('title', title);
}; };
return that; return that;

View File

@ -112,10 +112,10 @@ field.field = IPA.field = function(spec) {
that.label = text.get(spec.label); that.label = text.get(spec.label);
/** /**
* Tooltip * Title
* @property {string} * @property {string}
*/ */
that.tooltip = text.get(spec.tooltip); that.title = text.get(spec.title);
/** /**
* Measurement unit * Measurement unit
@ -299,8 +299,8 @@ field.field = IPA.field = function(spec) {
if (!that.label) { if (!that.label) {
that.label = that.metadata.label || ''; that.label = that.metadata.label || '';
} }
if (!that.tooltip) { if (!that.title) {
that.tooltip = that.metadata.doc || ''; that.title = that.metadata.doc || '';
} }
} }

View File

@ -531,7 +531,7 @@ IPA.host_dnsrecord_entity_link_widget = function(spec) {
IPA.force_host_add_checkbox_widget = function(spec) { IPA.force_host_add_checkbox_widget = function(spec) {
var metadata = IPA.get_command_option('host_add', spec.name); var metadata = IPA.get_command_option('host_add', spec.name);
spec.label = metadata.label; spec.label = metadata.label;
spec.tooltip = metadata.doc; spec.title = metadata.doc;
return IPA.checkbox_widget(spec); return IPA.checkbox_widget(spec);
}; };

View File

@ -56,27 +56,27 @@ return {
{ {
name: 'ipabaseid', name: 'ipabaseid',
label: '@i18n:objects.idrange.ipabaseid', label: '@i18n:objects.idrange.ipabaseid',
tooltip: '@mo-param:idrange:ipabaseid:label' title: '@mo-param:idrange:ipabaseid:label'
}, },
{ {
name: 'ipaidrangesize', name: 'ipaidrangesize',
label: '@i18n:objects.idrange.ipaidrangesize', label: '@i18n:objects.idrange.ipaidrangesize',
tooltip: '@mo-param:idrange:ipaidrangesize:label' title: '@mo-param:idrange:ipaidrangesize:label'
}, },
{ {
name: 'ipabaserid', name: 'ipabaserid',
label: '@i18n:objects.idrange.ipabaserid', label: '@i18n:objects.idrange.ipabaserid',
tooltip: '@mo-param:idrange:ipabaserid:label' title: '@mo-param:idrange:ipabaserid:label'
}, },
{ {
name: 'ipasecondarybaserid', name: 'ipasecondarybaserid',
label: '@i18n:objects.idrange.ipasecondarybaserid', label: '@i18n:objects.idrange.ipasecondarybaserid',
tooltip: '@mo-param:idrange:ipasecondarybaserid:label' title: '@mo-param:idrange:ipasecondarybaserid:label'
}, },
{ {
name: 'ipanttrusteddomainsid', name: 'ipanttrusteddomainsid',
label: '@i18n:objects.idrange.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', name: 'ipabaseid',
label: '@i18n:objects.idrange.ipabaseid', label: '@i18n:objects.idrange.ipabaseid',
tooltip: '@mo-param:idrange:ipabaseid:label' title: '@mo-param:idrange:ipabaseid:label'
}, },
{ {
name: 'ipaidrangesize', name: 'ipaidrangesize',
label: '@i18n:objects.idrange.ipaidrangesize', label: '@i18n:objects.idrange.ipaidrangesize',
tooltip: '@mo-param:idrange:ipaidrangesize:label' title: '@mo-param:idrange:ipaidrangesize:label'
}, },
{ {
name: 'ipabaserid', name: 'ipabaserid',
label: '@i18n:objects.idrange.ipabaserid', label: '@i18n:objects.idrange.ipabaserid',
tooltip: '@mo-param:idrange:ipabaserid:label' title: '@mo-param:idrange:ipabaserid:label'
}, },
{ {
name: 'iparangetype', name: 'iparangetype',
@ -135,12 +135,12 @@ return {
{ {
name: 'ipasecondarybaserid', name: 'ipasecondarybaserid',
label: '@i18n:objects.idrange.ipasecondarybaserid', label: '@i18n:objects.idrange.ipasecondarybaserid',
tooltip: '@mo-param:idrange:ipasecondarybaserid:label' title: '@mo-param:idrange:ipasecondarybaserid:label'
}, },
{ {
name: 'ipanttrusteddomainsid', name: 'ipanttrusteddomainsid',
label: '@i18n:objects.idrange.ipanttrusteddomainsid', label: '@i18n:objects.idrange.ipanttrusteddomainsid',
tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label', title: '@mo-param:idrange:ipanttrusteddomainsid:label',
enabled: false enabled: false
} }
], ],

View File

@ -48,7 +48,7 @@ var MenuItem = {
label: '', label: '',
/** /**
* Title/Tooltip * Title
*/ */
title: '', title: '',

View File

@ -102,10 +102,10 @@ IPA.widget = function(spec) {
that.label = text.get(spec.label); that.label = text.get(spec.label);
/** /**
* Helper text * Title text
* @property {string} * @property {string}
*/ */
that.tooltip = text.get(spec.tooltip); that.title = text.get(spec.title);
/** /**
* Measurement unit * Measurement unit
@ -732,7 +732,7 @@ IPA.text_widget = function(spec) {
id: id, id: id,
'class': 'form-control', 'class': 'form-control',
size: that.size, size: that.size,
title: that.tooltip, title: that.title,
placeholder: that.placeholder, placeholder: that.placeholder,
keyup: function() { keyup: function() {
that.on_value_changed(); that.on_value_changed();
@ -1313,7 +1313,7 @@ IPA.option_widget_base = function(spec, that) {
// classic properties // classic properties
that.name = spec.name; that.name = spec.name;
that.label = spec.label; that.label = spec.label;
that.tooltip = spec.tooltip; that.title = spec.title;
that.sort = spec.sort === undefined ? false : spec.sort; that.sort = spec.sort === undefined ? false : spec.sort;
that.value_changed = that.value_changed || IPA.observer(); that.value_changed = that.value_changed || IPA.observer();
@ -1488,12 +1488,12 @@ IPA.option_widget_base = function(spec, that) {
name: input_name, name: input_name,
disabled: !enabled, disabled: !enabled,
value: option.value, value: option.value,
title: option.tooltip || that.tooltip, title: option.title || that.title || '',
change: that.on_input_change change: that.on_input_change
}, opt_cont); }, opt_cont);
option.label_node = construct.create('label', { option.label_node = construct.create('label', {
title: option.tooltip || that.tooltip, title: option.title || that.title || '',
'for': id 'for': id
}, opt_cont); }, opt_cont);
option.label_node.textContent = option.label || ''; option.label_node.textContent = option.label || '';
@ -2093,7 +2093,7 @@ IPA.textarea_widget = function (spec) {
cols: that.cols, cols: that.cols,
'class': 'form-control', 'class': 'form-control',
readOnly: !!that.read_only, readOnly: !!that.read_only,
title: that.tooltip, title: that.title || '',
placeholder: that.placeholder, placeholder: that.placeholder,
keyup: function() { keyup: function() {
that.on_value_changed(); that.on_value_changed();
@ -3485,7 +3485,7 @@ IPA.combobox_widget = function(spec) {
name: that.name, name: that.name,
'class': 'form-control', 'class': 'form-control',
id: id, id: id,
title: that.tooltip, title: that.title,
keydown: that.on_input_keydown, keydown: that.on_input_keydown,
mousedown: that.on_no_close, mousedown: that.on_no_close,
click: function() { click: function() {
@ -4251,7 +4251,7 @@ IPA.button_widget = function(spec) {
that.button = IPA.button({ that.button = IPA.button({
id: that.id, id: that.id,
name: that.name, name: that.name,
title: that.tooltip, title: that.title,
label: that.label, label: that.label,
'class': that['class'], 'class': that['class'],
button_class: that.button_class, button_class: that.button_class,