-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 10328-percy-flags-date
- Loading branch information
Showing
39 changed files
with
735 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from wagtail import hooks | ||
from wagtail.admin.ui.tables import UpdatedAtColumn | ||
from wagtail.snippets.models import register_snippet | ||
from wagtail.snippets.views.snippets import SnippetViewSet, SnippetViewSetGroup | ||
|
||
from networkapi.donate_banner.models import DonateBanner | ||
from networkapi.wagtailcustomization.views.snippet_chooser import ( | ||
DefaultLocaleSnippetChooserViewSet, | ||
) | ||
from networkapi.wagtailpages.donation_modal import DonationModal | ||
|
||
|
||
# Customise DonateBanner Snippet admin listing to show extra columns. | ||
class DonateBannerViewSet(SnippetViewSet): | ||
model = DonateBanner | ||
icon = "form" # change as required | ||
menu_order = 100 | ||
description = "Donation Banner" | ||
menu_label = "Donation Banners" | ||
list_display = ["name", "cta_link", "is_active", UpdatedAtColumn()] | ||
|
||
|
||
# Customise chooser to only show the default language banners as options. | ||
# We do not want editors to select the translations as | ||
# localisation will be handled on the template instead. | ||
@hooks.register("register_admin_viewset") | ||
def register_donate_banner_chooser_viewset(): | ||
return DefaultLocaleSnippetChooserViewSet( | ||
"wagtailsnippetchoosers_custom_donatebanner", | ||
model=DonateBanner, | ||
url_prefix="donate_banner/chooser", | ||
) | ||
|
||
|
||
class DonationModalSnippetViewSet(SnippetViewSet): | ||
model = DonationModal | ||
icon = "newspaper" | ||
menu_order = 200 | ||
menu_label = "Newsletter Signups" | ||
menu_name = "Newsletter Signups" | ||
list_display = ( | ||
"name", | ||
"donate_text", | ||
"donate_url", | ||
"dismiss_text", | ||
) | ||
search_fields = ("name", "header", "body", "donate_text", "donate_url", "dismiss_text") | ||
|
||
|
||
class DonateViewSetGroup(SnippetViewSetGroup): | ||
items = ( | ||
DonateBannerViewSet, | ||
DonationModalSnippetViewSet, | ||
) | ||
menu_icon = "heart" | ||
menu_label = "Donate" | ||
menu_name = "Donate" | ||
menu_order = 1000 | ||
|
||
|
||
register_snippet(DonateViewSetGroup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...rk-api/networkapi/mozfest/migrations/0045_alter_newslettersignupwithbackground_options.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Generated by Django 4.2.9 on 2024-01-23 17:52 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("mozfest", "0044_configure_cards_per_row_on_listing_block"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="newslettersignupwithbackground", | ||
options={"ordering": ["name"], "verbose_name": "Mozfest Newsletter Signup"}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from wagtail.snippets.models import register_snippet | ||
from wagtail.snippets.views.snippets import SnippetViewSet, SnippetViewSetGroup | ||
|
||
from networkapi.events.models import TitoEvent | ||
from networkapi.mozfest.models import NewsletterSignupWithBackground, Ticket | ||
|
||
|
||
class TitoEventSnippetViewSet(SnippetViewSet): | ||
model = TitoEvent | ||
icon = "tito" | ||
menu_order = 000 | ||
menu_label = "Tito" | ||
menu_name = "Tito" | ||
list_display = ( | ||
"title", | ||
"event_id", | ||
) | ||
search_fields = ("title", "event_id", "newsletter_question_id") | ||
|
||
|
||
class TicketSnippetViewSet(SnippetViewSet): | ||
model = Ticket | ||
icon = "ticket" | ||
menu_order = 100 | ||
menu_label = "Tickets" | ||
menu_name = "Tickets" | ||
list_display = ( | ||
"name", | ||
"cost", | ||
"event", | ||
"sticker_text", | ||
) | ||
search_fields = ("name", "description", "cost", "button_text", "releases", "event", "sticker_text") | ||
|
||
|
||
class NewsletterSignupWithBackgroundSnippetViewSet(SnippetViewSet): | ||
model = NewsletterSignupWithBackground | ||
icon = "newspaper" | ||
menu_order = 200 | ||
menu_label = "Newsletter Signups" | ||
menu_name = "Newsletter Signups" | ||
list_display = ( | ||
"name", | ||
"newsletter", | ||
) | ||
search_fields = ("name", "header", "description", "newsletter") | ||
|
||
|
||
class MozfestViewSetGroup(SnippetViewSetGroup): | ||
items = (TitoEventSnippetViewSet, TicketSnippetViewSet, NewsletterSignupWithBackgroundSnippetViewSet) | ||
menu_icon = "mozfest" | ||
menu_label = "Mozfest" | ||
menu_name = "Mozfest" | ||
menu_order = 1300 | ||
|
||
|
||
register_snippet(MozfestViewSetGroup) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.