Skip to content
Snippets Groups Projects
Commit 19b4f3b2 authored by dcz's avatar dcz
Browse files

Rolling buttons for selectional preferencies and lexical units

parent f34f1910
Branches
No related tags found
No related merge requests found
...@@ -53,6 +53,8 @@ Object.assign(LexicalUnitEdit, { ...@@ -53,6 +53,8 @@ Object.assign(LexicalUnitEdit, {
selectedSchemas: null, selectedSchemas: null,
selectedExamples: null, selectedExamples: null,
hidden_frames: [], hidden_frames: [],
lexicalUnitsVisible: true,
selectionalPreferenciesVisible: true
} }
}, },
components: {InfoTooltip, Spinner, UnificationFramePreview, SlowalFrameComponent, ExamplesComponent, SemanticsSchemataComponent, MeaningComponent}, components: {InfoTooltip, Spinner, UnificationFramePreview, SlowalFrameComponent, ExamplesComponent, SemanticsSchemataComponent, MeaningComponent},
...@@ -886,6 +888,18 @@ Object.assign(LexicalUnitEdit, { ...@@ -886,6 +888,18 @@ Object.assign(LexicalUnitEdit, {
slowal_frame.arguments = new_slowal_frame_arguments; slowal_frame.arguments = new_slowal_frame_arguments;
} }
} }
},
hideLexicalUnits() {
this.lexicalUnitsVisible = false;
},
showLexicalUnits() {
this.lexicalUnitsVisible = true;
},
hideSelectionalPreferencies() {
this.selectionalPreferenciesVisible = false;
},
showSelectionalPreferencies() {
this.selectionalPreferenciesVisible = true;
} }
}, },
mounted() { mounted() {
...@@ -956,7 +970,9 @@ export default LexicalUnitEdit; ...@@ -956,7 +970,9 @@ export default LexicalUnitEdit;
<div align="center"> <div align="center">
<div align="left" style="display: table;"> <div align="left" style="display: table;">
<div class="unifiedFrame mt-3" v-bind:data-frame_id="unified_frame.id" id="unified-frame-title" v-html="unified_frame_title"></div> <div class="unifiedFrame mt-3" v-bind:data-frame_id="unified_frame.id" id="unified-frame-title" v-html="unified_frame_title"></div>
<table v-if="unified_frame.id" id="unified-frame" class="m-0 table-borderless border border-secondary text-dark frame active"> <table v-if="unified_frame.id" id="unified-frame-opac" class="table-borderless">
<tr><td>
<table id="unified-frame" class="m-0 table-borderless border border-secondary text-dark frame active">
<tbody> <tbody>
<tr> <tr>
<th scope="row" class="py-2 px-1 text-secondary role-header">Role</th> <th scope="row" class="py-2 px-1 text-secondary role-header">Role</th>
...@@ -988,7 +1004,7 @@ export default LexicalUnitEdit; ...@@ -988,7 +1004,7 @@ export default LexicalUnitEdit;
</tr> </tr>
<tr> <tr v-if="selectionalPreferenciesVisible">
<th scope="row" class="py-0 px-1 text-secondary role-header">Selectional preferences</th> <th scope="row" class="py-0 px-1 text-secondary role-header">Selectional preferences</th>
<td class="preferences py-0 px-0 border-top border-left border-secondary role-column align-top" <td class="preferences py-0 px-0 border-top border-left border-secondary role-column align-top"
v-for='argument in unified_frame_arguments' v-for='argument in unified_frame_arguments'
...@@ -1018,9 +1034,16 @@ export default LexicalUnitEdit; ...@@ -1018,9 +1034,16 @@ export default LexicalUnitEdit;
</tr> </tr>
</tbody> </tbody>
</table> </table>
</td><td style="vertical-align: text-top; padding-left: 10px; padding-top: 8px;">
<span class="cursor-pointer" @click.stop="hideSelectionalPreferencies()" title="Ukryj jednostki leksykalne">&#9652;</span> /
<span class="cursor-pointer" @click.stop="showSelectionalPreferencies()" title="Pokaż jednostki leksykalne">&#9662;</span>
</td></tr>
</table>
</div> </div>
<div v-if="unified_frame.id" class="lu-table mt-3 mb-3"> <div v-if="unified_frame.id" class="lu-table mt-3 mb-3">
<table class="m-0 table-borderless border border-secondary text-dark"> <table class="m-0 table-borderless text-dark">
<tr><td>
<table class="m-0 border border-secondary text-dark">
<tbody> <tbody>
<tr> <tr>
<th scope="row" class="py-2 px-1 text-secondary">Jednostka leksykalna</th> <th scope="row" class="py-2 px-1 text-secondary">Jednostka leksykalna</th>
...@@ -1028,6 +1051,7 @@ export default LexicalUnitEdit; ...@@ -1028,6 +1051,7 @@ export default LexicalUnitEdit;
<th scope="row" class="py-2 px-1 text-secondary">Status</th> <th scope="row" class="py-2 px-1 text-secondary">Status</th>
</tr> </tr>
<tr class="preferences py-0 px-0 border-top border-left border-secondary" <tr class="preferences py-0 px-0 border-top border-left border-secondary"
v-if="lexicalUnitsVisible"
v-for='lexical_unit in lexical_units' v-for='lexical_unit in lexical_units'
> >
<template v-if="isFrameVisible(lexical_unit.frame_status)"> <template v-if="isFrameVisible(lexical_unit.frame_status)">
...@@ -1041,6 +1065,12 @@ export default LexicalUnitEdit; ...@@ -1041,6 +1065,12 @@ export default LexicalUnitEdit;
</tr> </tr>
</tbody> </tbody>
</table> </table>
</td>
<td style="vertical-align: text-top; padding-left: 10px; padding-top: 8px;">
<span class="cursor-pointer" @click.stop="hideLexicalUnits()" title="Ukryj jednostki leksykalne">&#9652;</span> /
<span class="cursor-pointer" @click.stop="showLexicalUnits()" title="Pokaż jednostki leksykalne">&#9662;</span></td>
</tr>
</table>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -4,13 +4,14 @@ import InfoTooltip from "/src/components/shared/InfoTooltip.vue"; ...@@ -4,13 +4,14 @@ import InfoTooltip from "/src/components/shared/InfoTooltip.vue";
export default { export default {
props: { props: {
frame: Object, frame: Object,
selectedExamples: Object selectedExamples: Object,
}, },
components: {InfoTooltip}, components: {InfoTooltip},
emits: ['frameSelectionChanged'], emits: ['frameSelectionChanged'],
data() { data() {
return { return {
img_prefix: window.STATIC_URL, img_prefix: window.STATIC_URL,
selectionalPreferenciesShow: Boolean
} }
}, },
methods: { methods: {
...@@ -18,9 +19,6 @@ export default { ...@@ -18,9 +19,6 @@ export default {
const ret = window.lexical_units2dom(this.frame.lexical_units); const ret = window.lexical_units2dom(this.frame.lexical_units);
return ret; return ret;
}, },
getOpinionHTML() {
return window.make_opinion_row(this.frame, this.frame.arguments.length, 3).outerHTML;
},
getArguments() { getArguments() {
return this.frame.arguments; return this.frame.arguments;
}, },
...@@ -33,6 +31,12 @@ export default { ...@@ -33,6 +31,12 @@ export default {
const selectedExampleFrameArguments = this.selectedExamples && this.selectedExamples.length > 0 ? new Set(this.selectedExamples.map(e => e.argument_ids).flat()) : null; const selectedExampleFrameArguments = this.selectedExamples && this.selectedExamples.length > 0 ? new Set(this.selectedExamples.map(e => e.argument_ids).flat()) : null;
return argument.role + ' ' + (argument.selected ? 'active' : argument.hover ? 'bg-highlight' : '') return argument.role + ' ' + (argument.selected ? 'active' : argument.hover ? 'bg-highlight' : '')
+ (selectedExampleFrameArguments != null ? selectedExampleFrameArguments.has(argument.id) ? 'example-yes' : 'example-no' : ''); + (selectedExampleFrameArguments != null ? selectedExampleFrameArguments.has(argument.id) ? 'example-yes' : 'example-no' : '');
},
hideSelectionalPreferencies() {
this.selectionalPreferenciesShow = false;
},
showSelectionalPreferencies() {
this.selectionalPreferenciesShow = true;
} }
}, },
mounted() { mounted() {
...@@ -44,7 +48,21 @@ export default { ...@@ -44,7 +48,21 @@ export default {
<template> <template>
<table class="table m-0 table-borderless border border-secondary text-dark"> <table class="table m-0 table-borderless border border-secondary text-dark">
<tbody> <tbody>
<tr class="opinion-row" v-html="getOpinionHTML()"> <tr class="opinion-row">
<th scope="row" class="py-2 px-1 text-secondary" style="width: 3em;">Opinia</th>
<td class="opinion-cell py-2 px-1" :colspan="frame.arguments.length">
<table class="table m-0 p-0 table-borderless">
<tr>
<td class="opinion-cell p-0">
<img :src="'/static/entries/img/' + frame.opinion_key + '.svg'" :alt="frame.opinion"
width="12" height="12"> {{frame.opinion}}
</td>
<td class="opinion-cell p-0" style="text-align: right;">
<span class="cursor-pointer" @click.stop="hideSelectionalPreferencies()" title="Ukryj preferencje selekcyjne">&#9652;</span> /
<span class="cursor-pointer" @click.stop="showSelectionalPreferencies()" title="Pokaż preferencje selekcyjne">&#9662;</span></td>
</tr>
</table>
</td>
</tr> </tr>
<tr> <tr>
<th scope="row" class="py-2 px-1 text-secondary">Rola</th> <th scope="row" class="py-2 px-1 text-secondary">Rola</th>
...@@ -59,7 +77,7 @@ export default { ...@@ -59,7 +77,7 @@ export default {
</td> </td>
</template> </template>
</tr> </tr>
<tr> <tr v-if="selectionalPreferenciesShow">
<th scope="row" class="py-0 px-1 text-secondary">Preferencje selekcyjne</th> <th scope="row" class="py-0 px-1 text-secondary">Preferencje selekcyjne</th>
<template v-for="argument in getArguments()"> <template v-for="argument in getArguments()">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment