Skip to content

Add archive section to each page (fixes #485) #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sass/_extra.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,22 @@ a {
color: #767676;
}

.ui.card.archived {
background-color: #f8f8f9;
}

.ui.primary.button, .ui.primary.buttons .button {
background-color: #1F7BC1;
}

.ui.container .ui.message {
margin: .875em .5em;

@media only screen and (max-width: 767px) {
margin: 2em 1em;
}
}

.nolist {
padding-left: 0;
list-style-type: none;
Expand Down
2 changes: 1 addition & 1 deletion sass/_semantic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// @import 'semantic/form';
@import 'semantic/grid';
@import 'semantic/menu';
//@import 'semantic/message';
@import 'semantic/message';
// @import 'semantic/table';
// @import 'semantic/ad';
@import 'semantic/card';
Expand Down
4 changes: 2 additions & 2 deletions templates/categories/macros.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro info(item, section) %}
{% macro info(item, section, archived=false) %}

{% if item.name %}
{% set name = item.name %}
Expand Down Expand Up @@ -43,7 +43,7 @@
{% set primary_url = repository_url %}
{% endif %}

<li class="ui card">
<li class="ui card{% if archived %} archived{% endif %}">
{% if item.image %}
{% if primary_url %}
<a class="image" href="{{ primary_url }}">
Expand Down
54 changes: 45 additions & 9 deletions templates/categories/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ <h1 class="ui center aligned icon header">
</section>

{# list all content #}

{% set config = load_data(path = "content/" ~ section.path ~ "data.toml", format="toml") %}

{% set crates = [] %}
{% set archived = [] %}

{% for item in config.items %}
{% if item.categories is containing(page.slug) %}
{% if item.archived %}
{% set_global archived = archived | concat(with=item) %}
{% else %}
{% set_global crates = crates | concat(with=item) %}
{% endif %}
{% endif %}
{% endfor %}

<section>
<h2 class="ui horizontal divider small header">
<a href="#{{ section.extra.plural | slugify }}" id="{{ section.extra.plural | slugify }}">
Expand All @@ -43,20 +59,40 @@ <h2 class="ui horizontal divider small header">
<div class="ui vertical stripe">
<div class="ui container">
<ul class="ui stackable cards nolist {{ columns }}">
{% set config = load_data(path = "content/" ~ section.path ~ "data.toml", format="toml") %}

{% if config.items %}
{% for item in config.items %}
{% if item.categories is containing(page.slug) %}
{{ category_macros::info(item=item, section=section) }}
{% endif %}
{% endfor %}
{% endif %}
{% for item in crates %}
{{ category_macros::info(item=item, section=section) }}
{% endfor %}
</ul>
</div>
</div>
</section>

{% if archived | length > 0 %}
<section>
<h2 class="ui horizontal divider small header">
<a href="#{{ section.extra.plural | slugify }}" id="{{ section.extra.plural | slugify }}">
<i class="bed icon big"></i>
Archived
</a>
</h2>

<div class="ui vertical stripe">
<div class="ui container">
<div class="ui message">
<i class="info circle icon"></i>
These {{ section.extra.plural }} are no longer maintained, but may still be of interest.
</div>

<ul class="ui stackable cards nolist {{ columns }}">
{% for item in archived %}
{{ category_macros::info(item=item, section=section, archived=true) }}
{% endfor %}
</ul>
</div>
</div>
</section>
{% endif %}

<section>
<h2 class="ui horizontal divider small header">
<a href="#contribute" id="contribute">
Expand Down