Fix id of Items, saving
This commit is contained in:
@ -72,11 +72,12 @@ struct FileDetailView: View {
|
||||
}
|
||||
|
||||
IdPropertyView(
|
||||
id: $file.id,
|
||||
id: $file.identifier,
|
||||
title: "Name",
|
||||
footer: "The unique name of the file, which is also used to reference it in posts and pages.",
|
||||
validation: file.isValid,
|
||||
update: { file.update(id: $0) })
|
||||
.id(file.id)
|
||||
|
||||
switch language {
|
||||
case .english:
|
||||
@ -154,7 +155,7 @@ struct FileDetailView: View {
|
||||
}
|
||||
|
||||
private func showFileInFinder() {
|
||||
content.storage.openFinderWindow(withSelectedFile: file.id)
|
||||
content.storage.openFinderWindow(withSelectedFile: file.identifier)
|
||||
}
|
||||
|
||||
private func markFileAsChanged() {
|
||||
@ -169,11 +170,11 @@ struct FileDetailView: View {
|
||||
|
||||
private func replaceFile() {
|
||||
guard let url = openFilePanel() else {
|
||||
print("File '\(file.id)': No file selected as replacement")
|
||||
print("File '\(file.identifier)': No file selected as replacement")
|
||||
return
|
||||
}
|
||||
guard content.storage.importExternalFile(at: url, fileId: file.id) else {
|
||||
print("File '\(file.id)': Failed to replace file")
|
||||
guard content.storage.importExternalFile(at: url, fileId: file.identifier) else {
|
||||
print("File '\(file.identifier)': Failed to replace file")
|
||||
return
|
||||
}
|
||||
|
||||
@ -197,7 +198,7 @@ struct FileDetailView: View {
|
||||
|
||||
let response = panel.runModal()
|
||||
guard response == .OK else {
|
||||
print("File '\(file.id)': Failed to select file to replace")
|
||||
print("File '\(file.identifier)': Failed to select file to replace")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -209,8 +210,8 @@ struct FileDetailView: View {
|
||||
return
|
||||
}
|
||||
|
||||
guard content.storage.removeFileContent(file: file.id) else {
|
||||
print("File '\(file.id)': Failed to delete file to make it external")
|
||||
guard content.storage.removeFileContent(file: file.identifier) else {
|
||||
print("File '\(file.identifier)': Failed to delete file to make it external")
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
@ -220,8 +221,8 @@ struct FileDetailView: View {
|
||||
}
|
||||
|
||||
private func deleteFile() {
|
||||
guard content.storage.delete(file: file.id) else {
|
||||
print("File '\(file.id)': Failed to delete file in content folder")
|
||||
guard content.storage.delete(file: file.identifier) else {
|
||||
print("File '\(file.identifier)': Failed to delete file in content folder")
|
||||
return
|
||||
}
|
||||
content.remove(file)
|
||||
|
Reference in New Issue
Block a user