' +
'' +
@@ -1034,8 +1032,7 @@ function changeToEditMode() {
data: {custom_field: {name: newName}},
dataType: 'json',
success: function() {
- text.text(truncateLongString(newName,
- <%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>));
+ text.text(generateColumnNameTooltip(newName));
$(table.columns().header()).filter('#' + id).text(newName);
cancelEditMode();
},
@@ -1208,6 +1205,18 @@ function changeToEditMode() {
}
}
+ function generateColumnNameTooltip(name) {
+ if( $.trim(name).length >
+ <%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>) {
+ return '' +
+ truncateLongString(name,
+ <%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>) +
+ '' + name + '
';
+ } else {
+ return name;
+ }
+ }
+
// initialze dropdown after the table is loaded
function initDropdown() {
table.on('init.dt', function() {
diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss
index 873bda0c4..14f31805e 100644
--- a/app/assets/stylesheets/themes/scinote.scss
+++ b/app/assets/stylesheets/themes/scinote.scss
@@ -1453,6 +1453,7 @@ html.turbolinks-progress-bar::before {
text-align: center;
visibility: hidden;
width: 200px;
+ word-wrap: break-word;
z-index: $infinity;
}
}
@@ -1600,6 +1601,11 @@ textarea.textarea-sm {
padding: 0;
width: 300px;
+ .modal-tooltiptext {
+ margin-left: 0;
+ z-index: 99999999;
+ }
+
li {
background: $color-white;
border: 1px solid $color-alto;
@@ -1690,3 +1696,8 @@ textarea.textarea-sm {
}
}
}
+
+th.custom-field .modal-tooltiptext {
+ margin-left: 0;
+ z-index: 99999999;
+}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c8fa861cd..a10ee5e6c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -11,4 +11,13 @@ module ApplicationHelper
controller_name == 'projects' ||
(controller_name == 'reports' && action_name == 'index')
end
+
+ def display_tooltip(message, len = Constants::NAME_TRUNCATION_LENGTH)
+ if message.strip.length > Constants::NAME_TRUNCATION_LENGTH
+ "#{truncate(message.strip, length: len)} \
+ #{message.strip}
".html_safe
+ else
+ truncate(message.strip, length: len)
+ end
+ end
end
diff --git a/app/views/shared/_samples.html.erb b/app/views/shared/_samples.html.erb
index 2a2a790e0..23110c9b8 100644
--- a/app/views/shared/_samples.html.erb
+++ b/app/views/shared/_samples.html.erb
@@ -144,7 +144,7 @@
<%= "data-edit-url='#{organization_custom_field_path(@organization, cf)}'" %>
<%= "data-destroy-html-url='#{organization_custom_field_destroy_html_path(@organization, cf)}'" %>
>
- <%= cf.name %>
+ <%= display_tooltip(cf.name) %>
<% end %>