Redesign UI and fix several bugs
- Add navbar with login/logout, search form, and Find Link branding
- Clean up index page: search-only, examples behind ?debug=1
- Improve article page: remove debug clutter, named Wikipedia links, collapsible candidates
- Add SVG favicon (🔗 emoji)
- Fix diff CSS: compact layout, auto table layout to eliminate wide marker column gap
- Catch TokenRequestDenied in OAuth start and show error page
- Store username in session at login; clear bad session on API failure
- Raise NoMatch when diff is empty (edit already applied)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7867122326
commit
bc6265d4cd
11 changed files with 167 additions and 90 deletions
|
|
@ -1,48 +1,54 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Link '{{ title }}' in '{{ hit_title }}'{% endblock %}
|
||||
{% block title %}{{ title }} in {{ hit_title }}{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
<link href="{{ url_for("static", filename="css/diff.css") }}" rel="stylesheet"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h1>Link '{{ title }}' in '{{ hit_title }}'</h1>
|
||||
<form action="{{ url_for("index") }}">
|
||||
<input name="q">
|
||||
<input type="submit" value="search">
|
||||
</form>
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" class="mb-3">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('index') }}">Home</a></li>
|
||||
<li class="breadcrumb-item active">{{ title }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div>Username: {{ g.user }}</div>
|
||||
<div class="d-flex flex-wrap align-items-baseline gap-3 mb-1">
|
||||
<h1 class="h4 mb-0">Link "{{ title }}" in "{{ hit_title }}"</h1>
|
||||
<a href="https://en.wikipedia.org/wiki/{{ title }}" target="_blank" class="text-muted small">{{ title }} ↗</a>
|
||||
<a href="https://en.wikipedia.org/wiki/{{ hit_title }}" target="_blank" class="text-muted small">{{ hit_title }} ↗</a>
|
||||
</div>
|
||||
|
||||
<div><a href="https://en.wikipedia.org/wiki/{{ title }}" target="_blank">view article</a></div>
|
||||
<div class="d-flex gap-3 mb-4 text-muted small">
|
||||
<span>{{ total }} mentions total</span>
|
||||
<span>{{ with_link }} already linked ({{ "{:.0%}".format(with_link / total) }})</span>
|
||||
</div>
|
||||
|
||||
<div><a href="{{ url_for('index') }}">back to index </a></div>
|
||||
<div class="mb-4">
|
||||
<table class="diff">{{ diff | safe }}</table>
|
||||
</div>
|
||||
|
||||
<div>total: {{ total }}</div>
|
||||
<div>with link: {{ with_link }}</div>
|
||||
<div>ratio: {{ "{:.1%}".format(with_link / total) }}</div>
|
||||
{# <div>hit: {{ hit }}</div> #}
|
||||
<div>replacement: {{ found.replacement }}</div>
|
||||
<div>section: {{ found.section }}</div>
|
||||
<table>
|
||||
{{ diff | safe }}
|
||||
</table>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="hit" value="{{ hit_title }}">
|
||||
<div class="my-3">
|
||||
<input type="submit" class="btn btn-primary" value="save"/>
|
||||
<a href="{{url_for("article_page", url_title=url_title, after=hit_title)}}" class="btn btn-primary">skip</a>
|
||||
</div>
|
||||
</form>
|
||||
<form method="POST" class="mb-4">
|
||||
<input type="hidden" name="hit" value="{{ hit_title }}">
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-success">Save edit</button>
|
||||
<a href="{{ url_for("article_page", url_title=url_title, after=hit_title) }}" class="btn btn-outline-secondary">Skip</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<ol>
|
||||
{% if hits %}
|
||||
<details class="border rounded p-3">
|
||||
<summary class="text-muted small" style="cursor:pointer">{{ hits | length }} other candidates</summary>
|
||||
<ol class="mt-3 mb-0 small">
|
||||
{% for hit in hits %}
|
||||
{% set url = url_for("article_page", url_title=url_title, title=hit.title) %}
|
||||
<li><a href="{{ url }}">{{ hit.title }}</a> – {{ hit.snippet | safe }}</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ url_for("article_page", url_title=url_title, title=hit.title) }}">{{ hit.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
</details>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue