File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed
Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ struct DocumentTypeEditView<Element>: View where Element: DocumentTypeProtocol {
4242 }
4343 . toolbar {
4444 ToolbarItem ( placement: . navigationBarTrailing) {
45- Button ( saveLabel) {
45+ SaveButton ( saveLabel) {
4646 do {
4747 try onSave ? ( element)
4848 } catch {
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ struct ManageView<Manager>: View where Manager: ManagerProtocol {
9393
9494 var body : some View {
9595 Manager . EditView ( element: element, onSave: onSaveInternal)
96+ . disabled ( !model. permissions. test ( . change) )
9697 }
9798 }
9899
@@ -194,6 +195,9 @@ struct ManageView<Manager>: View where Manager: ManagerProtocol {
194195 NavigationLink {
195196 Edit ( model: model, element: element) { element in
196197 guard model. permissions. test ( . change) else {
198+ Logger . shared. info (
199+ " Silently not saving from edit view: this likely indicates a button is active that shouldn't be "
200+ )
197201 return
198202 }
199203
Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ struct StoragePathEditView<Element>: View where Element: StoragePathProtocol {
5050
5151 . toolbar {
5252 ToolbarItem ( placement: . navigationBarTrailing) {
53- Button ( saveLabel) {
53+
54+ SaveButton ( saveLabel) {
5455 do {
5556 try onSave ? ( storagePath)
5657 } catch {
@@ -71,15 +72,10 @@ extension StoragePathEditView where Element == ProtoStoragePath {
7172 }
7273}
7374
74- struct EditStoragePath_Previews : PreviewProvider {
75- struct Container : View {
76- @State var path = ProtoStoragePath ( )
77- var body : some View {
78- StoragePathEditView ( element: path, onSave: { _ in } )
79- }
80- }
81-
82- static var previews : some View {
83- Container ( )
75+ #Preview {
76+ NavigationStack {
77+ StoragePathEditView < ProtoStoragePath > ( onSave: { _ in } )
78+ . navigationBarTitleDisplayMode ( . inline)
79+ . navigationTitle ( Text ( . localizable( . storagePathCreateTitle) ) )
8480 }
8581}
You can’t perform that action at this time.
0 commit comments