Use handler to generate NationBuilder URLs
instead of config function
This commit is contained in:
parent
a5e6dd0c96
commit
5d865ae8bf
|
@ -24,10 +24,9 @@
|
||||||
Common menus for NationBuilder
|
Common menus for NationBuilder
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from rattail_nationbuilder.nationbuilder.util import get_nationbuilder_url
|
|
||||||
|
|
||||||
|
|
||||||
def make_nationbuilder_menu(request):
|
def make_nationbuilder_menu(request):
|
||||||
|
app = request.rattail_config.get_app()
|
||||||
url = request.route_url
|
url = request.route_url
|
||||||
|
|
||||||
nationbuilder_menu = {
|
nationbuilder_menu = {
|
||||||
|
@ -47,7 +46,7 @@ def make_nationbuilder_menu(request):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
url = get_nationbuilder_url(request.rattail_config)
|
url = app.get_nationbuilder_handler().get_url()
|
||||||
if url:
|
if url:
|
||||||
nationbuilder_menu['items'].insert(
|
nationbuilder_menu['items'].insert(
|
||||||
0, {
|
0, {
|
||||||
|
|
|
@ -100,6 +100,18 @@ class NationBuilderCacheDonationView(NationBuilderMasterView):
|
||||||
|
|
||||||
f.set_type('amount', 'currency')
|
f.set_type('amount', 'currency')
|
||||||
|
|
||||||
|
def get_xref_buttons(self, donation):
|
||||||
|
buttons = super().get_xref_buttons(donation)
|
||||||
|
|
||||||
|
app = self.get_rattail_app()
|
||||||
|
nationbuilder = app.get_nationbuilder_handler()
|
||||||
|
url = nationbuilder.get_url()
|
||||||
|
if url:
|
||||||
|
url = f'{url}/admin/signups/{donation.donor_id}/donations/{donation.id}'
|
||||||
|
buttons.append(self.make_xref_button(url=url, text="View in NationBuilder"))
|
||||||
|
|
||||||
|
return buttons
|
||||||
|
|
||||||
|
|
||||||
def defaults(config, **kwargs):
|
def defaults(config, **kwargs):
|
||||||
base = globals()
|
base = globals()
|
||||||
|
|
Loading…
Reference in a new issue