mirror of
https://github.com/gramps-project/gramps-web.git
synced 2026-10-16 21:01:38 +08:00
Allow creating places and sources from more selectors (#1517)
Enable inline creation on the place selector of the New Event dialog and view, the place selector of the event details and place reference dialogs, and the source selector of the citation details dialog. The Enclosed By selector of the New Place view allows it too, but not when the New Place form is itself the create dialog of an object selector, so that inline creation stays one dialog deep. Part of #1183.
This commit is contained in:
@@ -31,6 +31,7 @@ class GrampsjsFormEditCitationDetails extends GrampsjsObjectForm {
|
|||||||
<grampsjs-form-select-object-list
|
<grampsjs-form-select-object-list
|
||||||
id="source"
|
id="source"
|
||||||
objectType="source"
|
objectType="source"
|
||||||
|
allowNew
|
||||||
.objectsInitial="${this.data.source_handle
|
.objectsInitial="${this.data.source_handle
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class GrampsjsFormEditEventDetails extends GrampsjsObjectForm {
|
|||||||
fixedMenuPosition
|
fixedMenuPosition
|
||||||
style="min-height: 300px;"
|
style="min-height: 300px;"
|
||||||
objectType="place"
|
objectType="place"
|
||||||
|
allowNew
|
||||||
.appState="${this.appState}"
|
.appState="${this.appState}"
|
||||||
id="place"
|
id="place"
|
||||||
label="${this._('Select')}"
|
label="${this._('Select')}"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class GrampsjsFormPlaceRef extends GrampsjsObjectForm {
|
|||||||
notDeletable
|
notDeletable
|
||||||
style="min-height: 300px;"
|
style="min-height: 300px;"
|
||||||
objectType="place"
|
objectType="place"
|
||||||
|
allowNew
|
||||||
.objectsInitial="${this.data.ref
|
.objectsInitial="${this.data.ref
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export const GrampsjsNewEventMixin = superClass =>
|
|||||||
fixedMenuPosition
|
fixedMenuPosition
|
||||||
id="place"
|
id="place"
|
||||||
objectType="place"
|
objectType="place"
|
||||||
|
allowNew
|
||||||
.appState="${this.appState}"
|
.appState="${this.appState}"
|
||||||
></grampsjs-form-select-object-list>
|
></grampsjs-form-select-object-list>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ export const GrampsjsNewPlaceMixin = superClass =>
|
|||||||
super()
|
super()
|
||||||
this.data = {_class: 'Place'}
|
this.data = {_class: 'Place'}
|
||||||
this._latLongDialogOpen = false
|
this._latLongDialogOpen = false
|
||||||
|
// Off in the create dialog of an object selector, so that inline
|
||||||
|
// creation stays one dialog deep.
|
||||||
|
this.allowNewEnclosedBy = false
|
||||||
}
|
}
|
||||||
|
|
||||||
renderForm() {
|
renderForm() {
|
||||||
@@ -58,6 +61,7 @@ export const GrampsjsNewPlaceMixin = superClass =>
|
|||||||
id="enclosed"
|
id="enclosed"
|
||||||
multiple
|
multiple
|
||||||
objectType="place"
|
objectType="place"
|
||||||
|
?allowNew="${this.allowNewEnclosedBy}"
|
||||||
.appState="${this.appState}"
|
.appState="${this.appState}"
|
||||||
></grampsjs-form-select-object-list>
|
></grampsjs-form-select-object-list>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export class GrampsjsViewNewPlace extends GrampsjsNewPlaceMixin(
|
|||||||
this.postUrl = '/api/places/'
|
this.postUrl = '/api/places/'
|
||||||
this.itemPath = 'place'
|
this.itemPath = 'place'
|
||||||
this.objClass = 'Place'
|
this.objClass = 'Place'
|
||||||
|
this.allowNewEnclosedBy = true
|
||||||
}
|
}
|
||||||
|
|
||||||
renderContent() {
|
renderContent() {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import {describe, it, expect} from 'vitest'
|
||||||
|
import {GrampsjsFormNewPlace} from '../../src/components/GrampsjsFormNewPlace.js'
|
||||||
|
import {GrampsjsViewNewPlace} from '../../src/views/GrampsjsViewNewPlace.js'
|
||||||
|
|
||||||
|
describe('new place: creating the enclosing place', () => {
|
||||||
|
it('is offered in the New Place view', () => {
|
||||||
|
expect(new GrampsjsViewNewPlace().allowNewEnclosedBy).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('is not offered in the create dialog of an object selector', () => {
|
||||||
|
expect(new GrampsjsFormNewPlace().allowNewEnclosedBy).toBe(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user