mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 21:36:44 +08:00
adds tooltip to samples dropdown and column names
This commit is contained in:
parent
2426539715
commit
1ff98bb6df
4 changed files with 37 additions and 8 deletions
|
@ -841,7 +841,6 @@ function changeToEditMode() {
|
||||||
'</span>');
|
'</span>');
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
debugger;
|
|
||||||
var form = $('#new-column-form');
|
var form = $('#new-column-form');
|
||||||
form.find('.help-block').remove();
|
form.find('.help-block').remove();
|
||||||
if (form.hasClass('has-error')) {
|
if (form.hasClass('has-error')) {
|
||||||
|
@ -858,8 +857,7 @@ function changeToEditMode() {
|
||||||
'data-editable data-deletable ' +
|
'data-editable data-deletable ' +
|
||||||
'data-edit-url="' + data.edit_url + '" ' +
|
'data-edit-url="' + data.edit_url + '" ' +
|
||||||
'data-destroy-html-url="' + data.destroy_html_url + '"' +
|
'data-destroy-html-url="' + data.destroy_html_url + '"' +
|
||||||
'>' + truncateLongString(data.name,
|
'>' + generateColumnNameTooltip(data.name) + '</th>');
|
||||||
<%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>) + '</th>');
|
|
||||||
var colOrder = table.colReorder.order();
|
var colOrder = table.colReorder.order();
|
||||||
colOrder.push(colOrder.length);
|
colOrder.push(colOrder.length);
|
||||||
// Remove all event handlers as we re-initialize them later with
|
// Remove all event handlers as we re-initialize them later with
|
||||||
|
@ -874,6 +872,7 @@ function changeToEditMode() {
|
||||||
table = dataTableInit();
|
table = dataTableInit();
|
||||||
table.on('init.dt', function() {
|
table.on('init.dt', function() {
|
||||||
loadColumnsNames();
|
loadColumnsNames();
|
||||||
|
dropdownOverflow();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
url: url
|
url: url
|
||||||
|
@ -937,8 +936,7 @@ function changeToEditMode() {
|
||||||
'class="' + visLi + '"' +
|
'class="' + visLi + '"' +
|
||||||
'>' +
|
'>' +
|
||||||
'<i class="grippy"></i> ' +
|
'<i class="grippy"></i> ' +
|
||||||
'<span class="text">' + truncateLongString(el.innerText,
|
'<span class="text">' + generateColumnNameTooltip(el.innerText) + '</span> ' +
|
||||||
<%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>) + '</span> ' +
|
|
||||||
'<input type="text" class="text-edit form-control" style="display: none;" />' +
|
'<input type="text" class="text-edit form-control" style="display: none;" />' +
|
||||||
'<span class="pull-right controls">' +
|
'<span class="pull-right controls">' +
|
||||||
'<span class="ok glyphicon glyphicon-ok" style="display: none;"></span>' +
|
'<span class="ok glyphicon glyphicon-ok" style="display: none;"></span>' +
|
||||||
|
@ -1034,8 +1032,7 @@ function changeToEditMode() {
|
||||||
data: {custom_field: {name: newName}},
|
data: {custom_field: {name: newName}},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function() {
|
success: function() {
|
||||||
text.text(truncateLongString(newName,
|
text.text(generateColumnNameTooltip(newName));
|
||||||
<%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>));
|
|
||||||
$(table.columns().header()).filter('#' + id).text(newName);
|
$(table.columns().header()).filter('#' + id).text(newName);
|
||||||
cancelEditMode();
|
cancelEditMode();
|
||||||
},
|
},
|
||||||
|
@ -1208,6 +1205,18 @@ function changeToEditMode() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateColumnNameTooltip(name) {
|
||||||
|
if( $.trim(name).length >
|
||||||
|
<%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>) {
|
||||||
|
return '<div class="modal-tooltip">' +
|
||||||
|
truncateLongString(name,
|
||||||
|
<%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>) +
|
||||||
|
'<span class="modal-tooltiptext">' + name + '</span></div>';
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// initialze dropdown after the table is loaded
|
// initialze dropdown after the table is loaded
|
||||||
function initDropdown() {
|
function initDropdown() {
|
||||||
table.on('init.dt', function() {
|
table.on('init.dt', function() {
|
||||||
|
|
|
@ -1453,6 +1453,7 @@ html.turbolinks-progress-bar::before {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
|
word-wrap: break-word;
|
||||||
z-index: $infinity;
|
z-index: $infinity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1600,6 +1601,11 @@ textarea.textarea-sm {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
|
||||||
|
.modal-tooltiptext {
|
||||||
|
margin-left: 0;
|
||||||
|
z-index: 99999999;
|
||||||
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
background: $color-white;
|
background: $color-white;
|
||||||
border: 1px solid $color-alto;
|
border: 1px solid $color-alto;
|
||||||
|
@ -1690,3 +1696,8 @@ textarea.textarea-sm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th.custom-field .modal-tooltiptext {
|
||||||
|
margin-left: 0;
|
||||||
|
z-index: 99999999;
|
||||||
|
}
|
||||||
|
|
|
@ -11,4 +11,13 @@ module ApplicationHelper
|
||||||
controller_name == 'projects' ||
|
controller_name == 'projects' ||
|
||||||
(controller_name == 'reports' && action_name == 'index')
|
(controller_name == 'reports' && action_name == 'index')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def display_tooltip(message, len = Constants::NAME_TRUNCATION_LENGTH)
|
||||||
|
if message.strip.length > Constants::NAME_TRUNCATION_LENGTH
|
||||||
|
"<div class='modal-tooltip'>#{truncate(message.strip, length: len)} \
|
||||||
|
<span class='modal-tooltiptext'>#{message.strip}</span></div>".html_safe
|
||||||
|
else
|
||||||
|
truncate(message.strip, length: len)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
<%= "data-edit-url='#{organization_custom_field_path(@organization, cf)}'" %>
|
<%= "data-edit-url='#{organization_custom_field_path(@organization, cf)}'" %>
|
||||||
<%= "data-destroy-html-url='#{organization_custom_field_destroy_html_path(@organization, cf)}'" %>
|
<%= "data-destroy-html-url='#{organization_custom_field_destroy_html_path(@organization, cf)}'" %>
|
||||||
>
|
>
|
||||||
<%= cf.name %>
|
<%= display_tooltip(cf.name) %>
|
||||||
</th>
|
</th>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Reference in a new issue