Skip to content

Commit

Permalink
fix adding tabular attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Vinzenz Rosenkranz <[email protected]>
  • Loading branch information
v1r0x committed Aug 1, 2024
1 parent 7c474a0 commit a671111
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/EditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ public function addAttribute(Request $request) {
$purl = ThConcept::find($pid)->concept_url;
$childAttr->thesaurus_root_url = $purl;
}
$childAttr->restrictions = $col['restricted_types'];
if(array_key_exists('restricted_types', $col)) {
$childAttr->restrictions = $col['restricted_types'];
}
$childAttr->parent_id = $attr->id;
$childAttr->save();
}
Expand Down
21 changes: 9 additions & 12 deletions resources/js/components/attribute/Tabular.vue
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,10 @@
required: false,
default: false,
},
preview: {
required: false,
type: Boolean,
default: false,
},
previewData: {
previewColumns: {
required: false,
type: Object,
default: null,
default: _ => new Object(),
},
},
emits: ['change', 'expanded'],
Expand All @@ -311,8 +306,7 @@
selections,
attribute,
hideLinks,
preview,
previewData,
previewColumns,
} = toRefs(props);
// FETCH
Expand Down Expand Up @@ -510,9 +504,12 @@
initialValue: value.value,
});
const state = reactive({
isPreview: computed(_ => preview.value && previewData.value && Object.keys(previewData.value).length > 0),
columns: computed(_ => state.isPreview ? previewData.value : getAttribute(attribute.value.id).columns),
placeholderWidth: computed(_ => Object.keys(state.columns).length + 2),
isPreview: computed(_ => previewColumns.value && Object.keys(previewColumns.value).length > 0),
columns: computed(_ => state.isPreview ? previewColumns.value : getAttribute(attribute.value.id).columns),
placeholderWidth: computed(_ => {
const colCnt = state.columns ? Object.keys(state.columns).length : 0;
return colCnt + 2;
}),
selections: computed(_ => {
const list = {};
if(!state.columns || state.isPreview) return list;
Expand Down

0 comments on commit a671111

Please sign in to comment.