Procházet zdrojové kódy

Updated: Handle missing message.

Add oldstyle to style the message text.

Possibly try using google font
https://fonts.google.com/specimen/VT323
(I don't know if it has the needed unicode
box drawing, etc.)

Added BZ&BZ footer.  ;)
root před 4 roky
rodič
revize
6f4a0f63d7
5 změnil soubory, kde provedl 32 přidání a 3 odebrání
  1. 5 0
      messages.py
  2. 7 1
      static/style.css
  3. 3 0
      templates/base.html
  4. 6 2
      templates/message.html
  5. 11 0
      templates/missing-message.html

+ 5 - 0
messages.py

@@ -105,6 +105,11 @@ def display_message(area, msgno):
 
     message = jammin.read_message(bases[area], msgno)
 
+    if not message:
+        return render_template(
+            "missing-message.html", base_path=base_path, area=area, title="Missing Message"
+        )
+
     if "text" in message:
         if "\x1b" in message["text"]:
             # Ok, the message contains ANSI CODES -- Convert

+ 7 - 1
static/style.css

@@ -16,4 +16,10 @@
     font-size: 150%;
 }
 
-</style>
+.oldstyle {
+  background: black;
+  color: white;
+  font: 0.9rem Inconsolata, monospace;
+}
+
+</style>

+ 3 - 0
templates/base.html

@@ -21,5 +21,8 @@
     <script src="{{ url_for( 'static', filename='js/vendor/what-input.js') }}"></script>
     <script src="{{ url_for( 'static', filename='js/vendor/foundation.js') }}"></script>
     <script src="{{ url_for( 'static', filename='js/app.js') }}"></script>
+    <footer class="large-12 callout">
+    BZ&amp;BZ BBS
+    </footer>
   </body>
 </html>

+ 6 - 2
templates/message.html

@@ -36,9 +36,13 @@
 
 <div class="grid-x padding-x">
 <div class="large-2 cell">Text:</div>
-<div class="large-10 cell">{% if message.png is defined %}<img alt="Message {{ message.MsgNum }}" src="data:image/png;base64,{{ message.png|safe }}">{% else %}<pre>{{ message.text|safe }}</pre>{% endif %}</div>
+<div class="large-10 cell">{% if message.png is defined %}
+  <img alt="Message {{ message.MsgNum }}" src="data:image/png;base64,{{ message.png|safe }}">{% else %}
+  <pre class="oldstyle">{{ message.text }}</pre>{% endif %}
 </div>
 
 </div>
 
-{% endblock %}
+</div>
+
+{% endblock %}

+ 11 - 0
templates/missing-message.html

@@ -0,0 +1,11 @@
+{% extends 'base.html' %}
+
+{% block header %}
+<h1>Missing Message in {{ area }}</h1>
+{% endblock %}
+
+{% block content %}
+<p>Sorry, I can't find that message.</p>
+<a href="{{ url_for('display_messages', area=area) }}">Back to {{ area }}</a>
+
+{% endblock %}