Skip to content

Commit

Permalink
Refs #13 - Allow eula to be empty; if empty, do not show or require c…
Browse files Browse the repository at this point in the history
…heckbox
  • Loading branch information
johan-fvh committed Jan 22, 2020
1 parent e7921fe commit 3dd5b42
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
18 changes: 18 additions & 0 deletions backend/core/migrations/0026_auto_20200122_0948.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.8 on 2020-01-22 09:48

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0025_service_unsubscribe_url'),
]

operations = [
migrations.AlterField(
model_name='service',
name='eula_url',
field=models.CharField(blank=True, max_length=255),
),
]
2 changes: 1 addition & 1 deletion backend/core/models/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Service(models.Model):
SensorAttribute, related_name='services',
help_text='At least one of these attributes must be included in any subscription to this service.')

eula_url = models.CharField(max_length=255)
eula_url = models.CharField(max_length=255, blank=True)
img_logo_url = models.CharField(max_length=255, null=True)
img_service_url = models.CharField(max_length=255, null=True)

Expand Down
20 changes: 11 additions & 9 deletions frontend/src/components/OfferedServiceCard/ServiceSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,23 @@ class ServiceSubscription extends Component {
/>
</div>
}
<hr/>
<CheckboxesSection
consentChecked={subscribed || consentChecked}
handleChange={this.handleCheckChange}
classes={classes}
disabled={subscribed}
termsAndConditions={service.eula_url}
/>
{service.eula_url && <>
<hr/>
<CheckboxesSection
consentChecked={subscribed || consentChecked}
handleChange={this.handleCheckChange}
classes={classes}
disabled={subscribed}
termsAndConditions={service.eula_url}
/>
</>}
</div>}

<BottomButton
variant={subscribed ? 'negative' : 'default'}
title={buttonTitle}
onClick={() => subscribed ? this.onUnsubscribeClick() : this.onSubscribeClick()}
disabled={!subscribed && (!consentChecked || !selectedAttributes.length)}
disabled={!subscribed && (!(consentChecked || !service.eula_url) || !selectedAttributes.length)}
loading={requesting}
/>

Expand Down

0 comments on commit 3dd5b42

Please sign in to comment.