Skip to content

Commit

Permalink
Migrate app-specific messaging to app_message block in base template
Browse files Browse the repository at this point in the history
  • Loading branch information
lovett committed Aug 10, 2019
1 parent 0772547 commit 7e8bd7c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 16 deletions.
1 change: 0 additions & 1 deletion apps/bookmarks/bookmarks.jinja.html
Expand Up @@ -74,7 +74,6 @@
{% endif %}
</nav>


<p {% if bookmarks %}class="hidden nothing-message"{% endif %}>Nothing found.</p>

{% if count %}
Expand Down
19 changes: 11 additions & 8 deletions apps/htmlhead/htmlhead.jinja.html
Expand Up @@ -4,18 +4,21 @@
{{ macros.staticAsset('htmlhead', 'htmlhead.css') }}
{% endblock %}

{% block app_message %}
{% if failure_message %}
<section id="app-message" class="error">{{ failure_message }}</section>
{% elif status_code and status_code != 200 %}
<section id="app-message" class="error">The URL returned a {{ status_code }}</section>
{% else %}
{{ super() }}
{% endif %}
{% endblock %}


{% block page_body %}
<main>
{{ macros.svgSymbols("search", "close", "globe") }}

{% if failure_message %}
<div class="error message">{{ failure_message }}</div>
{% endif %}

{% if status_code and status_code != 200 %}
<div class="error message">The URL returned a {{ status_code }}.</div>
{% endif %}

<header class="app-nav">
<form method="post" action="{{ app_url }}">
<div class="field">
Expand Down
9 changes: 8 additions & 1 deletion apps/phone/phone.jinja.html
@@ -1,13 +1,20 @@
{% extends "base.jinja.html" %}
{% import "macros.jinja.html" as macros with context -%}

{% block app_message %}
{% if error %}
<section id="app-message" class="error">{{ error }}</section>
{% else %}
{{ super() }}
{% endif %}
{% endblock %}

{% block page_body %}
<main>
{{ macros.svgSymbols("search", "close", "globe") }}

<header class="app-nav">
<form method="get" action="/phone">
<div class="{% if not error %}hidden{% endif %} error message">{{ error }}</div>
<div class="field">
<label for="number">Number</label>
<input type="text" id="number" name="number" placeholder="enter a phone number or area code" value="{{ number }}"/>
Expand Down
10 changes: 8 additions & 2 deletions apps/reminder/reminder.jinja.html
Expand Up @@ -9,13 +9,19 @@
{{ macros.vueApp('main', ('countdown', 'discardable-record', 'discard-button', '/reminder/static/reminder-form.js', '/reminder/static/reminder-template.js')) }}
{% endblock %}

{% block app_message %}
{% if error %}
<section id="app-message" class="error">{{ error }}</section>
{% else %}
{{ super() }}
{% endif %}
{% endblock %}


{% block page_body %}
<main>
{{ macros.svgSymbols("delete") }}

<div class="{% if not error %}hidden{% endif %} error message">{{ error }}</div>

{% if upcoming %}
<header class="app-nav">
<p>Upcoming</p>
Expand Down
10 changes: 8 additions & 2 deletions apps/wakeup/wakeup.jinja.html
Expand Up @@ -5,12 +5,18 @@
{{ macros.staticAsset('wakeup', 'wakeup.css') }}
{% endblock %}

{% block app_message %}
{% if sent %}
<section id="app-message" class="success">Ping sent!</section>
{% else %}
{{ super() }}
{% endif %}
{% endblock %}

{% block page_body %}
<main>
{{ macros.svgSymbols("add-item") }}

<div class="{% if not sent %}hidden{% endif %} success message">Ping sent!</div>

<header class="app-nav">
<a href="{{ registry_url }}">
<svg class="icon"><use xlink:href="#add-item"></use></svg>
Expand Down
5 changes: 4 additions & 1 deletion templates/base.jinja.html
Expand Up @@ -39,7 +39,10 @@ <h1>

<span class="focus-buffer-display"></span>
</header>
<div id="app-message" hidden></div>

{% block app_message %}
<section id="app-message" hidden></section>
{% endblock %}

{% block page_body %}{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion templates/macros.jinja.html
Expand Up @@ -188,7 +188,7 @@

{% macro queryPlan(rows) -%}
{% if rows|count > 0 %}
<section class="page-section">
<section>
<details>
<summary>Query</summary>

Expand Down

0 comments on commit 7e8bd7c

Please sign in to comment.