Unified detail views, model

This commit is contained in:
Christoph Hagen
2024-12-16 09:54:21 +01:00
parent 1e67a99866
commit 31d1ecb8bd
57 changed files with 853 additions and 954 deletions

View File

@@ -2,6 +2,8 @@ import Foundation
final class LocalizedTag: ObservableObject {
unowned let content: Content
@Published
var urlComponent: String
@@ -22,12 +24,14 @@ final class LocalizedTag: ObservableObject {
/// The original url in the previous site layout
let originalUrl: String?
init(urlComponent: String,
init(content: Content,
urlComponent: String,
name: String,
subtitle: String? = nil,
description: String? = nil,
thumbnail: FileResource? = nil,
originalUrl: String? = nil) {
self.content = content
self.urlComponent = urlComponent
self.name = name
self.subtitle = subtitle
@@ -35,4 +39,9 @@ final class LocalizedTag: ObservableObject {
self.linkPreviewImage = thumbnail
self.originalUrl = originalUrl
}
func isValid(urlComponent: String) -> Bool {
content.isValidIdForTagOrPageOrPost(urlComponent) &&
!content.containsTag(withUrlComponent: urlComponent)
}
}