Skip to content

Commit

Permalink
cree-dictionary -> dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
fbanados committed Nov 22, 2024
1 parent acbd0fd commit 87d9eb7
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 45 deletions.
8 changes: 4 additions & 4 deletions frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function loadSearchResults(searchInput) {
}

function issueSearch() {
let searchURL = Urls["cree-dictionary-search-results"](userQuery);
let searchURL = Urls["dictionary-search-results"](userQuery);

window.history.replaceState(null, "", urlForQuery(userQuery));
hideProse();
Expand Down Expand Up @@ -216,7 +216,7 @@ function loadSearchResults(searchInput) {
}

function goToHomePage() {
window.history.replaceState(null, "", Urls["cree-dictionary-index"]());
window.history.replaceState(null, "", Urls["dictionary-index"]());

showProse();

Expand Down Expand Up @@ -282,10 +282,10 @@ function setupAudioOnPageLoad() {
/**
* Makes all URL paths relative to '/'.
* In development, the root path is '/', so nothing changes.
* On Sapir (as of 2020-03-09), the root path is '/cree-dictionary/'.
* On Sapir (as of 2020-03-09), the root path is '/dictionary/'.
*/
function makeRouteRelativeToSlash(route) {
let baseURL = Urls["cree-dictionary-index"]();
let baseURL = Urls["dictionary-index"]();
return route.replace(baseURL, "/");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Click in text embedded test page</title>
<script src="{% url 'js_reverse' %}"></script>
<script>
window.clickInTextApiUrl = Urls['cree-dictionary-word-click-in-text-api']() + '?q='
window.clickInTextApiUrl = Urls['dictionary-word-click-in-text-api']() + '?q='
</script>
<script src="{% static 'morphodict/click-in-text-embedded-test.js' %}"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions src/morphodict/api/templates/admin/base.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "admin/base.html" %}

{% block userlinks %}
<a href="{% url 'cree-dictionary-query-help' %}">Query help</a> /
<a href="{% url 'cree-dictionary-fst-tool' %}">FST tool</a> /
<a href="{% url 'dictionary-query-help' %}">Query help</a> /
<a href="{% url 'dictionary-fst-tool' %}">FST tool</a> /
{{ block.super }}
{% endblock %}
4 changes: 2 additions & 2 deletions src/morphodict/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
path(
"click-in-text/",
api_views.click_in_text,
name="cree-dictionary-word-click-in-text-api",
name="dictionary-word-click-in-text-api",
),
path(
"click-in-text-embedded-test/",
api_views.click_in_text_embedded_test,
name="cree-dictionary-click-in-text-embedded-test",
name="dictionary-click-in-text-embedded-test",
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div class="top-bar app__header">
<header class="branding top-bar__logo">
<a class="branding__logo" href="{% url 'cree-dictionary-index' %}">
<a class="branding__logo" href="{% url 'dictionary-index' %}">
<img class="branding__image"
src="{% static 'morphodict/img/morphodict-default-logo-192.png' %}"
alt="mîkiwâhp (teepee) logo">
Expand Down Expand Up @@ -40,7 +40,7 @@ <h3 class="menu__header">Show {{ MORPHODICT_SOURCE_LANGUAGE_NAME }} words in…<
<hr class="menu__separator">

<div class="menu__category">
<a href="{% url 'cree-dictionary-settings' %}" class="menu-choice" data-cy="settings-link">
<a href="{% url 'dictionary-settings' %}" class="menu-choice" data-cy="settings-link">
<span class="menu-choice__label fill-width"> View all settings</span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load static %}
<nav class="search top-bar__search">
<form class="search-bar search__search-bar" role="search"
method="get" action="{% url 'cree-dictionary-search' %}"
method="get" action="{% url 'dictionary-search' %}"
accept-charset="UTF-8"
>
<label for="search" class="search-bar__label">
Expand Down
2 changes: 1 addition & 1 deletion src/morphodict/frontend/templates/morphodict/fst-tool.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block prose %}
<section id="query-help" class="prose box box--spaced">
<h2 class="prose__section-title">FST tool</h2>
<form action='{% url "cree-dictionary-fst-tool" %}' style="display:flex">
<form action='{% url "dictionary-fst-tool" %}' style="display:flex">
<input name="text" value="{{ text }}" style="flex-grow: 1" />
<input type="submit" name="Analyze" />
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/morphodict/frontend/templatetags/morphodict_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def definition_link(context, slug: str) -> str:
wordform = Wordform.objects.get(slug=slug)
return format_html(
'<a href="{}">{}</a>',
reverse("cree-dictionary-index-with-lemma", kwargs=dict(slug=slug)),
reverse("dictionary-index-with-lemma", kwargs=dict(slug=slug)),
orth_tag(context, wordform.text),
)

Expand Down
2 changes: 1 addition & 1 deletion src/morphodict/lexicon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_absolute_url(self, ambiguity: Literal["allow", "avoid"] = "avoid") -> st
"""
assert self.is_lemma, "There is no page for non-lemmas"
# FIXME: will return '/word/None' if no slug
return reverse("cree-dictionary-index-with-lemma", kwargs={"slug": self.slug})
return reverse("dictionary-index-with-lemma", kwargs={"slug": self.slug})


class DictionarySource(models.Model):
Expand Down
8 changes: 4 additions & 4 deletions src/morphodict/lexicon/templates/morphodict/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@
<li><a href="http://altlab.artsrn.ualberta.ca/itwewina#help" class="footer-links__link" target="_blank"
rel="noopener">Help</a></li>
{% if MORPHODICT_DICTIONARY_NAME == "itwêwina" %}
<li><a href="{% url 'cree-dictionary-legend' %}" class="footer-links__link">Legend of abbreviations</a></li>
<li><a href="{% url 'dictionary-legend' %}" class="footer-links__link">Legend of abbreviations</a></li>
{% endif %}
<li><a href="{% url 'cree-dictionary-about' %}" class="footer-links__link">About</a></li>
<li><a href="{% url 'cree-dictionary-contact-us' %}" class="footer-links__link">Contact us</a></li>
<li><a href="{% url 'dictionary-about' %}" class="footer-links__link">About</a></li>
<li><a href="{% url 'dictionary-contact-us' %}" class="footer-links__link">Contact us</a></li>
</ul>

<div class="footer__links footer__advanced-links">
<ul class="footer__links">
<li><a href="{% url 'cree-dictionary-settings' %}" class="footer-links__link">Settings</a></li>
<li><a href="{% url 'dictionary-settings' %}" class="footer-links__link">Settings</a></li>
</ul>

<h2 class="footer__option-header"> View search results with: </h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
Search quality
</a>
<ul class="navbar-nav ml-auto">
<a class="nav-link" href="{% url 'cree-dictionary-index' %}">View site</a>
<a class="nav-link" href="{% url 'dictionary-index' %}">View site</a>
<a class="nav-link" href="{% url 'admin:index' %}">Admin</a>
</ul>
</nav>
Expand Down
8 changes: 4 additions & 4 deletions src/morphodict/tests/API_tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
def test_click_in_text_correct_usage(client):
# niskak means goose in plains Cree
response = client.get(
reverse("cree-dictionary-word-click-in-text-api") + "?q=niskak"
reverse("dictionary-word-click-in-text-api") + "?q=niskak"
)

assert b"goose" in response.content


@pytest.mark.django_db
def test_click_in_text_no_params(client):
response = client.get(reverse("cree-dictionary-word-click-in-text-api"))
response = client.get(reverse("dictionary-word-click-in-text-api"))

assert response.status_code == 400

Expand All @@ -36,7 +36,7 @@ def test_normal_search_uses_affix_search(client):
should return both "wâpamêw" and "asawâpamêw"
"""
normal_search_response = client.get(
reverse("cree-dictionary-search") + f"?q={ASCII_WAPAMEW}"
reverse("dictionary-search") + f"?q={ASCII_WAPAMEW}"
).content.decode("utf-8")
assert EXPECTED_SUFFIX_SEARCH_RESULT in normal_search_response

Expand All @@ -52,6 +52,6 @@ def test_click_in_text_disables_affix_search(client):
should return "wâpamêw" but NOT "asawâpamêw"
"""
click_in_text_response = client.get(
reverse("cree-dictionary-word-click-in-text-api") + f"?q={ASCII_WAPAMEW}"
reverse("dictionary-word-click-in-text-api") + f"?q={ASCII_WAPAMEW}"
).content.decode("utf-8")
assert EXPECTED_SUFFIX_SEARCH_RESULT not in click_in_text_response
2 changes: 1 addition & 1 deletion src/morphodict/tests/test_orth_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_can_set_orth_cookie(orth, client, change_orth_url):
Test that POSTing to the URL actually sets the orthography.
"""
# By default, there should be no orth cookie.
index_url = reverse("cree-dictionary-index")
index_url = reverse("dictionary-index")
response = client.get(index_url)
assert response.status_code == 200
assert ORTHOGRAPHY.COOKIE_NAME not in response.cookies
Expand Down
16 changes: 8 additions & 8 deletions src/morphodict/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def test_paradigm_details_internal_wrong_method(self, method: str):
@pytest.mark.parametrize(
"url",
[
reverse("cree-dictionary-index"),
reverse("cree-dictionary-search") + "?q=kotiskâwêw",
reverse("cree-dictionary-about"),
reverse("cree-dictionary-contact-us"),
reverse("dictionary-index"),
reverse("dictionary-search") + "?q=kotiskâwêw",
reverse("dictionary-about"),
reverse("dictionary-contact-us"),
# Note: do NOT test word-detail page, as this page has tonnes of "errors"
# checking for things like is_title, is_label, is_heading, etc.
],
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_retrieve_paradigm(
if slug_disambiguator:
query_args["slug"] = slug_disambiguator
wf = Wordform.objects.get(text=lexeme, **query_args)
url = reverse("cree-dictionary-index-with-lemma", args=[wf.slug])
url = reverse("dictionary-index-with-lemma", args=[wf.slug])
response = client.get(url)

assert response.status_code == 200
Expand All @@ -137,7 +137,7 @@ def test_paradigm_from_full_page_and_api(client: Client):

# Get standalone page:
response = client.get(
reverse("cree-dictionary-index-with-lemma", args=[lemma_text]),
reverse("dictionary-index-with-lemma", args=[lemma_text]),
{"paradigm-size": paradigm_size},
)
assert response.status_code == HTTPStatus.OK
Expand All @@ -163,7 +163,7 @@ def test_paradigm_from_full_page_and_api(client: Client):


@pytest.mark.parametrize("mode", DisplayMode.choices)
@pytest.mark.parametrize("whence", [None, reverse("cree-dictionary-about")])
@pytest.mark.parametrize("whence", [None, reverse("dictionary-about")])
def test_change_display_mode_sets_cookie(mode, whence, client: Client):
"""
Changing the display mode should set some cookies and MAYBE do a redirect.
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_change_display_mode_sets_cookie(mode, whence, client: Client):


@pytest.mark.parametrize("option", DisplayMode.choices)
@pytest.mark.parametrize("whence", [None, reverse("cree-dictionary-about")])
@pytest.mark.parametrize("whence", [None, reverse("dictionary-about")])
def test_change_paradigm_label_preference(option, whence, client: Client):
"""
Changing the display mode should set some cookies and MAYBE do a redirect.
Expand Down
22 changes: 11 additions & 11 deletions src/morphodict/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@


# TODO: use URL namespaces:
# e.g., cree-dictionary:index instead of cree-dictionary-index
# e.g., dictionary:index instead of dictionary-index
# See: https://docs.djangoproject.com/en/2.2/topics/http/urls/#url-namespaces

urlpatterns = [
################################# Primary URLs #################################
path("", views.index, name="cree-dictionary-index"),
path("search", views.index, name="cree-dictionary-search"),
path("", views.index, name="dictionary-index"),
path("search", views.index, name="dictionary-search"),
# "word" is a user-friendly alternative for the linguistic term "lemma"
path(
"word/<str:slug>/",
views.entry_details,
name="cree-dictionary-index-with-lemma",
name="dictionary-index-with-lemma",
),
path("about", views.about, name="cree-dictionary-about"),
path("contact-us", views.contact_us, name="cree-dictionary-contact-us"),
path("query-help", views.query_help, name="cree-dictionary-query-help"),
path("legend", views.legend, name="cree-dictionary-legend"),
path("settings", views.settings_page, name="cree-dictionary-settings"),
path("admin/fst-tool", views.fst_tool, name="cree-dictionary-fst-tool"),
path("about", views.about, name="dictionary-about"),
path("contact-us", views.contact_us, name="dictionary-contact-us"),
path("query-help", views.query_help, name="dictionary-query-help"),
path("legend", views.legend, name="dictionary-legend"),
path("settings", views.settings_page, name="dictionary-settings"),
path("admin/fst-tool", views.fst_tool, name="dictionary-fst-tool"),
################################# Internal API #################################
# internal use to render boxes of search results
path(
"_search_results/<str:query_string>/",
views.search_results,
name="cree-dictionary-search-results",
name="dictionary-search-results",
),
# See morphodict.preference.urls for all available views
# Hint: You will probably use preference:change the most!
Expand Down
2 changes: 1 addition & 1 deletion src/morphodict/utils/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def url_for_query(user_query: str) -> str:
scheme="",
netloc="",
params="",
path=reverse("cree-dictionary-search"),
path=reverse("dictionary-search"),
query=urlencode((("q", user_query),)),
fragment="",
)
Expand Down

0 comments on commit 87d9eb7

Please sign in to comment.