mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-19 17:25:56 +02:00
renamed organization to portfolio, removed obsolete code
This commit is contained in:
parent
2315013ac7
commit
7072125992
9 changed files with 47 additions and 66 deletions
|
@ -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 Django’s built-in servers (e.g. `runserver`)
|
||||
|
|
|
@ -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/",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 %}
|
24
src/registrar/templates/portfolio.html
Normal file
24
src/registrar/templates/portfolio.html
Normal 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 %}
|
|
@ -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 %}
|
|
@ -1,8 +1,8 @@
|
|||
{% extends 'organization.html' %}
|
||||
{% extends 'portfolio.html' %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block organization_content %}
|
||||
{% block portfolio_content %}
|
||||
<h1>Domain requests</h1>
|
||||
|
||||
{% comment %}
|
|
@ -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>
|
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue