Skip to content

Commit

Permalink
Remove compatibility code for Glyphicons
Browse files Browse the repository at this point in the history
Also update examples in README.
  • Loading branch information
FestplattenSchnitzel committed Jan 2, 2024
1 parent debd943 commit 325cf81
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 38 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ complete .md file can look like this:
title: Stuff
author: alice
date: 2015-03-27
glyphicon: glyphicon-user
icon: bi-person

### Stuff
#### Part 1
Expand All @@ -227,8 +227,8 @@ Another possibility is to include hyperlinks, which only have a metadata
section:

title: Awesome page
glyphicon: glyphicon-tower
link: http://http://www.awesome-page.com/
icon: bi-emoji-smile
link: https://example.org/
rank: 1

Translations
Expand Down
4 changes: 1 addition & 3 deletions sipa/flatpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ def hidden(self) -> bool:

@property
def icon(self) -> str:
return self.localized_page.meta.get("icon") or self.localized_page.meta.get(
"glyphicon"
)
return self.localized_page.meta.get("icon")

def __getattr__(self, attr: str) -> str:
"""Return the meta attribute of the localized page
Expand Down
30 changes: 0 additions & 30 deletions sipa/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,36 +101,6 @@ def init_app(app, **kwargs):
)
app.add_template_filter(render_links)

def glyphicon_to_bi(glyphicon: str) -> str:
MAP = {
"glyphicon-briefcase": "bi-briefcase-fill",
"glyphicon-bullhorn": "bi-megaphone-fill",
"glyphicon-chevron-down": "bi-chevron-down",
"glyphicon-cloud": "bi-cloud-fill",
"glyphicon-comment": "bi-chat-left-fill",
"glyphicon-dashboard": "bi-speedometer",
"glyphicon-download-alt": "bi-download",
"glyphicon-envelope": "bi-envelope-fill",
"glyphicon-euro": "bi-currency-euro",
"glyphicon-file": "bi-file-earmark-fill",
"glyphicon-globe": "bi-globe-europe-africa",
"glyphicon-headphones": "bi-headphones",
"glyphicon-list-alt": "bi-card-list",
"glyphicon-lock": "bi-lock-fill",
"glyphicon-log-in": "bi-box-arrow-in-right",
"glyphicon-question-sign": "bi-question-circle-fill",
"glyphicon-retweet": "bi-arrow-repeat",
"glyphicon-signal": "bi-router-fill", # used for router page
"glyphicon-star": "bi-star-fill",
"glyphicon-tasks": "bi-box-arrow-up-right",
"glyphicon-tint": "bi-droplet-fill",
"glyphicon-transfer": "bi-arrow-left-right",
"glyphicon-user": "bi-person-fill",
"glyphicon-wrench": "bi-wrench-adjustable",
}
return MAP.get(glyphicon, glyphicon.replace("glyphicon-", "bi-"))

app.add_template_filter(glyphicon_to_bi)
logger.debug("Jinja globals have been set",
extra={'data': {'jinja_globals': app.jinja_env.globals}})

Expand Down
2 changes: 1 addition & 1 deletion sipa/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
{%- for article in c.articles -%}
{%- if not article.id == 'index' and article.title and not article.hidden -%}
<a href="{{ url_for('pages.show', category_id=c.id, article_id=article.id) }}" class="dropdown-item">
<span class="{{ article.icon | glyphicon_to_bi }}"></span>
<span class="{{ article.icon }}"></span>
&nbsp; {{ article.title }}
</a>
{%- endif %}
Expand Down
2 changes: 1 addition & 1 deletion sipa/templates/news_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% set known_meta_keys = [
"title", "author", "date",
"outage", "information", "event",
"rank", "link", "hidden", "icon", "glyphicon",
"rank", "link", "hidden", "icon",
] %}
{% block content %}
<div class="mb-3">
Expand Down

0 comments on commit 325cf81

Please sign in to comment.