Skip to content

Commit

Permalink
Merge pull request #653 from Gary-Community-Ventures/dev
Browse files Browse the repository at this point in the history
Release 12/3/2024
  • Loading branch information
CalebPena authored Dec 6, 2024
2 parents afdae98 + ea63440 commit a572580
Show file tree
Hide file tree
Showing 50 changed files with 3,276 additions and 8,700 deletions.
2 changes: 1 addition & 1 deletion authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def update(self, request, pk=None):
user: User = screen.user

try:
Integration = get_cms_integration()
Integration = get_cms_integration(screen.white_label)
integration = Integration(user, screen)
message = MessageUser(screen, screen.get_language_code())

Expand Down
9 changes: 8 additions & 1 deletion configuration/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ class ConfigurationAdmin(ModelAdmin):
"widget": JSONEditorWidget(options={"modes": ["tree", "code"], "mode": "tree", "enableDrag": False})
},
}
search_fields = ("name",)
search_fields = ("name", "white_label__name")
list_display = ("name", "white_label_name")

def white_label_name(self, obj):
return obj.white_label.name

white_label_name.admin_order_field = "white_label__name"
white_label_name.short_description = "White Label"

# Convert the JSON string to a dictionary
# This makes it so that the JSON data coming from the 'data' field of the Configuration model
Expand Down
3,078 changes: 160 additions & 2,918 deletions configuration/management/commands/add_config.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion configuration/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from . import views

router = routers.DefaultRouter()
router.register(r"configuration", views.ConfigurationView)
router.register(r"configuration/(?P<white_label>.+)", views.ConfigurationView, basename="Configuration")

urlpatterns = [
path("", include(router.urls)),
Expand Down
7 changes: 4 additions & 3 deletions configuration/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ class ConfigurationView(viewsets.ReadOnlyModelViewSet):
API endpoint that allows configurations to be viewed.
"""

queryset = Configuration.objects.filter(active=True)
serializer_class = ConfigurationSerializer

permission_classes = [permissions.DjangoModelPermissions]

def get_queryset(self):
return Configuration.objects.filter(active=True, white_label__code=self.kwargs["white_label"])

def retrieve(self, request, pk=None):
configuration = get_object_or_404(self.queryset, name=pk)
configuration = get_object_or_404(self.get_queryset(), name=pk)
serializer = ConfigurationSerializer(configuration)
return Response(serializer.data)
11 changes: 11 additions & 0 deletions configuration/white_labels/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from ._default import DefaultConfigurationData
from .base import ConfigurationData
from .co import CoConfigurationData
from .nc import NcConfigurationData


white_label_config: dict[str, ConfigurationData] = {
"co": CoConfigurationData,
"nc": NcConfigurationData,
"_default": DefaultConfigurationData,
}
68 changes: 68 additions & 0 deletions configuration/white_labels/_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from .base import ConfigurationData
from screener.models import WhiteLabel


class DefaultConfigurationData(ConfigurationData):
is_default = True

@classmethod
def get_white_label(self) -> WhiteLabel:
return WhiteLabel.objects.get(code="_default")

referrer_data = {
"theme": {"default": "default"},
"logoSource": {"default": ""},
"logoAlt": {
"default": {"id": "referrerHook.logoAlts.default", "defaultMessage": "MyFriendBen home page button"}
},
"logoFooterSource": {"default": "MFB_Logo"},
"logoFooterAlt": {"default": {"id": "footer.logo.alt", "defaultMessage": "MFB Logo"}},
"logoClass": {"default": "logo"},
"twoOneOneLink": {
"default": 'https://www.211colorado.org/?utm_source=myfriendben&utm_medium=inlink&utm_campaign=organic&utm_id="211mfb"'
},
"shareLink": {"default": "https://screener.myfriendben.org"},
"stepDirectory": {
"default": [
"zipcode",
# the hhSize and hhData have to be consecutive
"householdSize",
"householdData",
"hasExpenses",
"householdAssets",
"hasBenefits",
"acuteHHConditions",
"referralSource",
"signUpInfo",
]
},
}

footer_data = {
"address_one": "1705 17th St.",
"address_two": "Suite 200",
"city": "Denver",
"state": "CO",
"zip_code": "80202",
"email": "myfriendben@garycommunity.org",
"privacy_policy_link": "https://co.myfriendben.org/privacy-policy/",
}

language_options = {
"en-us": "English",
"es": "Español",
"vi": "Tiếng Việt",
"fr": "Français",
"am": "አማርኛ",
"so": "Soomaali",
"ru": "Русский",
"ne": "नेपाली",
"my": "မြန်မာဘာသာစကား",
"zh": "中文",
"ar": "عربي",
}

feedback_links = {
"email": "mailto: myfriendben@garycommunity.org",
"survey": "https://docs.google.com/forms/d/e/1FAIpQLSdnfqjvlVSBQkJuUMvhEDUp-t6oD-8tPQi67uRG2iNetXmSfA/viewform?usp=sf_link",
}
Loading

0 comments on commit a572580

Please sign in to comment.