mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
fixed UI for relation definition
This commit is contained in:
parent
2089c32839
commit
194ce4f10f
@ -57,12 +57,12 @@ function AttributesModel() {
|
|||||||
for (const attr of attributes) {
|
for (const attr of attributes) {
|
||||||
attr.labelValue = attr.type === 'label' ? attr.value : '';
|
attr.labelValue = attr.type === 'label' ? attr.value : '';
|
||||||
attr.relationValue = attr.type === 'relation' ? attr.value : '';
|
attr.relationValue = attr.type === 'relation' ? attr.value : '';
|
||||||
attr.labelDefinition = attr.type === 'label-definition' ? JSON.parse(attr.value) : {
|
attr.labelDefinition = (attr.type === 'label-definition' && attr.value) ? JSON.parse(attr.value) : {
|
||||||
labelType: "text",
|
labelType: "text",
|
||||||
multiplicityType: "singlevalue",
|
multiplicityType: "singlevalue",
|
||||||
isPromoted: true
|
isPromoted: true
|
||||||
};
|
};
|
||||||
attr.relationDefinition = attr.type === 'relation-definition' ? JSON.parse(attr.value) : {
|
attr.relationDefinition = (attr.type === 'relation-definition' && attr.value) ? JSON.parse(attr.value) : {
|
||||||
multiplicityType: "singlevalue",
|
multiplicityType: "singlevalue",
|
||||||
isPromoted: true
|
isPromoted: true
|
||||||
};
|
};
|
||||||
@ -180,7 +180,11 @@ function AttributesModel() {
|
|||||||
isDeleted: 0,
|
isDeleted: 0,
|
||||||
position: 0,
|
position: 0,
|
||||||
labelDefinition: {
|
labelDefinition: {
|
||||||
valueType: "text",
|
labelType: "text",
|
||||||
|
multiplicityType: "singlevalue",
|
||||||
|
isPromoted: true
|
||||||
|
},
|
||||||
|
relationDefinition: {
|
||||||
multiplicityType: "singlevalue",
|
multiplicityType: "singlevalue",
|
||||||
isPromoted: true
|
isPromoted: true
|
||||||
}
|
}
|
||||||
@ -247,7 +251,7 @@ $dialog.on('focus', '.attribute-name', function (e) {
|
|||||||
$(this).autocomplete({
|
$(this).autocomplete({
|
||||||
source: async (request, response) => {
|
source: async (request, response) => {
|
||||||
const attribute = attributesModel.getTargetAttribute(this);
|
const attribute = attributesModel.getTargetAttribute(this);
|
||||||
const type = attribute().type === 'relation' ? 'relation' : 'label';
|
const type = (attribute().type === 'relation' || attribute().type === 'relation-definition') ? 'relation' : 'label';
|
||||||
const names = await server.get('attributes/names/?type=' + type + '&query=' + encodeURIComponent(request.term));
|
const names = await server.get('attributes/names/?type=' + type + '&query=' + encodeURIComponent(request.term));
|
||||||
const result = names.map(name => {
|
const result = names.map(name => {
|
||||||
return {
|
return {
|
||||||
|
@ -23,7 +23,7 @@ function setupTooltip() {
|
|||||||
if (note.type === 'text') {
|
if (note.type === 'text') {
|
||||||
callback(note.content);
|
callback(note.content);
|
||||||
}
|
}
|
||||||
else if (note.type === 'code') {console.log($("<pre>").text(note.content).html());
|
else if (note.type === 'code') {
|
||||||
callback($("<pre>").text(note.content).prop('outerHTML'));
|
callback($("<pre>").text(note.content).prop('outerHTML'));
|
||||||
}
|
}
|
||||||
// other types of notes don't have tooltip preview
|
// other types of notes don't have tooltip preview
|
||||||
|
@ -606,6 +606,12 @@
|
|||||||
|
|
||||||
<input type="checkbox" value="true" data-bind="checked: labelDefinition.isPromoted" /> Promoted
|
<input type="checkbox" value="true" data-bind="checked: labelDefinition.isPromoted" /> Promoted
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div data-bind="visible: type == 'relation-definition'">
|
||||||
|
<select data-bind="options: $parent.multiplicityTypes, optionsText: 'text', optionsValue: 'value', value: relationDefinition.multiplicityType"></select>
|
||||||
|
|
||||||
|
<input type="checkbox" value="true" data-bind="checked: relationDefinition.isPromoted" /> Promoted
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td title="Inheritable relations are automatically inherited to the child notes">
|
<td title="Inheritable relations are automatically inherited to the child notes">
|
||||||
<input type="checkbox" value="1" data-bind="checked: isInheritable" />
|
<input type="checkbox" value="1" data-bind="checked: isInheritable" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user