-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(generic): introduce MoreLessColumn
The MoreLessColumn is a custom column based on the TemplateColumn. It provides a short preview of long text with a "Show more" element to show a longer version of the text.
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
summary.more-less-column { | ||
list-style: none; | ||
appearance: none; | ||
-webkit-appearance: none; /* for WebKit browsers */ | ||
} | ||
|
||
/* optional: remove ::marker for older browsers */ | ||
summary.more-less-column ::marker { | ||
content: none; | ||
} | ||
|
||
summary.more-less-column { | ||
cursor: pointer; | ||
} | ||
|
||
/* add "Show more" text when collapsed */ | ||
summary.more-less-column::after { | ||
content: " Show more"; | ||
font-weight: normal; | ||
font-size: smaller; | ||
color: grey; | ||
} | ||
|
||
/* hide the summary text when expanded, show only "Show less" */ | ||
details[open] summary.more-less-column::before { | ||
content: "Show less"; | ||
color: grey; | ||
} | ||
|
||
/* hide the original summary text when expanded */ | ||
details[open] summary.more-less-column::after { | ||
content: ""; | ||
} | ||
|
||
details[open] summary.more-less-column { | ||
visibility: hidden; | ||
} | ||
|
||
/* make sure the generated "Show less" text is visible */ | ||
details[open] summary.more-less-column::before { | ||
visibility: visible; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% load static %} | ||
<link rel="stylesheet" href="{% static 'css/more-less-column.css' %}"> | ||
{% if preview != "" and fulltext != preview %} | ||
<details class="more-less-column"> | ||
<summary class="more-less-column">{{ preview }}</summary> | ||
{{ fulltext }} | ||
</details> | ||
{% else %} | ||
{{ fulltext }} | ||
{% endif %} |