Skip to content

Commit

Permalink
Merge pull request #4859 from avalonmediasystem/collection-card-title
Browse files Browse the repository at this point in the history
Fix html encoded titles in collection cards
  • Loading branch information
cjcolvar authored Aug 29, 2022
2 parents ddb9e34 + cde17e0 commit 65b14ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 11 additions & 0 deletions app/javascript/components/collections/Collection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@
.italic {
font-style: italic;
}

// When `line-clamp` is used with `display: -webkit-box`
// contains text to a given amount of lines (e.g.: 2)
// Reference: https://mgearon.com/css/line-clamp-css-guide/
h4 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
}

.card-text {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ const thumbnailSrc = (doc, props) => {
};

const titleHTML = (doc) => {
var title = doc.attributes['title_tesi'] && doc.attributes['title_tesi'].attributes.value.substring(0, 50) || doc['id'];
if (doc.attributes['title_tesi'] && doc.attributes['title_tesi'].attributes.value.length >= 50) {
title += "<span>...</span>";
}
var title = doc.attributes['title_tesi'] && doc.attributes['title_tesi'].attributes.value || doc['id'];
return { __html: title };
};

Expand Down

0 comments on commit 65b14ed

Please sign in to comment.