Repository: cal-itp/benefits

Issue:
Use approved logos for transit agencies
@srhhnry started a [thread](https://cal-itp.slack.com/archives/C013W8RUAMU/p1674155979096579) in Slack to get approved logos. Once they've been finalized in Figma, let's update the files and make sure they are sized correctly in the UI.

## Acceptance Criteria
- [ ] Logos in the agency selector modal dialog are sized and placed correctly for Desktop and Mobile



Discussion:

Resolving patch:
diff --git a/benefits/core/viewmodels.py b/benefits/core/viewmodels.py
--- a/benefits/core/viewmodels.py
+++ b/benefits/core/viewmodels.py
@@ -128,6 +128,30 @@ def __init__(self, icon: Icon, details, heading=None, bullets=None):
             self.bullets = bullets
 
 
+class Modal:
+    """
+    Represents a modal dialog, triggered by a button:
+    * id: str
+    * aria_labelledby_id: str
+    * button_text: str
+    """
+
+    def __init__(self, **kwargs):
+        self.id = kwargs.get("id")
+        self.aria_labelledby_id = kwargs.get("aria_labelledby_id")
+        self.button_text = kwargs.get("button_text")
+
+
+class AgencySelector(Modal):
+    """
+    Represents the agency selector modal dialog.
+    """
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+        self.agencies = [TransitAgency(a) for a in models.TransitAgency.all_active()]
+
+
 class Page:
     """
     Represents a page of content:
@@ -139,6 +163,7 @@ class Page:
     * forms: django.forms.Form[]
     * button: core.viewmodels.Button
     * buttons: core.viewmodels.Button[]
+    * modal: core.viewmodels.Modal
     * classes: str[]
     """
 
@@ -163,6 +188,9 @@ def __init__(self, **kwargs):
         if "button" in kwargs:
             self.buttons.append(kwargs.get("button"))
 
+        if "modal" in kwargs:
+            self.modal = kwargs.get("modal")
+
         self.classes = kwargs.get("classes", [])
         if not isinstance(self.classes, list):
             self.classes = self.classes.split(" ")
@@ -269,6 +297,7 @@ def __init__(self, model):
             self.merchant_id = model.merchant_id
             self.info_url = model.info_url
             self.phone = model.phone
+            self.eligibility_index_url = model.eligibility_index_url
 
     def context_dict(self):
         """Return a context dict for a TransitAgency."""
diff --git a/benefits/core/views.py b/benefits/core/views.py
--- a/benefits/core/views.py
+++ b/benefits/core/views.py
@@ -2,7 +2,6 @@
 The core application: view definition for the root of the webapp.
 """
 from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound, HttpResponseServerError
-from django.shortcuts import redirect
 from django.template import loader
 from django.template.response import TemplateResponse
 from django.urls import reverse
@@ -16,7 +15,7 @@
 ROUTE_HELP = "core:help"
 ROUTE_LOGGED_OUT = "core:logged_out"
 
-TEMPLATE_PAGE = "core/page.html"
+TEMPLATE_INDEX = "core/index.html"
 TEMPLATE_AGENCY = "core/agency_index.html"
 TEMPLATE_HELP = "core/help.html"
 TEMPLATE_LOGGED_OUT = "core/logged_out.html"
@@ -27,25 +26,17 @@ def index(request):
     """View handler for the main entry page."""
     session.reset(request)
 
-    agencies = models.TransitAgency.all_active()
-
-    if len(agencies) == 1:
-        agency = agencies[0]
-        return redirect(agency.index_url)
-
-    # generate a button to the landing page for each active agency
-    buttons = [viewmodels.Button.outline_primary(text=a.short_name, url=a.eligibility_index_url) for a in agencies]
-    buttons[0].classes.append("mt-3")
-    buttons[0].label = _("core.pages.index.chooseprovider")
-
     page = viewmodels.Page(
         title=_("core.pages.index.title"),
         headline=_("core.pages.index.headline"),
-        buttons=buttons,
-        classes="home",
+        modal=viewmodels.AgencySelector(
+            id="agency-selector",
+            aria_labelledby_id="agency-selector-modal-label",
+            button_text=_("core.pages.index.button"),
+        ),
     )
 
-    return TemplateResponse(request, TEMPLATE_PAGE, page.context_dict())
+    return TemplateResponse(request, TEMPLATE_INDEX, page.context_dict())
 
 
 @pageview_decorator
@@ -60,7 +51,6 @@ def agency_index(request, agency):
         title=_("core.pages.agency_index.title"),
         headline=_("core.pages.agency_index.mst_cc.headline"),
         button=button,
-        classes="home",
     )
 
     return TemplateResponse(request, TEMPLATE_AGENCY, page.context_dict())
diff --git a/benefits/settings.py b/benefits/settings.py
--- a/benefits/settings.py
+++ b/benefits/settings.py
@@ -262,6 +262,8 @@ def _filter_empty(ls):
 
 CSP_DEFAULT_SRC = ["'self'"]
 
+CSP_IMG_SRC = ["'self'", "data:"]
+
 CSP_CONNECT_SRC = ["'self'", "https://api.amplitude.com/"]
 env_connect_src = _filter_empty(os.environ.get("DJANGO_CSP_CONNECT_SRC", "").split(","))
 CSP_CONNECT_SRC.extend(env_connect_src)


Test patch:
diff --git a/tests/pytest/core/test_views.py b/tests/pytest/core/test_views.py
--- a/tests/pytest/core/test_views.py
+++ b/tests/pytest/core/test_views.py
@@ -4,7 +4,15 @@
 
 from benefits.core.models import EligibilityVerifier, TransitAgency
 import benefits.core.session
-from benefits.core.views import ROUTE_INDEX, ROUTE_HELP, ROUTE_LOGGED_OUT, TEMPLATE_AGENCY, bad_request, csrf_failure
+from benefits.core.views import (
+    ROUTE_INDEX,
+    ROUTE_HELP,
+    ROUTE_LOGGED_OUT,
+    TEMPLATE_INDEX,
+    TEMPLATE_AGENCY,
+    bad_request,
+    csrf_failure,
+)
 
 
 ROUTE_AGENCY = "core:agency_index"
@@ -47,8 +55,8 @@ def test_index_single_agency(mocker, model_TransitAgency, client, session_reset_
     response = client.get(path)
 
     session_reset_spy.assert_called_once()
-    assert response.status_code == 302
-    assert response.url == model_TransitAgency.index_url
+    assert response.status_code == 200
+    assert response.template_name == TEMPLATE_INDEX
 
 
 @pytest.mark.django_db