Skip to content

Commit

Permalink
Merge pull request #12597 from PennyDreadfulMTG/misc-fix
Browse files Browse the repository at this point in the history
Misc fixes
  • Loading branch information
mergify[bot] committed May 15, 2024
2 parents 3a901a8 + 6397f59 commit f295de1
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 24 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ Check the dev.py source code for the full set of options including `unit`, `type

- Run logsite
- pipenv run python dev.py watch # Builds bundle.js after every file change.

## Decksite performance testing/monitoring

- You can run decksite in profiling mode with:
- $ pipenv run python3 ~/pd/run.py profiler
- You can be warned about slowness by setting `slow_query`, `slow_page` and `slow_fetch` limits in conifg.json
8 changes: 4 additions & 4 deletions decksite/data/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ class RawDeckDescription(TypedDict, total=False):
# Expects:
#
# {
# 'name': <string>,
# 'url': <string>,
# 'source': <string>,
# 'identifier': <string>,
# 'name': <str>,
# 'url': <str>,
# 'source': <str>,
# 'identifier': <str>,
# 'cards' {
# 'maindeck': {
# '<canonical card name>': <int>,
Expand Down
3 changes: 2 additions & 1 deletion decksite/prepare.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import urllib.parse
from collections.abc import Sequence

from anytree import PreOrderIter
Expand Down Expand Up @@ -58,7 +59,7 @@ def url_for_card(c: Card, tournament_only: bool = False, season_id: int | str |
g.url_cache['card_page'] = url_for('.card', name='--cardname--', deck_type=DeckType.TOURNAMENT.value if tournament_only else None)
else:
g.url_cache['card_page'] = url_for('seasons.card', name='--cardname--', deck_type=DeckType.TOURNAMENT.value if tournament_only else None, season_id=season_id)
return g.url_cache['card_page'].replace('--cardname--', c.name)
return g.url_cache['card_page'].replace('--cardname--', urllib.parse.quote(c.name))

def prepare_decks(ds: list[Deck]) -> None:
for d in ds:
Expand Down
12 changes: 6 additions & 6 deletions decksite/templates/buttons.mustache
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<ul class="buttons">
{{#show_tournament_toggle}}
<li>
<a href="{{toggle_results_url}}">
<a class="button" href="{{toggle_results_url}}">
<span class="toggle {{#tournament_only}}toggle-right{{/tournament_only}}" id="tournament-toggle" type="checkbox"></span>
<span class="toggle-button" for="tournament-toggle"></span>
Tournaments Only
</a>
</li>
{{/show_tournament_toggle}}
{{#has_external_source}}
<li><a title="View competition source ({{type}})" class="external" href="{{url}}">Source</a></li>
<li class="button"><a title="View competition source ({{type}})" class="external" href="{{url}}">Source</a></li>
{{/has_external_source}}
{{^is_in_current_run}}
{{#is_deck_page}}
<li><a title="Magic Online Download (txt)" href="{{export_url}}">Download</a></li>
<li><a title="Buy on Cardhoarder" class="external" href="{{cardhoarder_url}}">Buy</a></li>
<li><a title="View decklist source ({{source_name}})" {{#source_is_external}}class="external"{{/source_is_external}} href="{{source_url}}">Source</a></li>
<li><a class="button" title="Magic Online Download (txt)" href="{{export_url}}">Download</a></li>
<li><a class="button external" title="Buy on Cardhoarder" href="{{cardhoarder_url}}">Buy</a></li>
<li><a class="button{{#source_is_external}} external{{/source_is_external}}" title="View decklist source ({{source_name}})" href="{{source_url}}">Source</a></li>
{{/is_deck_page}}
{{/is_in_current_run}}
{{#show_seasons}}
<li>{{> seasonchooser}}</li>
<li class="button">{{> seasonchooser}}</li>
{{/show_seasons}}
</ul>
2 changes: 1 addition & 1 deletion decksite/templates/faqsbody.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<p>{{_ You play five matches per run. You can join the league at any time.}}</p>
<p>{{_ To find a game sign up and then create a game in Constructed, Specialty, Freeform Tournament Practice with "Penny Dreadful League" as the comment.}}</p>
<p>{{_ Top 8 finishers on each month's league leaderboard win credit with [Cardhoarder](https://cardhoarder.com/).}}</p>
<p><a href="{{current_league_url}}">{{_ Current League}}</a></o>
<p><a href="{{current_league_url}}">{{_ Current League}}</a></p>
<p><a href="{{league_info_url}}">{{_ More Info}}</a></p>
<p><a href="{{league_signup_url}}">{{_ Sign Up}}</a></p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion decksite/templates/header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{{#oembed_url}}
<link rel="alternate" type="application/json+oembed"
href="{{oembed_url}}"
title="Penny Dreadful Magic" />
title="Penny Dreadful Magic">
{{/oembed_url}}
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name="google-site-verification" content="5cg_JSKOouPW66K4NuMdm9bQHV9CWH9iVszTByzeDPg">
Expand Down
2 changes: 1 addition & 1 deletion decksite/templates/language_switcher.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="language-switcher has-submenu">
<a href="#"><img class="language-icon" src="{{language_icon}}"></a>
<a href="#"><img alt="Language Switcher" class="language-icon" src="{{language_icon}}"></a>
<div class="submenu-container">
<ul>
{{#babel_languages}}
Expand Down
1 change: 1 addition & 0 deletions decksite/views/archetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, archetype: archs.Archetype, archetypes: list[archs.Archetype]
self.show_tournament_toggle = True
self.toggle_results_url = url_for('.archetype', archetype_id=self.archetype.id, deck_type=None if tournament_only else DeckType.TOURNAMENT.value)
self.show_archetype_tree = len(self.archetypes) > 0
self.has_cards = True

def og_title(self) -> str:
return self.archetype.name
Expand Down
16 changes: 8 additions & 8 deletions shared_web/static/css/pd.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shared_web/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def insert_gettext_nodes(parsed_template: pystache.parsed.ParsedTemplate) -> pys
# We may need to iterate into Sections and Inverted nodes
return new_template

class _GettextNode():
class _GettextNode:
def __init__(self, key: str) -> None:
self.key = key

Expand All @@ -102,7 +102,7 @@ def lookup(match: Match) -> str:

class NoParaTagProcessor(Treeprocessor):
def run(self, root: etree.Element) -> None:
root[0].tag = 'string'
root[0].tag = 'span'

class NoParaTagsExtension(Extension):
def extendMarkdown(self, md: Markdown) -> None:
Expand Down

0 comments on commit f295de1

Please sign in to comment.