Skip to content
Snippets Groups Projects
Commit fc4cf6e1 authored by dcz2's avatar dcz2
Browse files

Draft of frame preview, swapping frames

parent cd9643ca
Branches
Tags
No related merge requests found
import InfoTooltip from "./InfoTooltip.js"; import InfoTooltip from "./InfoTooltip.js";
import Spinner from "./Spinner.js"; import Spinner from "./Spinner.js";
export default { let LexicalUnitEdit = {};
const FramePreview = {
props: {
initialUnifiedFrameId: Number
},
data () {
return {
unifiedFrameId: this.initialUnifiedFrameId
};
},
components: {LexicalUnitEdit},
emits: ['changeFrame'],
mounted () {
Split(['#frame-preview-left-pane', '#frame-preview-right-pane'], {
sizes: [60, 40],
minSize: 100,
gutterSize: 4,
elementStyle: (dimension, size, gutterSize) => {
return {
'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)'
}
},
});
},
template: `
<div :key="unifiedFrameId" class="row">
<div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="frame-preview-left-pane">
<lexical-unit-edit
:readOnly="true"
:unifiedFrameId="unifiedFrameId"
/>
</div>
<div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="frame-preview-right-pane">
TODO list
<span @click="$emit('changeFrame', 1)">change frame</span>
</div>
</div>
`
};
Object.assign(LexicalUnitEdit, {
props: { props: {
unifiedFrameId: Number unifiedFrameId: Number,
previewedUnifiedFrameId: Number,
readOnly: Boolean,
initialRightPaneTab: String,
}, },
data() { data() {
return { return {
gettext: window.gettext, gettext: window.gettext,
unified_frame: Object, unified_frame: {},
unified_frame_title: Object, unified_frame_title: '',
unified_frame_arguments: [], unified_frame_arguments: [],
active_unified_frame_argument: null, active_unified_frame_argument: null,
slowal_frames2selecional_preferencies_mapping: {}, slowal_frames2selecional_preferencies_mapping: {},
...@@ -21,16 +65,12 @@ export default { ...@@ -21,16 +65,12 @@ export default {
{id: 'frame_preview', label: gettext('Podgląd ram')}, {id: 'frame_preview', label: gettext('Podgląd ram')},
{id: 'notes', label: gettext('Notatki')}, {id: 'notes', label: gettext('Notatki')},
], ],
right_pane_tab: 'schemata' right_pane_tab: this.initialRightPaneTab || 'schemata',
} currentPreviewedUnifiedFrameId: this.previewedUnifiedFrameId,
},
components: {InfoTooltip, Spinner},
emits: ['goToDisplay', 'refresh'],
watch: {
unifiedFrameId: function () {
this.loadFrame();
} }
}, },
components: {InfoTooltip, Spinner, FramePreview},
emits: ['goToDisplay', 'refresh', 'swapFrames'],
methods: { methods: {
hasWhiteSpace(s) { hasWhiteSpace(s) {
return /\s/g.test(s); return /\s/g.test(s);
...@@ -553,10 +593,18 @@ export default { ...@@ -553,10 +593,18 @@ export default {
show_error(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')');
} }
}); });
},
changePreviewedUnifiedFrameId (unifiedFrameId) {
this.currentPreviewedUnifiedFrameId = unifiedFrameId;
},
swapUnifiedFrames () {
if (this.unified_frame.id !== this.currentPreviewedUnifiedFrameId) {
this.$emit("swapFrames", this.currentPreviewedUnifiedFrameId);
}
} }
}, },
mounted() { mounted() {
Split(['#semantics-frames-pane', '#semantics-schemata-pane'], { !this.readOnly && Split(['#semantics-frames-pane', '#semantics-schemata-pane'], {
sizes: [40, 60], sizes: [40, 60],
minSize: 400, minSize: 400,
gutterSize: 4, gutterSize: 4,
...@@ -570,7 +618,7 @@ export default { ...@@ -570,7 +618,7 @@ export default {
}, },
template: ` template: `
<div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-frames-pane"> <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-frames-pane">
<table class="table-button-menu" cellspacing="1"> <table v-if="!readOnly" class="table-button-menu" cellspacing="1">
<tr style="background-color: white;"> <tr style="background-color: white;">
<td id="change-title" @click="changeTitle" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień nazwę</td> <td id="change-title" @click="changeTitle" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień nazwę</td>
<td id="add-arg" @click="addArgument" style="padding: 10px 15px 10px 15px; color: #000000;">Dodaj argum.</td> <td id="add-arg" @click="addArgument" style="padding: 10px 15px 10px 15px; color: #000000;">Dodaj argum.</td>
...@@ -581,7 +629,7 @@ export default { ...@@ -581,7 +629,7 @@ export default {
<tr style="background-color: white;"> <tr style="background-color: white;">
<td id="change-role" @click="changeRole" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę</td> <td id="change-role" @click="changeRole" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę</td>
<td id="remove-arg" @click="removeArgument" style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argum.</td> <td id="remove-arg" @click="removeArgument" style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argum.</td>
<td id="change-windows" style="padding: 10px 15px 10px 15px; color: #000000;">Zamień okna</td> <td id="change-windows" style="padding: 10px 15px 10px 15px; color: #000000;" @click="swapUnifiedFrames">Zamień okna</td>
<td id="duplicates" @click="duplicate" style="padding: 10px 15px 10px 15px; color: #000000;">Duplikuj</td> <td id="duplicates" @click="duplicate" style="padding: 10px 15px 10px 15px; color: #000000;">Duplikuj</td>
<td id="save-changes" style="padding: 10px 15px 10px 15px; color: #000000;">Zapisz</td> <td id="save-changes" style="padding: 10px 15px 10px 15px; color: #000000;">Zapisz</td>
</tr> </tr>
...@@ -668,7 +716,7 @@ export default { ...@@ -668,7 +716,7 @@ export default {
</table> </table>
</div> </div>
<table v-if="unified_frame.id" class="table-button-menu" cellspacing="1"> <table v-if="!readOnly && unified_frame.id" class="table-button-menu" cellspacing="1">
<tr style="background-color: white;"> <tr style="background-color: white;">
<td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;">Błędna</td> <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;">Błędna</td>
<td <td
...@@ -709,17 +757,19 @@ export default { ...@@ -709,17 +757,19 @@ export default {
<div v-html="slowal_frame_html(frame)" @click="slowalFrameSelected(frame)"></div> <div v-html="slowal_frame_html(frame)" @click="slowalFrameSelected(frame)"></div>
</th> </th>
<th scope="row"> <th scope="row">
<div> <div v-if="!readOnly">
<label v-bind:for="frame.id"> <label v-bind:for="frame.id">
<div><input <div>
:id="frame.id" <input
type="checkbox" :id="frame.id"
v-model="frame.verified" type="checkbox"
:checked="frame.verified" v-model="frame.verified"
class="custom-control custom-checkbox" :checked="frame.verified"
@change="change_slowal2unified_mapping_verification(frame.id, frame.verified)" class="custom-control custom-checkbox"
> @change="change_slowal2unified_mapping_verification(frame.id, frame.verified)"
<span>Zweryfikowane</span></div> >
<span>Zweryfikowane</span>
</div>
</label> </label>
<br><br> <br><br>
<a href="#" class="btn btn-sm btn-dark" role="button" @click="change_slowal2unified_frame_argument_mapping(frame.id)">Z</a> <a href="#" class="btn btn-sm btn-dark" role="button" @click="change_slowal2unified_frame_argument_mapping(frame.id)">Z</a>
...@@ -730,7 +780,7 @@ export default { ...@@ -730,7 +780,7 @@ export default {
</table> </table>
</div> </div>
</div> </div>
<div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-schemata-pane"> <div v-if="!readOnly" class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-schemata-pane">
<ul class="nav nav-pills nav-justified p-1" id="entryTabs" role="tablist"> <ul class="nav nav-pills nav-justified p-1" id="entryTabs" role="tablist">
<li <li
v-for="tab in right_pane_tabs" v-for="tab in right_pane_tabs"
...@@ -742,8 +792,12 @@ export default { ...@@ -742,8 +792,12 @@ export default {
</li> </li>
</ul> </ul>
<div :class="right_pane_tab !== 'schemata' && 'd-none'" id="semantics-schemata"></div> <div :class="right_pane_tab !== 'schemata' && 'd-none'" id="semantics-schemata"></div>
<div v-if="right_pane_tab === 'frame_preview'">drugi tab</div> <div v-if="right_pane_tab === 'frame_preview'">
<frame-preview :key="currentPreviewedUnifiedFrameId" :initialUnifiedFrameId="currentPreviewedUnifiedFrameId" @change-frame="changePreviewedUnifiedFrameId" />
</div>
<div v-if="right_pane_tab === 'notes'">notateczki</div> <div v-if="right_pane_tab === 'notes'">notateczki</div>
</div> </div>
` `
} });
export default LexicalUnitEdit;
...@@ -15,12 +15,14 @@ export default { ...@@ -15,12 +15,14 @@ export default {
return { return {
isEdit: false, isEdit: false,
key: this.lexicalUnitId, key: this.lexicalUnitId,
unifiedFrameId: null unifiedFrameId: null,
previewedUnifiedFrameId: null
}; };
}, },
goToEdit (unifiedFrameId) { goToEdit (unifiedFrameId) {
this.isEdit = true; this.isEdit = true;
this.unifiedFrameId = unifiedFrameId; this.unifiedFrameId = unifiedFrameId;
this.previewedUnifiedFrameId = unifiedFrameId;
}, },
goToDisplay () { goToDisplay () {
this.isEdit = false; this.isEdit = false;
...@@ -30,6 +32,11 @@ export default { ...@@ -30,6 +32,11 @@ export default {
this.key = null; this.key = null;
setTimeout(() => { this.key = this.lexicalUnitId; }, 0); setTimeout(() => { this.key = this.lexicalUnitId; }, 0);
update_entries(); update_entries();
},
swapFrames (previewedUnifiedFrameId) {
this.previewedUnifiedFrameId = this.unifiedFrameId;
this.unifiedFrameId = previewedUnifiedFrameId;
this.refresh();
} }
}, },
watch: { watch: {
...@@ -48,8 +55,12 @@ export default { ...@@ -48,8 +55,12 @@ export default {
/> />
<lexical-unit-edit <lexical-unit-edit
v-if="isEdit" v-if="isEdit"
:readOnly="false"
:unifiedFrameId="unifiedFrameId" :unifiedFrameId="unifiedFrameId"
:previewedUnifiedFrameId="previewedUnifiedFrameId"
:initialRightPaneTab="unifiedFrameId !== previewedUnifiedFrameId ? 'frame_preview' : null"
@go-to-display="goToDisplay" @go-to-display="goToDisplay"
@swap-frames="swapFrames"
/> />
</div> </div>
` `
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment