Unified detail views, model
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user