diff --git a/frontend/src/components/unification/free_lu/FreeLuEdit.vue b/frontend/src/components/unification/free_lu/FreeLuEdit.vue index 3ee5dd6b06b16bc337cd1acd7cbce0ea86721e62..b9b4d2d807651d140d7449b88c08f1f8ade75d06 100644 --- a/frontend/src/components/unification/free_lu/FreeLuEdit.vue +++ b/frontend/src/components/unification/free_lu/FreeLuEdit.vue @@ -153,14 +153,19 @@ }, connect_lus_to_slowal_frame(frame_in_progress) { const frame_in_progress_lus = frame_in_progress ? frames2lexical_units([frame_in_progress]).map(l => { - l.pk = l.id; - l.display = l.str; + l.id = l.id; + l.str = l.str; return l; }) : []; - const frame_in_progress_lus_ids = new Set(frame_in_progress_lus.map(l => l.pk)); + const free_lus = this.free_lexical_units.map(l => { + l.id = l.pk; + l.str = l.display; + return l; + }); + const frame_in_progress_lus_ids = new Set(frame_in_progress_lus.map(l => l.id)); const lusSelect = function () { - return this.lexical_units.concat(this.free_lexical_units).concat(frame_in_progress_lus).map(lu => { - return `<label><input type="checkbox" ${frame_in_progress_lus_ids.has(lu.pk) ? 'checked' : ''} name="lus" value="${lu.pk}" /> ${lu.display}</label><br />`; + return free_lus.concat(frame_in_progress_lus).map(lu => { + return `<label><input type="checkbox" ${frame_in_progress_lus_ids.has(lu.id) ? 'checked' : ''} name="lus" value="${lu.id}" /> ${lu.str}</label><br />`; }).join(""); }.bind(this); @@ -207,7 +212,7 @@ }, attach_examples() { if (this.frame_in_progress) { - if (this.selectedLus) { + if (this.selectedLus && this.selectedLus.length > 0) { const examplesSelect = function () { return '<div class="attach-examples-table-wrapper-scroll-y attach-examples-custom-scrollbar"><table id="attach-examples" class="table table-bordered table-striped mb-0"><thead><tr class="font-weight-bold"><th></th><th>Zdanie</th><th>Źródło</th><th>Opinia</th></tr></thead>' + this.examples.map(example => { return `<tr><td><input type="checkbox" ${this.selectedLus && example.lu_ids.includes(this.selectedLus[0].id) ? 'checked' : ''} name="lus" value="${example.id}" /></td><td>${example.sentence}</td><td>${example.source}</td><td>${example.opinion}</td></tr>`;