Skip to content

Commit

Permalink
Add support for end-date type in table.html
Browse files Browse the repository at this point in the history
  • Loading branch information
marcwrobel authored and captn3m0 committed Apr 6, 2023
1 parent 01c1b83 commit 43ed585
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
32 changes: 28 additions & 4 deletions _includes/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
see https://jekyllrb.com/docs/liquid/filters/#date-to-string.
- timeago: display the value using the timeago filter,
see https://github.com/markets/jekyll-timeago.
- end-date: display the value as an end of something date (such as support or EOL).
This is the "classic" way do display end of support or EOL date on endoflife.date, with:
- a background color as a visual indication,
- the value displayed using both the date_to_string and timeago filters,
- a support for both boolean and date values.
{% endcomment %}
{%- assign labels = include.labels | split:',' %}
{%- assign fields = include.fields | split:',' %}
Expand All @@ -38,10 +43,29 @@
{%- for row in rows %}
<tr>
{%- for field in fields %}
{%- if types[forloop.index0] == "date" %}
<td>{{ row[field] | date_to_string }}</td>
{%- elsif types[forloop.index0] == "timeago" %}
<td>{{ row[field] | timeago }}</td>
{%- assign type = types[forloop.index0] %}
{%- assign value = row[field] %}
{%- if type == "date" %}
<td>{{ value | date_to_string }}</td>
{%- elsif type == "timeago" %}
<td>{{ value | timeago }}</td>
{%- elsif type == "end-date" %}
{%- if value == true %}
<td class="bg-green-000">Yes</td>
{%- elsif value == false %}
<td class="bg-red-000">No</td>
{%- else %}
{%- assign row_date = row[field] | date: '%s' %}
{%- assign site_date = site.time | date: '%s' %}
{%- assign days_between = row_date | minus: site_date | divided_by: 86400 %}
{%- if days_between < 0 %}
<td class="bg-red-000">Ended {{ row[field] | timeago }} <div>({{ row[field] | date_to_string }})</div></td>
{%- elsif days_between < 120 %}
<td class="bg-yellow-200">Ends {{ row[field] | timeago }} <div>({{ row[field] | date_to_string }})</div></td>
{%- else %}
<td class="bg-green-000">Ends {{ row[field] | timeago }} <div>({{ row[field] | date_to_string }})</div></td>
{%- endif %}
{%- endif %}
{%- else %}
<td>{{ row[field] }}</td>
{%- endif %}
Expand Down
2 changes: 1 addition & 1 deletion products/vmware-esxi.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ support, server/client/guest OS updates, new security patches or bug fixes unles
{% include table.html
labels="Release,Technical Guidance Ends"
fields="releaseCycle,technicalGuidance"
types="raw,timeago"
types="raw,end-date"
rows=page.releases %}
2 changes: 1 addition & 1 deletion products/vmware-horizon.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@ support, server/client/guest OS updates, new security patches or bug fixes unles
{% include table.html
labels="Release,Technical Guidance Ends"
fields="releaseCycle,technicalGuidance"
types="raw,timeago"
types="raw,end-date"
rows=page.releases %}
2 changes: 1 addition & 1 deletion products/vmware-srm.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ support, server/client/guest OS updates, new security patches or bug fixes unles
{% include table.html
labels="Release,Technical Guidance Ends"
fields="releaseCycle,technicalGuidance"
types="raw,timeago"
types="raw,end-date"
rows=page.releases %}
2 changes: 1 addition & 1 deletion products/vmware-vcenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ support, server/client/guest OS updates, new security patches or bug fixes unles
{% include table.html
labels="Release,Technical Guidance Ends"
fields="releaseCycle,technicalGuidance"
types="raw,timeago"
types="raw,end-date"
rows=page.releases %}

0 comments on commit 43ed585

Please sign in to comment.