Generate first tag pages

This commit is contained in:
Christoph Hagen
2024-12-09 17:47:03 +01:00
parent 4f08526978
commit 8183bc4903
35 changed files with 719 additions and 1105 deletions

View File

@@ -1,7 +1,9 @@
import Foundation
final class Page: ObservableObject {
unowned let content: Content
/**
The unique id of the entry
*/
@@ -40,7 +42,8 @@ final class Page: ObservableObject {
@Published
var images: Set<String> = []
init(id: String,
init(content: Content,
id: String,
isDraft: Bool,
createdDate: Date,
startDate: Date,
@@ -48,6 +51,7 @@ final class Page: ObservableObject {
german: LocalizedPage,
english: LocalizedPage,
tags: [Tag]) {
self.content = content
self.id = id
self.isDraft = isDraft
self.createdDate = createdDate
@@ -65,6 +69,15 @@ final class Page: ObservableObject {
case .english: return english
}
}
func update(id newId: String) -> Bool {
guard content.storage.move(page: id, to: newId) else {
print("Failed to move file of page \(id)")
return false
}
id = newId
return true
}
}
extension Page: Identifiable {