Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapted for long names, improved styling #1827

Merged
merged 1 commit into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ INSERT INTO shelters (id, created_at, updated_at, name, address_street, address_
values (1, NOW(), NOW(), 'Shelter 1', 'Erdberg', 1, null, null, '1030', 'Wien', 'Right around the corner', 100);
INSERT INTO shelters (id, created_at, updated_at, name, address_street, address_houseNumber, address_stairway,
address_door, address_postalCode, address_city, note, persons_count)
values (2, NOW(), NOW(), 'Shelter 2', 'Erdberg', 2, null, null, '1030', 'Wien', null, 50);
values (2, NOW(), NOW(), 'Shelter 2 with a very long name', 'Erdberg', 2, '1', '10', '1030', 'Wien', null, 50);
INSERT INTO shelters (id, created_at, updated_at, name, address_street, address_houseNumber, address_stairway,
address_door, address_postalCode, address_city, note, persons_count)
values (3, NOW(), NOW(), 'Shelter 3', 'Erdberg', 3, null, null, '1030', 'Wien', null, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ <h4 class="text-white">Notschlafstellen auswählen</h4>
</c-col>
<c-col class="col-5 text-start">
<c-row>
<c-col class="text-start">
<c-col class="text-start text-wrap">
<strong>{{shelter.name}}</strong>
</c-col>
</c-row>
<c-row>
<c-col class="text-start text-wrap">
<label cFormCheckLabel [for]="'shelter-' + shelter.id">{{ formatShelterAddress(shelter) }}</label>
<label cFormCheckLabel [for]="'shelter-' + shelter.id">
{{ formatStreet(shelter) }}
<br>
{{ shelter.addressPostalCode }} {{ shelter.addressCity }}
</label>
</c-col>
</c-row>
</c-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ describe('SelectSheltersComponent', () => {
expect(component.showSelectSheltersModal).toBeFalse();
});

it('format shelter address', () => {
it('format street', () => {
const fixture = TestBed.createComponent(SelectSheltersComponent);
const component = fixture.componentInstance;

const address = component.formatShelterAddress(testShelters[0]);
const address = component.formatStreet(testShelters[0]);

expect(address).toBe('Test Street 1, Stiege A, Top B, 12345 Test City');
expect(address).toBe('Test Street 1, Stiege A, Top B');
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ export class SelectSheltersComponent implements OnInit {
this.showSelectSheltersModal = false;
}

formatShelterAddress(shelter: ShelterItem): string {
formatStreet(shelter: ShelterItem): string {
const addressFormatted = [
[shelter.addressStreet, shelter.addressHouseNumber].join(' ').trim(),
shelter.addressStairway ? 'Stiege ' + shelter.addressStairway : undefined,
shelter.addressDoor ? 'Top ' + shelter.addressDoor : undefined,
[shelter.addressPostalCode, shelter.addressCity].join(' ').trim()
shelter.addressDoor ? 'Top ' + shelter.addressDoor : undefined
]
.filter(value => value?.trim().length > 0)
.join(', ');
Expand Down