Unified detail views, model
This commit is contained in:
@ -18,6 +18,10 @@ extension Content {
|
||||
!posts.contains { $0.id == id }
|
||||
}
|
||||
|
||||
func isNewIdForFile(_ id: String) -> Bool {
|
||||
!files.contains { $0.id == id }
|
||||
}
|
||||
|
||||
func isValidIdForTagOrPageOrPost(_ id: String) -> Bool {
|
||||
id.rangeOfCharacter(from: Content.disallowedCharactersInIds) == nil
|
||||
}
|
||||
@ -26,6 +30,13 @@ extension Content {
|
||||
id.rangeOfCharacter(from: Content.disallowedCharactersInFileIds) == nil
|
||||
}
|
||||
|
||||
func containsPage(withUrlComponent urlComponent: String) -> Bool {
|
||||
pages.contains {
|
||||
$0.german.urlString == urlComponent ||
|
||||
$0.english.urlString == urlComponent
|
||||
}
|
||||
}
|
||||
|
||||
func containsTag(withUrlComponent urlComponent: String) -> Bool {
|
||||
(tagOverview?.contains(urlComponent: urlComponent) ?? false) ||
|
||||
tags.contains { $0.contains(urlComponent: urlComponent) }
|
||||
|
Reference in New Issue
Block a user