Skip to content

Commit

Permalink
Hide pick button in relation list if relation table is geometryless
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed May 8, 2024
1 parent 87ca994 commit d4c6cd8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions components/AttributeForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ class AttributeForm extends React.Component {
properties: {}
}, this.props.iface, mapPrefix, this.props.map.projection, newRelFeature => {
newRelFeature.__status__ = "empty";
if (editConfig.geomType === null) {
newRelFeature.geometry = null;
}
// If feature id is known, i.e. not when drawing new feature, set foreign key
if (this.props.editContext.action !== "Draw") {
newRelFeature.properties[this.state.relationTables[table].fk] = this.props.editContext.feature.id;
Expand Down
9 changes: 5 additions & 4 deletions components/QtDesignerForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,11 @@ class QtDesignerForm extends React.Component {
</div>
);
} else {
const featurebuttons = [
{key: 'Pick', icon: 'pick', label: LocaleUtils.trmsg("editing.pick")},
{key: 'Create', icon: 'editdraw', label: LocaleUtils.trmsg("editing.create")}
];
const featurebuttons = [];
if (feature.geometry !== null) {
featurebuttons.push({key: 'Pick', icon: 'pick', label: LocaleUtils.trmsg("editing.pick")});
}
featurebuttons.push({key: 'Create', icon: 'editdraw', label: LocaleUtils.trmsg("editing.create")});
return (<ButtonBar buttons={featurebuttons} forceLabel onClick={(action) => this.props.editRelationRecord(action, reltable, reldataset, index, displayField)} />);
}
} else {
Expand Down

0 comments on commit d4c6cd8

Please sign in to comment.