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

View file

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

View file

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

View file

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