Generate first tag pages
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user