Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #679 from open-apparel-registry/ki/make-facility-d…
Browse files Browse the repository at this point in the history
…escription-required

Require claim form facility description
  • Loading branch information
jwalgran committed Jul 16, 2019
2 parents 605fb31 + cdf6eab commit d06ace5
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add facility field changes to contributor notification emails [#649](https://github.com/open-apparel-registry/open-apparel-registry/pull/649)
- Add affiliations and certifications fields to claimed facility profile [#671](https://github.com/open-apparel-registry/open-apparel-registry/pull/671)
- Add product and production type to claimed facility profile [#680](https://github.com/open-apparel-registry/open-apparel-registry/pull/680)
- Make facility description required on claim a facility form [#679](https://github.com/open-apparel-registry/open-apparel-registry/pull/679)

### Deprecated

Expand Down
1 change: 1 addition & 0 deletions src/app/src/__tests__/utils.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ it('checks whether the claim a facility form is valid', () => {
companyName: 'companyName',
contactPerson: 'contactPerson',
phoneNumber: 'phoneNumber',
facilityDescription: 'facilityDescription',
preferredContactMethod: {
label: 'label',
value: 'value',
Expand Down
2 changes: 2 additions & 0 deletions src/app/src/components/ClaimFacilityFacilityInfoStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ function ClaimFacilityFacilityInfoStep({
<InputLabel htmlFor={descriptionFormField.id}>
<Typography variant="title">
{descriptionFormField.label}
<RequiredAsterisk />
</Typography>
</InputLabel>
<TextField
id={descriptionFormField.label}
error={isEmpty(facilityDescription)}
variant="outlined"
style={claimAFacilityFormStyles.textFieldStyles}
multiline
Expand Down
14 changes: 9 additions & 5 deletions src/app/src/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,14 @@ export const claimFacilityContactInfoStepIsValid = ({

export const isValidFacilityURL = url => isEmpty(url) || isURL(url, { protocols: ['http', 'https'] });

export const claimFacilityFacilityInfoStepIsValid = ({ companyName, website }) =>
every([
!isEmpty(companyName),
isValidFacilityURL(website),
]);
export const claimFacilityFacilityInfoStepIsValid = ({
companyName,
website,
facilityDescription,
}) => every([
!isEmpty(companyName),
isValidFacilityURL(website),
!isEmpty(facilityDescription),
]);

export const anyListItemMatchesAreInactive = ({ matches }) => some(matches, ['is_active', false]);
23 changes: 23 additions & 0 deletions src/django/api/migrations/0025_require_claim_form_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.0.13 on 2019-07-16 14:46

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0024_add_affiliations_and_certifications_to_facility_claim'),
]

operations = [
migrations.AlterField(
model_name='facilityclaim',
name='facility_description',
field=models.TextField(help_text='A description of the facility', verbose_name='description'),
),
migrations.AlterField(
model_name='historicalfacilityclaim',
name='facility_description',
field=models.TextField(help_text='A description of the facility', verbose_name='description'),
),
]
14 changes: 14 additions & 0 deletions src/django/api/migrations/0027_merge_20190716_2207.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 2.0.13 on 2019-07-16 22:07

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('api', '0026_add_product_and_production_types_to_facilityclaim'),
('api', '0025_require_claim_form_description'),
]

operations = [
]
2 changes: 1 addition & 1 deletion src/django/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class FacilityClaim(models.Model):
help_text='The website for the facility')
facility_description = models.TextField(
null=False,
blank=True,
blank=False,
verbose_name='description',
help_text='A description of the facility')
linkedin_profile = models.URLField(
Expand Down

0 comments on commit d06ace5

Please sign in to comment.