Skip to content

Commit

Permalink
Open help links in new tabs by default
Browse files Browse the repository at this point in the history
Every now and then, people click the links while creating or editing a
trip, only to lose their progress. I should better solve that problem
(and the issue of accidentally closing a tab/window) by instead
prompting the user with an "unsaved changes" modal.

However, I looked into doing that before, and I *think* I decided
against it because the trip creation form is still using super legacy
AngularJS forms.

For now, we can at least just force a new tab/window. I don't love this,
and it's somewhat against W3C guidelines (though this is a carve-out for
links on a form page):
https://www.w3.org/TR/WCAG20-TECHS/G200.html
  • Loading branch information
DavidCain committed Jan 6, 2025
1 parent a5322df commit 6ed9d60
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
36 changes: 36 additions & 0 deletions ws/migrations/0007_target_blank_help_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.2.17 on 2025-01-06 03:58

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("ws", "0006_add_ws_application_question"),
]

operations = [
migrations.AlterField(
model_name="trip",
name="description",
field=models.TextField(
help_text='<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">Markdown</a> supported! Please use HTTPS images sparingly, and only if properly licensed.'
),
),
migrations.AlterField(
model_name="trip",
name="winter_terrain_level",
field=models.CharField(
blank=True,
choices=[
("A", "A: <1 hour to intensive care, below treeline"),
("B", "B: >1 hour to intensive care, below treeline"),
("C", "C: above treeline"),
],
db_index=True,
help_text='Trip leaders must meet <a href="/help/participants/ws_ratings/" target="_blank">requirements for terrain & activity ratings</a>.',
max_length=1,
null=True,
verbose_name="Terrain level",
),
),
]
4 changes: 2 additions & 2 deletions ws/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ class Trip(models.Model):
name = models.CharField(max_length=127)
description = models.TextField(
help_text=mark_safe( # noqa: S308
'<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet">'
'<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">'
"Markdown</a> supported! "
"Please use HTTPS images sparingly, and only if properly licensed."
)
Expand Down Expand Up @@ -1111,7 +1111,7 @@ class Trip(models.Model):
("C", "C: above treeline"),
],
help_text=mark_safe( # noqa: S308
'Trip leaders must meet <a href="/help/participants/ws_ratings/">requirements for terrain & activity ratings</a>.',
'Trip leaders must meet <a href="/help/participants/ws_ratings/" target="_blank">requirements for terrain & activity ratings</a>.',
),
db_index=True,
)
Expand Down

0 comments on commit 6ed9d60

Please sign in to comment.