likify library discription

This commit is contained in:
Oleg Zharkov
2020-05-19 20:19:53 +02:00
parent 82c0ed046b
commit f1ea1b2500
4 changed files with 24 additions and 4 deletions
@@ -5,6 +5,9 @@ import { getGalaxyInstance } from "app";
import { Toast } from "ui/toast";
import mod_library_model from "mvc/library/library-model";
import mod_library_libraryrow_view from "mvc/library/library-libraryrow-view";
import linkifyJq from 'linkifyjs/jquery';
linkifyJq($, document);
var LibraryListView = Backbone.View.extend({
el: "#libraries_element",
@@ -129,8 +132,13 @@ var LibraryListView = Backbone.View.extend({
);
Galaxy.libraries.libraryToolbarView.renderPaginator(this.options);
}
$('#center [data-toggle="tooltip"]').tooltip({ trigger: "hover" });
$("#center").css("overflow", "auto");
const $center_tooltip_el = $('#center [data-toggle="tooltip"]');
if (!$center_tooltip_el.attr('title')) {
$center_tooltip_el.tooltip({trigger: "hover"});
$("#center").css("overflow", "auto");
}
// linkify description
$('[description=true]').linkify();
},
fetchDeleted: function () {
@@ -4,6 +4,7 @@ import Backbone from "backbone";
import { Toast } from "ui/toast";
import { getGalaxyInstance } from "app";
// galaxy library row view
var LibraryRowView = Backbone.View.extend({
events: {
@@ -38,6 +39,7 @@ var LibraryRowView = Backbone.View.extend({
}
this.prepareButtons(library);
var tmpl = this.templateRow();
this.setElement(
tmpl({
library: library,
@@ -46,6 +48,7 @@ var LibraryRowView = Backbone.View.extend({
})
);
this.$el.show();
return this;
},
@@ -62,6 +65,9 @@ var LibraryRowView = Backbone.View.extend({
old_element.replaceWith(this.$el);
/* now we attach new tooltips to the newly created row element */
this.$el.find('[data-toggle="tooltip"]').tooltip({ trigger: "hover" });
// linkify new description, after its change
$('[description=true]').linkify();
},
/**
@@ -244,12 +250,12 @@ var LibraryRowView = Backbone.View.extend({
<% } %>
<% if(library.get("description")) { %>
<% if( (library.get("description")).length> 40 ) { %>
<td data-toggle="tooltip" data-placement="bottom"
<td description=true data-toggle="tooltip" data-placement="bottom"
title="<%= _.escape(library.get("description")) %>">
<%= _.escape(library.get("description")).substring(0, 40) + "..." %>
</td>
<% } else { %>
<td><%= _.escape(library.get("description"))%></td>
<td description=true><%= _.escape(library.get("description"))%></td>
<% } %>
<% } else { %>
<td></td>
+1
View File
@@ -40,6 +40,7 @@
"jquery.cookie": "^1.4.1",
"latex-parser": "^0.6.2",
"latex-to-unicode-converter": "^0.5.2",
"linkifyjs": "^2.1.9",
"markdown-it": "^8.4.2",
"moment": "2.24.0",
"popper.js": "^1.16.1",
+5
View File
@@ -8341,6 +8341,11 @@ linkify-it@^2.0.0:
dependencies:
uc.micro "^1.0.1"
linkifyjs@^2.1.9:
version "2.1.9"
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-2.1.9.tgz#af06e45a2866ff06c4766582590d098a4d584702"
integrity sha512-74ivurkK6WHvHFozVaGtQWV38FzBwSTGNmJolEgFp7QgR2bl6ArUWlvT4GcHKbPe1z3nWYi+VUdDZk16zDOVug==
listify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/listify/-/listify-1.0.0.tgz#03ca7ba2d150d4267773f74e57558d1053d2bee3"