Skip to content

Commit

Permalink
Merge pull request #6230 from deNBI/fix/errors
Browse files Browse the repository at this point in the history
fix(Misc): News management input validation, unused code and checkbox-margin
  • Loading branch information
dweinholz authored Oct 9, 2024
2 parents 20977b5 + eef511e commit 1d3d4b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h5>Please select the facilities to load news from:</h5>
<div>
<div class="form-check-inline">
<input
class="form-check-input"
class="form-check-input mx-1"
type="checkbox"
id="selectAll"
(click)="selectAllFacilities()"
Expand All @@ -15,7 +15,7 @@ <h5>Please select the facilities to load news from:</h5>
</div>
<div *ngFor="let facility of managerFacilities" class="form-check-inline">
<input
class="form-check-input"
class="form-check-input mx-1"
type="checkbox"
id="select_{{ facility['Facility'] }}"
(click)="selectFacility(facility)"
Expand Down
18 changes: 0 additions & 18 deletions src/app/facility_manager/newsmanagement/news-manager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,4 @@ export class NewsManagerComponent implements OnInit, OnDestroy {
)
)
}

isNewsTitleValid(): boolean {
if (!this.selectedFacilityNews) return false

return this.selectedFacilityNews.title?.length >= 5
}

isNewsTextValid(): boolean {
if (!this.selectedFacilityNews) return false

return this.selectedFacilityNews.text?.length >= 25
}

isNewsMOTDValid(): boolean {
if (!this.selectedFacilityNews) return false

return this.selectedFacilityNews.motd?.length >= 15 && this.selectedFacilityNews.motd?.length <= 100
}
}
10 changes: 2 additions & 8 deletions src/app/pipe-module/pipes/news-valid.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { FacilityNews } from 'app/facility_manager/newsmanagement/facility-news'
})
export class NewsValidationPipe implements PipeTransform {
transform(news: FacilityNews): boolean {
if (news.is_current_motd) {
if (news.motd?.length < 15) return false
}
if (news.motd?.length < 15) return false

return news.title?.length >= 5 && news.text?.length >= 25
}
Expand Down Expand Up @@ -41,10 +39,6 @@ export class NewsTextValidationPipe implements PipeTransform {
})
export class NewsMOTDValidationPipe implements PipeTransform {
transform(news: FacilityNews): boolean {
if (news.is_current_motd) {
if (news.motd?.length < 15) return false
}

return true
return news.motd?.length >= 15
}
}

0 comments on commit 1d3d4b5

Please sign in to comment.