Skip to content

Commit

Permalink
Make entire version create url conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
agjohnson committed Nov 20, 2020
1 parent 0fe01f6 commit 7b18370
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
18 changes: 13 additions & 5 deletions readthedocs/projects/urls/private.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Project URLs for authenticated users."""

from django.conf import settings
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic.base import RedirectView
Expand Down Expand Up @@ -82,11 +83,6 @@
ProjectVersionDeleteHTML.as_view(),
name='project_version_delete_html',
),
url(
r'^(?P<project_slug>[-\w]+)/version/create/$',
ProjectVersionCreate.as_view(),
name='project_version_create',
),
url(
r'^(?P<project_slug>[-\w]+)/version/(?P<version_slug>[^/]+)/edit/$',
ProjectVersionDetail.as_view(),
Expand Down Expand Up @@ -152,6 +148,18 @@
),
]

# TODO move this up to the list above when it's not a conditional URL.
# Currently, this is only used by the new theme, we don't allow for "create" in
# our current templates.
if settings.RTD_EXT_THEME_ENABLED:
urlpatterns.append(
url(
r'^(?P<project_slug>[-\w]+)/version/create/$',
ProjectVersionCreate.as_view(),
name='project_version_create',
),
)

domain_urls = [
url(
r'^(?P<project_slug>[-\w]+)/domains/$',
Expand Down
6 changes: 2 additions & 4 deletions readthedocs/templates/projects/project_version_submit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

<p>
<input style="display: inline;" type="submit" value="{% trans "Save" %}">
{% if version %}
{% trans "or" %}
<a href="{% url "wipe_version" version.project.slug version.slug %}">{% trans "wipe "%}</a>
{% endif %}
{% trans "or" %}
<a href="{% url "wipe_version" version.project.slug version.slug %}">{% trans "wipe "%}</a>
</p>

0 comments on commit 7b18370

Please sign in to comment.