mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 10:16:13 +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
|
# Used for waffle feature flags
|
||||||
"waffle.middleware.WaffleMiddleware",
|
"waffle.middleware.WaffleMiddleware",
|
||||||
"registrar.registrar_middleware.CheckUserProfileMiddleware",
|
"registrar.registrar_middleware.CheckUserProfileMiddleware",
|
||||||
"registrar.registrar_middleware.CheckOrganizationMiddleware",
|
"registrar.registrar_middleware.CheckPortfolioMiddleware",
|
||||||
]
|
]
|
||||||
|
|
||||||
# application object used by Django’s built-in servers (e.g. `runserver`)
|
# 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.domain_requests_json import get_domain_requests_json
|
||||||
from registrar.views.domains_json import get_domains_json
|
from registrar.views.domains_json import get_domains_json
|
||||||
from registrar.views.utility import always_404
|
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
|
from api.views import available, get_current_federal, get_current_full
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ for step, view in [
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.index, name="home"),
|
path("", views.index, name="home"),
|
||||||
path(
|
path(
|
||||||
"organization/<int:portfolio_id>/domains/",
|
"portfolio/<int:portfolio_id>/domains/",
|
||||||
organization_domains,
|
portfolio_domains,
|
||||||
name="organization-domains",
|
name="portfolio-domains",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"organization/<int:portfolio_id>/domain_requests/",
|
"portfolio/<int:portfolio_id>/domain_requests/",
|
||||||
organization_domain_requests,
|
portfolio_domain_requests,
|
||||||
name="organization-domain-requests",
|
name="portfolio-domain-requests",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"admin/logout/",
|
"admin/logout/",
|
||||||
|
|
|
@ -125,10 +125,10 @@ class CheckUserProfileMiddleware:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class CheckOrganizationMiddleware:
|
class CheckPortfolioMiddleware:
|
||||||
"""
|
"""
|
||||||
Checks if the current user has a portfolio
|
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):
|
def __init__(self, get_response):
|
||||||
|
@ -150,8 +150,8 @@ class CheckOrganizationMiddleware:
|
||||||
user_portfolios = Portfolio.objects.filter(creator=request.user)
|
user_portfolios = Portfolio.objects.filter(creator=request.user)
|
||||||
if user_portfolios.exists():
|
if user_portfolios.exists():
|
||||||
first_portfolio = user_portfolios.first()
|
first_portfolio = user_portfolios.first()
|
||||||
home_organization_with_portfolio = reverse(
|
home_with_portfolio = reverse(
|
||||||
"organization-domains", kwargs={"portfolio_id": first_portfolio.id}
|
"portfolio-domains", kwargs={"portfolio_id": first_portfolio.id}
|
||||||
)
|
)
|
||||||
return HttpResponseRedirect(home_organization_with_portfolio)
|
return HttpResponseRedirect(home_with_portfolio)
|
||||||
return None
|
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 %}
|
{% load static %}
|
||||||
|
|
||||||
{% block organization_content %}
|
{% block portfolio_content %}
|
||||||
<h1>Domains</h1>
|
<h1>Domains</h1>
|
||||||
{% include "includes/domains_table.html" with portfolio=portfolio %}
|
{% include "includes/domains_table.html" with portfolio=portfolio %}
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,8 +1,8 @@
|
||||||
{% extends 'organization.html' %}
|
{% extends 'portfolio.html' %}
|
||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block organization_content %}
|
{% block portfolio_content %}
|
||||||
<h1>Domain requests</h1>
|
<h1>Domain requests</h1>
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
|
@ -5,14 +5,14 @@
|
||||||
<h2 class="margin-top-0 text-semibold">{{ portfolio.organization_name }}</h2>
|
<h2 class="margin-top-0 text-semibold">{{ portfolio.organization_name }}</h2>
|
||||||
<ul class="usa-sidenav">
|
<ul class="usa-sidenav">
|
||||||
<li class="usa-sidenav__item">
|
<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 %}>
|
<a href="{{ url }}" {% if request.path == url %}class="usa-current"{% endif %}>
|
||||||
Domains
|
Domains
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="usa-sidenav__item">
|
<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 %}>
|
<a href="{{ url }}" {% if request.path == url %}class="usa-current"{% endif %}>
|
||||||
Domain requests
|
Domain requests
|
||||||
</a>
|
</a>
|
|
@ -5,7 +5,7 @@ from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def organization_domains(request, portfolio_id):
|
def portfolio_domains(request, portfolio_id):
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
@ -17,11 +17,11 @@ def organization_domains(request, portfolio_id):
|
||||||
portfolio = get_object_or_404(Portfolio, id=portfolio_id)
|
portfolio = get_object_or_404(Portfolio, id=portfolio_id)
|
||||||
context["portfolio"] = portfolio
|
context["portfolio"] = portfolio
|
||||||
|
|
||||||
return render(request, "organization_domains.html", context)
|
return render(request, "portfolio_domains.html", context)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def organization_domain_requests(request, portfolio_id):
|
def portfolio_domain_requests(request, portfolio_id):
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
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
|
# This controls the creation of a new domain request in the wizard
|
||||||
request.session["new_request"] = True
|
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