renamed organization to portfolio, removed obsolete code

This commit is contained in:
David Kennedy 2024-06-20 16:40:20 -04:00
parent 2315013ac7
commit 7072125992
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
9 changed files with 47 additions and 66 deletions

View file

@ -189,7 +189,7 @@ MIDDLEWARE = [
# Used for waffle feature flags
"waffle.middleware.WaffleMiddleware",
"registrar.registrar_middleware.CheckUserProfileMiddleware",
"registrar.registrar_middleware.CheckOrganizationMiddleware",
"registrar.registrar_middleware.CheckPortfolioMiddleware",
]
# application object used by Djangos built-in servers (e.g. `runserver`)

View file

@ -25,7 +25,7 @@ from registrar.views.domain_request import Step
from registrar.views.domain_requests_json import get_domain_requests_json
from registrar.views.domains_json import get_domains_json
from registrar.views.utility import always_404
from registrar.views.organizations import organization_domains, organization_domain_requests
from registrar.views.portfolios import portfolio_domains, portfolio_domain_requests
from api.views import available, get_current_federal, get_current_full
@ -60,14 +60,14 @@ for step, view in [
urlpatterns = [
path("", views.index, name="home"),
path(
"organization/<int:portfolio_id>/domains/",
organization_domains,
name="organization-domains",
"portfolio/<int:portfolio_id>/domains/",
portfolio_domains,
name="portfolio-domains",
),
path(
"organization/<int:portfolio_id>/domain_requests/",
organization_domain_requests,
name="organization-domain-requests",
"portfolio/<int:portfolio_id>/domain_requests/",
portfolio_domain_requests,
name="portfolio-domain-requests",
),
path(
"admin/logout/",

View file

@ -125,10 +125,10 @@ class CheckUserProfileMiddleware:
return None
class CheckOrganizationMiddleware:
class CheckPortfolioMiddleware:
"""
Checks if the current user has a portfolio
If they do, redirect them to the org homepage when they navigate to home.
If they do, redirect them to the portfolio homepage when they navigate to home.
"""
def __init__(self, get_response):
@ -150,8 +150,8 @@ class CheckOrganizationMiddleware:
user_portfolios = Portfolio.objects.filter(creator=request.user)
if user_portfolios.exists():
first_portfolio = user_portfolios.first()
home_organization_with_portfolio = reverse(
"organization-domains", kwargs={"portfolio_id": first_portfolio.id}
home_with_portfolio = reverse(
"portfolio-domains", kwargs={"portfolio_id": first_portfolio.id}
)
return HttpResponseRedirect(home_organization_with_portfolio)
return HttpResponseRedirect(home_with_portfolio)
return None

View file

@ -1,43 +0,0 @@
{% extends 'home.html' %}
{% load static %}
{% block homepage_content %}
<div class="tablet:grid-col-12">
<div class="grid-row grid-gap">
<div class="tablet:grid-col-3">
{% include "organization_sidebar.html" with portfolio=portfolio %}
</div>
<div class="tablet:grid-col-9">
{% block messages %}
{% include "includes/form_messages.html" %}
{% endblock %}
{# Note: Reimplement commented out functionality #}
{% block organization_content %}
{% endblock %}
{# Note: Reimplement this after MVP #}
<!--
<section class="section--outlined tablet:grid-col-11 desktop:grid-col-10">
<h2>Archived domains</h2>
<p>You don't have any archived domains</p>
</section>
-->
<!-- Note: Uncomment below when this is being implemented post-MVP -->
<!-- <section class="tablet:grid-col-11 desktop:grid-col-10">
<h2 class="padding-top-1 mobile-lg:padding-top-3"> Export domains</h2>
<p>Download a list of your domains and their statuses as a csv file.</p>
<a href="{% url 'todo' %}" class="usa-button usa-button--outline">
Export domains as csv
</a>
</section>
-->
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,24 @@
{% extends 'home.html' %}
{% load static %}
{% block homepage_content %}
<div class="tablet:grid-col-12">
<div class="grid-row grid-gap">
<div class="tablet:grid-col-3">
{% include "portfolio_sidebar.html" with portfolio=portfolio %}
</div>
<div class="tablet:grid-col-9">
{% block messages %}
{% include "includes/form_messages.html" %}
{% endblock %}
{# Note: Reimplement commented out functionality #}
{% block portfolio_content %}
{% endblock %}
</div>
</div>
{% endblock %}

View file

@ -1,8 +1,8 @@
{% extends 'organization.html' %}
{% extends 'portfolio.html' %}
{% load static %}
{% block organization_content %}
{% block portfolio_content %}
<h1>Domains</h1>
{% include "includes/domains_table.html" with portfolio=portfolio %}
{% endblock %}

View file

@ -1,8 +1,8 @@
{% extends 'organization.html' %}
{% extends 'portfolio.html' %}
{% load static %}
{% block organization_content %}
{% block portfolio_content %}
<h1>Domain requests</h1>
{% comment %}

View file

@ -5,14 +5,14 @@
<h2 class="margin-top-0 text-semibold">{{ portfolio.organization_name }}</h2>
<ul class="usa-sidenav">
<li class="usa-sidenav__item">
{% url 'organization-domains' portfolio.id as url %}
{% url 'portfolio-domains' portfolio.id as url %}
<a href="{{ url }}" {% if request.path == url %}class="usa-current"{% endif %}>
Domains
</a>
</li>
<li class="usa-sidenav__item">
{% url 'organization-domain-requests' portfolio.id as url %}
{% url 'portfolio-domain-requests' portfolio.id as url %}
<a href="{{ url }}" {% if request.path == url %}class="usa-current"{% endif %}>
Domain requests
</a>

View file

@ -5,7 +5,7 @@ from django.contrib.auth.decorators import login_required
@login_required
def organization_domains(request, portfolio_id):
def portfolio_domains(request, portfolio_id):
context = {}
if request.user.is_authenticated:
@ -17,11 +17,11 @@ def organization_domains(request, portfolio_id):
portfolio = get_object_or_404(Portfolio, id=portfolio_id)
context["portfolio"] = portfolio
return render(request, "organization_domains.html", context)
return render(request, "portfolio_domains.html", context)
@login_required
def organization_domain_requests(request, portfolio_id):
def portfolio_domain_requests(request, portfolio_id):
context = {}
if request.user.is_authenticated:
@ -36,4 +36,4 @@ def organization_domain_requests(request, portfolio_id):
# This controls the creation of a new domain request in the wizard
request.session["new_request"] = True
return render(request, "organization_requests.html", context)
return render(request, "portfolio_requests.html", context)