Patch #41827 » 0003_add_automatic_tooltips_to_column_selects.patch
app/assets/javascripts/application.js | ||
---|---|---|
110 | 110 |
|
111 | 111 |
// columns selection |
112 | 112 |
function moveOptions(theSelFrom, theSelTo) { |
113 |
$(theSelFrom).find('option:selected').detach().prop("selected", false).appendTo($(theSelTo)); |
|
113 |
$(theSelFrom).find('option:selected').detach().prop("selected", false).appendTo($(theSelTo)). |
|
114 |
filter('[title]').tooltip("close"); |
|
114 | 115 |
} |
115 | 116 |
|
116 | 117 |
function moveOptionUp(theSel) { |
... | ... | |
1139 | 1140 |
}); |
1140 | 1141 |
} |
1141 | 1142 |
|
1142 |
$(function () { |
|
1143 |
function initTooltips() { |
|
1144 |
$(".js-overflow-to-tooltip").each(function () { |
|
1145 |
const currentTitle = this.getAttribute('title'); |
|
1146 |
if ((this.scrollWidth > this.clientWidth || |
|
1147 |
this.scrollHeight > this.clientHeight) && |
|
1148 |
!currentTitle) { |
|
1149 |
this.setAttribute('title', this.textContent); |
|
1150 |
} |
|
1151 |
}); |
|
1152 |
|
|
1143 | 1153 |
$("[title]:not(.no-tooltip)").tooltip({ |
1144 | 1154 |
show: { |
1145 | 1155 |
delay: 400 |
... | ... | |
1149 | 1159 |
at: "center top" |
1150 | 1160 |
} |
1151 | 1161 |
}); |
1152 |
}); |
|
1162 |
} |
|
1163 |
|
|
1164 |
$(initTooltips); |
|
1153 | 1165 |
|
1154 | 1166 |
function inlineAutoComplete(element) { |
1155 | 1167 |
'use strict'; |
app/helpers/queries_helper.rb | ||
---|---|---|
129 | 129 |
|
130 | 130 |
def query_available_inline_columns_options(query) |
131 | 131 |
(query.available_inline_columns - query.columns). |
132 |
reject(&:frozen?).collect {|column| [column.caption, column.name]}
|
|
132 |
reject(&:frozen?).collect {|column| column_select_option(column)}
|
|
133 | 133 |
end |
134 | 134 |
|
135 | 135 |
def query_selected_inline_columns_options(query) |
136 | 136 |
(query.inline_columns & query.available_inline_columns). |
137 |
reject(&:frozen?).collect {|column| [column.caption, column.name]} |
|
137 |
reject(&:frozen?).collect {|column| column_select_option(column)} |
|
138 |
end |
|
139 |
|
|
140 |
def column_select_option(column) |
|
141 |
[column.caption, column.name, {class: 'js-overflow-to-tooltip'}] |
|
138 | 142 |
end |
139 | 143 |
|
140 | 144 |
def render_query_columns_selection(query, options={}) |
app/views/my/blocks/_issues.erb | ||
---|---|---|
1 | 1 |
<div class="contextual"> |
2 |
<%= link_to_function sprite_icon('settings', l(:label_options)), "$('##{block}-settings').toggle();", :class => 'icon-only icon-settings', :title => l(:label_options) %> |
|
2 |
<%= link_to_function sprite_icon('settings', l(:label_options)), "$('##{block}-settings').toggle(); initTooltips();", :class => 'icon-only icon-settings', :title => l(:label_options) %>
|
|
3 | 3 |
</div> |
4 | 4 |
|
5 | 5 |
<h3> |
app/views/queries/_query_form.html.erb | ||
---|---|---|
16 | 16 |
|
17 | 17 |
<% if @query.available_columns.any? %> |
18 | 18 |
<fieldset id="options" class="collapsible collapsed"> |
19 |
<legend onclick="toggleFieldset(this);" class="icon icon-collapsed"> |
|
19 |
<legend onclick="toggleFieldset(this); initTooltips();" class="icon icon-collapsed">
|
|
20 | 20 |
<%= sprite_icon("angle-right") %> |
21 | 21 |
<%= l(:label_options) %> |
22 | 22 |
</legend> |
... | ... | |
84 | 84 |
$('input[name=display_type]').change(function (e) { |
85 | 85 |
if ($("#display_type_list").is(':checked')) { |
86 | 86 |
$('table#list-definition').show(); |
87 |
initTooltips(); |
|
87 | 88 |
} else { |
88 | 89 |
$('table#list-definition').hide(); |
89 | 90 |
} |
90 |
- |