39 lines
1.1 KiB
Swift
39 lines
1.1 KiB
Swift
|
//
|
||
|
// EditDocumentWindowController.swift
|
||
|
// MongoView
|
||
|
//
|
||
|
// Created by Shadowfacts on 4/6/20.
|
||
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Cocoa
|
||
|
import MongoSwift
|
||
|
|
||
|
class EditDocumentWindowController: NSWindowController {
|
||
|
|
||
|
private(set) var mongoController: MongoController!
|
||
|
private(set) var collection: DatabaseCollection!
|
||
|
private(set) var mongoDocument: Document!
|
||
|
|
||
|
var documentEdited: (() -> Void)?
|
||
|
|
||
|
convenience init(mongoController: MongoController, collection: DatabaseCollection, document: Document) {
|
||
|
self.init(windowNibName: "EditDocumentWindowController")
|
||
|
|
||
|
self.mongoController = mongoController
|
||
|
self.collection = collection
|
||
|
self.mongoDocument = document
|
||
|
}
|
||
|
|
||
|
override func windowDidLoad() {
|
||
|
super.windowDidLoad()
|
||
|
|
||
|
window!.title = "Edit \(collection.database).\(collection.name) Document"
|
||
|
|
||
|
let vc = EditDocumentViewController(mongoController: mongoController, collection: collection, document: mongoDocument)
|
||
|
vc.documentEdited = documentEdited
|
||
|
contentViewController = vc
|
||
|
}
|
||
|
|
||
|
}
|