small fixes

This commit is contained in:
Mojca Lorber 2017-06-19 15:30:38 +02:00
parent a195c9a5af
commit 39dd6daabb
4 changed files with 5 additions and 7 deletions

View file

@ -117,6 +117,7 @@ function dataTableInit() {
rowsSelected.length +
' entries selected)');
initRowSelection();
initHeaderTooltip();
},
preDrawCallback: function() {
animateSpinner(this);
@ -359,7 +360,7 @@ function initHeaderTooltip() {
// set tooltip params in the table body
if ( $(this).parents('#repository-table').length ) {
offsetLeft -= 130;
offsetLeft = $('#repository-table').offset().left + 100;
width = $('#repository-table').width() - 200;
}
$('body').append($tooltip);
@ -375,6 +376,7 @@ function initHeaderTooltip() {
$tooltip.css('visibility', 'visible');
$tooltip.css('width', width + 'px');
$tooltip.css('word-wrap', 'break-word');
$tooltip.css('z-index', '4');
$(this).data('dropdown-tooltip', $tooltip);
}, function() {
$(this).append($(this).data('dropdown-tooltip'));
@ -438,14 +440,12 @@ function onClickAddRecord() {
viewAssigned = 'assigned';
table.ajax.reload(function() {
initRowSelection();
initHeaderTooltip();
}, false);
});
$('#all-repo-records').on('click', function() {
viewAssigned = 'all';
table.ajax.reload(function() {
initRowSelection();
initHeaderTooltip();
}, false);
});
})();

View file

@ -120,7 +120,7 @@ class RepositoryDatatable < AjaxDatatablesRails::Base
row[@columns_mappings[cell.repository_column.id]] =
custom_auto_link(
display_tooltip(cell.value.data,
Constants::TABLE_FIELDS_TRUNCATION_LENGTH),
Constants::NAME_MAX_LENGTH),
simple_format: true,
team: @team
)

View file

@ -17,7 +17,7 @@ module ApplicationHelper
end
def display_tooltip(message, len = Constants::NAME_TRUNCATION_LENGTH)
if message.strip.length > Constants::NAME_TRUNCATION_LENGTH
if message.strip.length > len
sanitize_input("<div class='modal-tooltip'> \
#{truncate(message.strip, length: len)} \
<span class='modal-tooltiptext'> \

View file

@ -11,8 +11,6 @@ class Constants
NAME_TRUNCATION_LENGTH = 25
# Max characters for short text fields, in dropdownList
NAME_TRUNCATION_LENGTH_DROPDOWN = 20
# Max characters for datatables fields
TABLE_FIELDS_TRUNCATION_LENGTH = 250
# Max characters for long text fields
TEXT_MAX_LENGTH = 10000
# Max characters for rich text fields (in html format)