Skip to content

Commit

Permalink
donation modal followups (#1701)
Browse files Browse the repository at this point in the history
* followups to the donate modal look and feel, and tests
  • Loading branch information
Pomax committed Aug 1, 2018
1 parent 32c0cac commit 253e21b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
3 changes: 3 additions & 0 deletions env.default
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ CSP_MEDIA_SRC="'self'"
CSP_CHILD_SRC='self' https://www.youtube.com/ https://s3.amazonaws.com/
CSP_FORM_ACTION='self' https://www.mozilla.org/en-US/newsletter/

# TEST ENVIRONMENT VALUES

PETITION_TEST_CAMPAIGN_ID=""

# REVIEW APPS SLACK BOT

Expand Down
10 changes: 7 additions & 3 deletions network-api/networkapi/management/commands/load_fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
CampaignPageFactory,
HomepageFeaturedNewsFactory,
HomepageFeaturedHighlightsFactory,
ParticipatePageFactory
ParticipatePageFactory,
DonationModalsFactory,
)
from networkapi.buyersguide.factory import ProductFactory

Expand Down Expand Up @@ -111,7 +112,7 @@ def handle(self, *args, **options):
print('Generating five InternetHealthIssue')
[InternetHealthIssue.objects.get_or_create(name=e) for e in internet_health_issues]

print('Generating News')
print('Generating Fake News')
generate_fake_data(NewsFactory, 10)

print('Generating highlights')
Expand Down Expand Up @@ -217,7 +218,10 @@ def handle(self, *args, **options):
campaign_namespace = MiniSiteNameSpaceFactory.create(parent=home_page, title='campaigns', live=False)

print('Generating Campaign Pages under namespace')
[CampaignPageFactory.create(parent=campaign_namespace) for i in range(5)]
campaigns = [CampaignPageFactory.create(parent=campaign_namespace) for i in range(5)]

print('Generating Donation Modals for Campaign Pages')
[DonationModalsFactory.create(page=campaign) for campaign in campaigns]

try:
wagtailpages_models.CampaignPage.objects.get(title='single-page')
Expand Down
4 changes: 4 additions & 0 deletions network-api/networkapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
FILEBROWSER_DIRECTORY=(str, ''),
HEROKU_APP_NAME=(str, ''),
NETWORK_SITE_URL=(str, ''),
PETITION_TEST_CAMPAIGN_ID=(str, ''),
PULSE_API_DOMAIN=(str, ''),
PULSE_DOMAIN=(str, ''),
SET_HSTS=bool,
Expand Down Expand Up @@ -485,3 +486,6 @@ def show_toolbar(request):

# REQUIRED FOR AS LONG AS MEZZANINE HAS NOT BEEN FULLY PURGED
TESTING = False

# Used by load_fake_data to ensure we have petitions that actually work
PETITION_TEST_CAMPAIGN_ID = env('PETITION_TEST_CAMPAIGN_ID')
18 changes: 18 additions & 0 deletions network-api/networkapi/wagtailpages/factory.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from factory.django import DjangoModelFactory
from wagtail_factories import (
PageFactory,
Expand Down Expand Up @@ -39,6 +40,23 @@ class PetitionFactory(CTAFactory):
class Meta:
model = networkapi.wagtailpages.models.Petition

campaign_id = settings.PETITION_TEST_CAMPAIGN_ID


class DonationModalFactory(DjangoModelFactory):
class Meta:
model = networkapi.wagtailpages.donation_modal.DonationModal

name = Faker('text', max_nb_chars=20)


class DonationModalsFactory(DjangoModelFactory):
# note: plural!
class Meta:
model = networkapi.wagtailpages.donation_modal.DonationModals

donation_modal = SubFactory(DonationModalFactory)


class SignupFactory(CTAFactory):
class Meta:
Expand Down
6 changes: 3 additions & 3 deletions source/js/components/petition/donation-modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DonationModal extends React.Component {
return (
<div className="modal-content" tabIndex="0">
<div className="modal-header text-right">
<button className="close" data-dismiss="modal" aria-label="Close" onClick={e => this.props.onClose(e)}>
<button className="close" data-dismiss="modal" aria-label="Close" onClick={e => this.props.onClose(e)} tabIndex="0">
<span aria-hidden="true">&times;</span>
</button>
</div>
Expand All @@ -81,13 +81,13 @@ class DonationModal extends React.Component {
</div>

<div className="text-center">
<a className="btn btn-normal" href={this.donateURL} target="_blank" onClick={e => this.userElectedToDonate(e)}>
<a className="btn btn-normal" href={this.donateURL} target="_blank" onClick={e => this.userElectedToDonate(e)} tabIndex="0">
{this.props.donateText}
</a>
</div>

<div className="text-center">
<button className="text dismiss" data-dismiss="modal" onClick={e => this.userElectedToShare(e)}>
<button className="text dismiss" data-dismiss="modal" onClick={e => this.userElectedToShare(e)} tabIndex="0">
{this.props.shareText}
</button>
</div>
Expand Down
8 changes: 6 additions & 2 deletions source/js/components/petition/donation-modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
padding: 0.5rem 0.5rem 0 0;

.close {
float: right;
position: absolute;
right: 0.5rem;
width: 44px;
height: 44px;
text-align: center;
font-size: 2.5rem;
font-weight: normal;
line-height: 1;
Expand All @@ -42,7 +46,7 @@

.modal-body {
margin-top: 0;
padding-top: 0;
padding-top: 1rem;
}

.modal-footer {
Expand Down

0 comments on commit 253e21b

Please sign in to comment.