Skip to content

Commit fa481a2

Browse files
authored
Merge pull request #49 from ELIXIR-Belgium/news-improv
Adding support for collapsible news items
2 parents a65662d + 446b738 commit fa481a2

File tree

6 files changed

+38
-12
lines changed

6 files changed

+38
-12
lines changed

_data/news.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,22 @@
44
- name: News title 2
55
date: 2021-09-20
66
description: Example Description with [link](about)
7+
- name: News title 3
8+
date: 2021-09-20
9+
linked_pr: 2
10+
description: >
11+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean magna massa, vestibulum ut leo eget, fermentum molestie mauris. Cras facilisis libero non sodales lobortis. Proin eu ultricies lacus. Sed posuere orci id tincidunt sollicitudin. Phasellus sit amet justo turpis. Vestibulum non volutpat libero. Donec mattis elementum sem nec posuere. Donec vitae libero sed mi faucibus tempus.
12+
Talks included<span>:</span>
13+
* Curabitur faucibus lectus a sem posuere tempus
14+
* [Vivamus et dignissim nulla](/)
15+
* Curabitur faucibus lectus a sem posuere tempus
16+
* [Vivamus et dignissim nulla](/)
17+
18+
Donec sagittis laoreet leo, eu tincidunt nulla pulvinar a. Aenean diam orci, rhoncus et imperdiet eget, sodales eget massa. Pellentesque lobortis egestas consequat.
19+
- name: News title 4
20+
date: 2021-09-20
21+
linked_pr: 2
22+
description: >
23+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean magna massa, vestibulum ut leo eget, fermentum molestie mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean magna massa, vestibulum ut leo eget, fermentum molestie mauris.
24+
25+

_includes/events.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h2>{{include.event_type | replace: "_", " " | capitalize}}s</h2>
1616
{%- endif %}
1717
{%- if event.description %}
1818
{%- assign word_count = event.description | split: " " | size %}
19-
{%- if include.truncate == "true" and word_count > 20 %}
19+
{%- if include.truncate == "true" and word_count > 40 %}
2020
<p class="mb-0"><a data-bs-toggle="collapse" href="#collapse-{{count}}" role="button" aria-expanded="false" aria-controls="collapse-{{count}}">
2121
View description
2222
</a>

_includes/news.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,20 @@ <h2>Whats new?</h2>
99
<li>
1010
<span class="title mb-1">{{ new.name | escape }}</span>
1111
<p class="text-muted"><i class="far fa-calendar me-2"></i><time>{{ new.date | date_to_long_string }}</time>{% if new.linked_pr %}<b> - </b><i class="fas fa-code-branch"></i><a href="{{ site.github.repository_url | append: '/pull/' | append: new.linked_pr }}">{{new.linked_pr }}</a>{% endif %}</p>
12+
{%- if new.description %}
13+
{%- assign word_count = new.description | split: " " | size %}
14+
{%- if include.truncate == "true" and word_count > 40 %}
15+
<p class="mb-0"><a data-bs-toggle="collapse" href="#collapse-{{count}}" role="button" aria-expanded="false" aria-controls="collapse-{{count}}">
16+
View description
17+
</a>
18+
</p>
19+
<div class="full-description collapse" id="collapse-{{count}}">
20+
{{ new.description | markdownify }}
21+
</div>
22+
{%- else %}
1223
{{ new.description | markdownify }}
24+
{%- endif %}
25+
{%- endif %}
1326
</li>
1427
{%- assign count = count | plus: 1 %}
1528
{%- if include.limit and count == include.limit %}

_sass/_custom_variables.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ $btn-primary-color-hover: $white;
1010
$topnav-bg: $light;
1111
$topnav-title-color: $primary;
1212
$topnav-brand-height: 44px;
13-
$topnav-border: 0;
1413

1514
/*-----Search-----*/
1615
$search-result-color: $primary;
@@ -27,7 +26,6 @@ $sidebar-color-active: $white;
2726

2827
/*-----TOC-----*/
2928
$toc-bg: $light;
30-
$toc-border: 0;
3129

3230
/*-----Section navigation tiles-----*/
3331
$nav-card-bg: $white;
@@ -54,6 +52,8 @@ $contr-crown-color: $white;
5452

5553
/*-----Events & news-----*/
5654
$news-title-bg: $primary;
55+
$news-border-color: $light;
56+
$news-title-color: $white;
5757

5858
/*-----Default badge-----*/
5959
$badge-color: $body-color;
@@ -67,5 +67,4 @@ $footer-color: $dark;
6767
$footer-link-color: $dark;
6868
$footer-link-color-hover: $primary;
6969
$footer-copyright-bg: $gray-200;
70-
$footer-border: 0;
7170

assets/css/main.scss

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ pre code {
133133

134134
header .navbar {
135135
background-color: $topnav-bg;
136-
border-bottom: $topnav-border;
137136
.navbar-brand {
138137
color: $topnav-title-color;
139138
img {
@@ -344,7 +343,6 @@ header .navbar {
344343

345344
#toc {
346345
background-color: $toc-bg;
347-
border: $toc-border;
348346
// Indent the lists and reset any other padding
349347

350348
ul {
@@ -421,7 +419,6 @@ footer {
421419
font-size: 0.9em;
422420
line-height: 24px;
423421
background-color: $footer-bg;
424-
border-top: $footer-border;
425422
color: $footer-color;
426423

427424
a {
@@ -531,7 +528,6 @@ footer {
531528
position: fixed;
532529
background-color: $footer-bg;
533530
color: $footer-color;
534-
border-top: $footer-border;
535531
bottom: 0;
536532
left: 0;
537533
width: 100%;
@@ -589,7 +585,7 @@ li.past_event,
589585

590586
.events > ul > li,
591587
.news > ul > li {
592-
border-left: $light 5px solid;
588+
border-left: $news-border-color 5px solid;
593589
border-radius: $border-radius;
594590
padding: 0px 11px;
595591

@@ -601,11 +597,10 @@ li.past_event,
601597
.title {
602598
background-color: $news-title-bg;
603599
font-weight: 600;
604-
color: $white;
600+
color: $news-title-color;
605601
padding: 0px 11px;
606602
border-radius: 0px 4px 4px 0px;
607603
margin-left: -11px;
608-
border: 1px solid $news-title-bg;
609604
display: inline-block;
610605
}
611606

pages/example_pages/news.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ title: News
33
toc: false
44
---
55

6-
{% include news.html %}
6+
{% include news.html truncate="true" caption="true" %}

0 commit comments

Comments
 (0)