diff --git a/entries/static/entries/css/entries.css b/entries/static/entries/css/entries.css index 7cd64344684d0d635c965728d1ab52d004c876e5..58732e3f3119192c0d2d17da7f715e2d24db937b 100644 --- a/entries/static/entries/css/entries.css +++ b/entries/static/entries/css/entries.css @@ -251,3 +251,7 @@ legend { max-width: 400px; width: 400px; } + +.tr-hover { + background-color: rgba(0,0,0,.075) !important; +} diff --git a/entries/static/entries/js/components/LexicalUnitEdit.js b/entries/static/entries/js/components/LexicalUnitEdit.js index cc4ad98b963a4cdbf06dc068e12fe540530198ca..1439170b82d732d626007223ef07bd775153e480 100644 --- a/entries/static/entries/js/components/LexicalUnitEdit.js +++ b/entries/static/entries/js/components/LexicalUnitEdit.js @@ -16,11 +16,8 @@ const FramePreview = { }; }, components: {LexicalUnitEdit, UnificationSwitchableList}, - emits: ['changeFrame', 'changePreviewToEdit', 'refreshEntriesList'], + emits: ['changeFrame', 'refreshEntriesList'], methods: { - changePreviewToEditLocal (unifiedFrameId) { - this.$emit('changePreviewToEdit', unifiedFrameId); - }, unifiedFrameSelected (unifiedFrameId) { this.$emit('changeFrame', unifiedFrameId); }, @@ -48,7 +45,6 @@ const FramePreview = { :readOnly="true" :unifiedFrameId="unifiedFrameId" :forceRefresh="forceRefresh" - @change-preview-to-edit="changePreviewToEditLocal" @refresh-entries-list="refreshEntriesList" /> <div v-else class="h-100"> @@ -97,7 +93,7 @@ Object.assign(LexicalUnitEdit, { } }, components: {InfoTooltip, Spinner, FramePreview}, - emits: ['goToDisplay', 'refresh', 'swapFrames', 'changePreviewToEdit', 'refreshEntriesList'], + emits: ['goToDisplay', 'refresh', 'swapFrames', 'refreshEntriesList'], watch: { forceRefresh(newVal, oldVal) { this.loadFrame(); @@ -672,6 +668,7 @@ Object.assign(LexicalUnitEdit, { show_info('Status ramy został zmieniony'); this.$emit('refreshEntriesList'); this.loadFrame(); + // this.slowalFrameSelected(this.active_slowal_frame.id); }.bind(this), error: function (request, errorType, errorMessage) { show_error(errorType + ' (' + errorMessage + ')'); @@ -707,7 +704,10 @@ Object.assign(LexicalUnitEdit, { const isSuperLeksykograf = this.isSuperLeksykograf(); this.statusButtonTitle = isSuperLeksykograf ? 'Sprawdź' : 'Gotowe'; }, - slowalFrameSelected(frame) { + slowalFrameSelected(frameId) { + const frame = this.frames.find(f => { + return f.id == frameId; + }); if (this.active_slowal_frame === frame) { this.active_slowal_frame = null; this.setup_notes_unified_frame(); @@ -807,9 +807,6 @@ Object.assign(LexicalUnitEdit, { this.$emit("swapFrames", this.currentPreviewedUnifiedFrameId); } }, - changePreviewToEditClick () { - this.$emit("changePreviewToEdit", this.unified_frame.id); - }, changeShowVerifiedFrames (val) { this.showVerifiedFrames = val; }, @@ -827,8 +824,8 @@ Object.assign(LexicalUnitEdit, { } }, }); - Split(['#semantics-unified-frame-pane', '#semantics-slowal-frames-pane'], { - sizes: [60, 40], + Split(['#semantics-unified-frame-pane', '#semantics-slowal-frames-pane', '#examples'], { + sizes: [40, 40, 20], direction: 'vertical', gutterSize: 4, }); @@ -841,11 +838,6 @@ Object.assign(LexicalUnitEdit, { <div class="col h-100 px-0 pt-0 pb-0 overflow-auto" id="semantics-frames-pane"> <div id="semantics-unified-frame-pane" class="col w-100 p-0 overflow-auto"> - <table v-if="readOnly" class="table-button-menu" style="max-width: 50px" cellspacing="1"> - <tr style="background-color: white;"> - <td id="change-title" @click="changePreviewToEditClick" style="padding: 10px 15px 10px 15px; color: #000000;">Edytuj</td> - </tr> - </table> <table v-if="!readOnly" class="table-button-menu sticky-top" cellspacing="1"> <tr style="background-color: white;"> @@ -952,73 +944,86 @@ Object.assign(LexicalUnitEdit, { </div> </div> <div id="semantics-slowal-frames-pane" class="col w-100 p-0 overflow-auto"> - <table v-if="!readOnly && unified_frame.id" class="table-button-menu sticky-top" cellspacing="1"> - <tr style="background-color: white;"> - <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('Z')">Błędna</td> - <td - style="padding: 10px 15px 10px 15px; color: #000000;" - > - Rozdziel - </td> - <td id="hide-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(false)">Ukryj</td> - <td id="ready-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="slowal_frame_ready_rollback">{{ statusButtonTitle }}</td> - <td id="filter-slowal-frames" style="padding: 10px 15px 10px 15px; color: #000000;">Filtruj</td> - </tr> - <tr style="background-color: white;"> - <td id="inccorect-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('B')"> - Niepasująca - </td> - <td id="move-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" - @click="extract_frame_to_preview_frame()"> - Przerzuć - </td> - <td id="show-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(true)"> - Pokaż - </td> - <td id="reollback-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;"> - Przywróć - </td> - <td id="empty" style="padding: 10px 15px 10px 15px; color: #000000;"></td> - </tr> - </table> - <div id="semantics-frames"> - <div v-for="frame in frames" - :key="frame.id"> - <table class="table m-0 table-borderless border border-secondary text-dark" - v-if="(!isFrameVerified(frame) || showVerifiedFrames) && isFrameVisible(frame.status)" - > - <tbody> - <tr> - <th scope="row"> - <div - v-html="slowal_frame_html(frame)" - @click="slowalFrameSelected(frame)" - :class="isSelectedFrame(frame) ? 'active-frame' : ''" - ></div> - </th> - <th scope="row"> - <div v-if="!readOnly"> - <div v-if="isFrameVerified(frame)"> - <input - type="checkbox" - :checked="isFrameVerified(frame)" - class="custom-control custom-checkbox" - disabled="disabled" - > - </div> - <br><br> - <button v-if="!isFrameVerified(frame)" - class="btn btn-sm btn-dark" role="button" - @click="change_slowal2unified_frame_argument_mapping(frame.id)" - >Z</button> - </div> - </th> + <table v-if="!readOnly && unified_frame.id" class="table-button-menu sticky-top" cellspacing="1"> + <tr style="background-color: white;"> + <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('Z')">Błędna</td> + <td + style="padding: 10px 15px 10px 15px; color: #000000;" + > + Rozdziel + </td> + <td id="hide-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(false)">Ukryj</td> + <td id="ready-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="slowal_frame_ready_rollback">{{ statusButtonTitle }}</td> + <td id="filter-slowal-frames" style="padding: 10px 15px 10px 15px; color: #000000;">Filtruj</td> + </tr> + <tr style="background-color: white;"> + <td id="inccorect-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('B')"> + Niepasująca + </td> + <td id="move-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" + @click="extract_frame_to_preview_frame()"> + Przerzuć + </td> + <td id="show-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(true)"> + Pokaż + </td> + <td id="reollback-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;"> + Przywróć + </td> + <td id="empty" style="padding: 10px 15px 10px 15px; color: #000000;"></td> </tr> - </tbody> </table> + <div id="semantics-frames"> + <div v-for="frame in frames" + :key="frame.id"> + <table class="table m-0 table-borderless border border-secondary text-dark" + v-if="(!isFrameVerified(frame) || showVerifiedFrames) && isFrameVisible(frame.status)" + > + <tbody> + <tr> + <th scope="row"> + <div + v-html="slowal_frame_html(frame)" + :class="isSelectedFrame(frame) ? 'active-frame' : ''" + ></div> + </th> + <th scope="row"> + <div v-if="!readOnly"> + <div v-if="isFrameVerified(frame)"> + <input + type="checkbox" + :checked="isFrameVerified(frame)" + class="custom-control custom-checkbox" + disabled="disabled" + > + </div> + <br><br> + <button v-if="!isFrameVerified(frame)" + class="btn btn-sm btn-dark" role="button" + @click="change_slowal2unified_frame_argument_mapping(frame.id)" + >Z</button> + </div> + </th> + </tr> + </tbody> + </table> + </div> + </div> + </div> + <div class="col w-100 p-0 tab-pane overflow-auto" id="examples"> + <table id="semantics-examples" class="table table-sm table-hover"> + <thead> + <tr> + <th scope="col">{{ gettext("Przykład") }}<i id="examples-argument"></i><i id="examples-lu"></i><i id="examples-schema"></i></th> + <th scope="col">{{ gettext("Źródło") }}</th> + <th scope="col">{{ gettext("Opinia") }}</th> + </tr> + </thead> + <tbody id="semantics-examples-list"> + </tbody> + </table> + <p class="mx-1 my-1" id="semantics-no-examples">{{ gettext("Brak przykładów") }}</p> </div> - </div> - </div> </div> <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"> diff --git a/entries/static/entries/js/components/UnificationComponent.js b/entries/static/entries/js/components/UnificationComponent.js index 2915477fd5cc280f9a10a03c7fa2239650ec97f5..5ee1ebb5f11c9d66e6b472521ca6691262da383c 100644 --- a/entries/static/entries/js/components/UnificationComponent.js +++ b/entries/static/entries/js/components/UnificationComponent.js @@ -19,9 +19,11 @@ export default { this.lexicalUnitId = lexicalUnitId; this.isEdit = false; }, - unifiedFrameSelected (unifiedFrameId) { + unifiedFrameSelected (unifiedFrameId, entryId, lexicalUnitId) { this.isEdit = true; this.unifiedFrameId = unifiedFrameId; + this.entryId = entryId; + this.lexicalUnitId = lexicalUnitId; }, refreshEntriesList() { this.unificationEntriesListRefreshKey++; @@ -36,9 +38,7 @@ export default { }; }, mounted () { - if (window.initialUnifiedFrameId) { - setTimeout(() => { this.unifiedFrameSelected(window.initialUnifiedFrameId); }, 1000); - } + this.unifiedFrameSelected(window.initialUnifiedFrameId); $('#entries-list').length && Split(['#entries-list', '#entry-display'], { sizes: [20, 80], minSize: 300, @@ -55,8 +55,8 @@ export default { <div id="entries-list-div" class="col p-0 h-100 w-100 overflow-auto"> <unification-switchable-list :unificationEntriesListRefreshKey="unificationEntriesListRefreshKey" - :initialLexicalUnitId="initialLexicalUnitId" - :initialEntryId="initialEntryId" + :initialLexicalUnitId="lexicalUnitId ? lexicalUnitId : initialLexicalUnitId" + :initialEntryId="entryId ? entryId : initialEntryId" @lexical-unit-selected="lexicalUnitSelected" @unified-frame-selected="unifiedFrameSelected" /> @@ -64,6 +64,7 @@ export default { </div> <div id="entry-display" class="col h-100 p-0"> <unification-right-pane + ref="unificationRightPane" :entryId="entryId" :lexicalUnitId="lexicalUnitId" :initialUnifiedFrameId="unifiedFrameId" diff --git a/entries/static/entries/js/components/UnificationEntriesForFramesList.js b/entries/static/entries/js/components/UnificationEntriesForFramesList.js index 9b062f051be613c4b3e505c17170db12cad3784c..07d5f00451df7e1854acb20a5cd3d059d843faa0 100644 --- a/entries/static/entries/js/components/UnificationEntriesForFramesList.js +++ b/entries/static/entries/js/components/UnificationEntriesForFramesList.js @@ -16,8 +16,9 @@ export default { // this.datatableObject.ajax.reload(); setup_entries_for_frames_list({ table: this.$refs.table, - lexicalUnitSelected: (lexicalUnitUnifiedFrameId) => { this.$emit('unifiedFrameSelected', lexicalUnitUnifiedFrameId); }, - selectEntryId: this.initialEntryId + lexicalUnitSelected: (lexicalUnitUnifiedFrameId, entryId, lexicalUnitId) => { this.$emit('unifiedFrameSelected', lexicalUnitUnifiedFrameId, entryId, lexicalUnitId); }, + selectEntryId: this.initialEntryId, + secondarySelectEntryId: this.initialLexicalUnitId }); } }, @@ -25,12 +26,13 @@ export default { mounted () { setup_entries_for_frames_list({ table: this.$refs.table, - lexicalUnitSelected: (lexicalUnitUnifiedFrameId) => { this.$emit('unifiedFrameSelected', lexicalUnitUnifiedFrameId); }, - selectEntryId: this.initialEntryId + lexicalUnitSelected: (lexicalUnitUnifiedFrameId, entryId, lexicalUnitId) => { this.$emit('unifiedFrameSelected', lexicalUnitUnifiedFrameId, entryId, lexicalUnitId); }, + selectEntryId: this.initialEntryId, + secondarySelectEntryId: this.initialLexicalUnitId }); }, template: ` - <table ref="table" class="table table-sm table-hover text-dark"> + <table ref="table" class="table table-sm text-dark"> <thead> <tr> <th class="p-1">{{ gettext('Lemat') }}</th> diff --git a/entries/static/entries/js/components/UnificationEntriesList.js b/entries/static/entries/js/components/UnificationEntriesList.js index c2782c218cdd952011a34125344fd88602389ebd..8a0b4527a83021cb5c962205cb2b96af84b63519 100644 --- a/entries/static/entries/js/components/UnificationEntriesList.js +++ b/entries/static/entries/js/components/UnificationEntriesList.js @@ -11,7 +11,8 @@ export default { setup_entries_list({ table: this.$refs.table, lexicalUnitSelected: (entryId, lexicalUnitId) => { this.$emit('lexicalUnitSelected', entryId, lexicalUnitId); }, - selectEntryId: this.initialEntryId + selectEntryId: this.initialEntryId, + secondarySelectEntryId: this.initialLexicalUnitId, }); } }, @@ -31,7 +32,7 @@ export default { }); }, template: ` - <table ref="table" class="table table-sm table-hover text-dark"> + <table ref="table" class="table table-sm text-dark"> <thead> <tr> <th class="p-1">{{ gettext('Lemat') }}</th> diff --git a/entries/static/entries/js/components/UnificationRightPane.js b/entries/static/entries/js/components/UnificationRightPane.js index 8982f5d874dd3a60bd1c00b9b125f51a8154e791..5cb116a761a0b7fa91a1659caa16a01062507d9b 100644 --- a/entries/static/entries/js/components/UnificationRightPane.js +++ b/entries/static/entries/js/components/UnificationRightPane.js @@ -62,6 +62,7 @@ export default { @refresh-entries-list="refreshEntriesList" /> <lexical-unit-edit + ref="lexicalUnitEdit" v-if="unifiedFrameId && isEdit" :key="unifiedFrameId" :readOnly="false" diff --git a/entries/static/entries/js/components/UnificationSwitchableList.js b/entries/static/entries/js/components/UnificationSwitchableList.js index 170daf2cae94eaabc022edd81ae99c6168b37957..31095fcfab2a071f952a16d796eea0186f805170 100644 --- a/entries/static/entries/js/components/UnificationSwitchableList.js +++ b/entries/static/entries/js/components/UnificationSwitchableList.js @@ -19,8 +19,8 @@ export default { lexicalUnitSelected (entryId, lexicalUnitId) { this.$emit('lexicalUnitSelected', entryId, lexicalUnitId); }, - unifiedFrameSelected (unifiedFrameId) { - this.$emit('unifiedFrameSelected', unifiedFrameId); + unifiedFrameSelected (unifiedFrameId, entryId, lexicalUnitId) { + this.$emit('unifiedFrameSelected', unifiedFrameId, entryId, lexicalUnitId); }, }, components: {UnificationEntriesList, UnificationEntriesForFramesList, UnificationFramesList}, diff --git a/entries/static/entries/js/entries.js b/entries/static/entries/js/entries.js index f62659aae8e5e2c56d639b08089b35f0d8e98bbc..72b3e2d87a9578224087820901f1420fccbb9994 100644 --- a/entries/static/entries/js/entries.js +++ b/entries/static/entries/js/entries.js @@ -593,20 +593,29 @@ function unbind_frame_opinion_click(frame) { } function select_frame(frame) { + var frame_id = frame.data('frame_id'); + if(window.unificationLeftPaneApp && window.unificationLeftPaneApp.$refs.unificationRightPane) { + window.unificationLeftPaneApp.$refs.unificationRightPane.$refs.lexicalUnitEdit.slowalFrameSelected(frame_id); + } if ($('.frame.active').length > 0) { unselect_frame($('.frame.active')); + } else { + frame.removeClass('bg-highlight'); + frame.addClass('active'); + show_alternations(frame); + show_semantics_examples(frame); + bind_arguments_click(frame); + bind_lus_click(frame); + bind_frame_opinion_click(frame); + bind_semantics_schemata_click(); } - frame.removeClass('bg-highlight'); - frame.addClass('active'); - show_alternations(frame); - show_semantics_examples(frame); - bind_arguments_click(frame); - bind_lus_click(frame); - bind_frame_opinion_click(frame); - bind_semantics_schemata_click(); } function unselect_frame(frame) { + var frame_id = frame.data('frame_id'); + if(window.unificationLeftPaneApp && window.unificationLeftPaneApp.$refs.unificationRightPane) { + window.unificationLeftPaneApp.$refs.unificationRightPane.$refs.lexicalUnitEdit.slowalFrameSelected(frame_id); + } unbind_arguments_click(frame); unbind_lus_click(frame); unbind_frame_opinion_click(frame); @@ -983,6 +992,13 @@ function setup_datatable(options) { if (related) { $(row).addClass('text-muted'); } + $(row).hover(function() + { + $(this).addClass('tr-hover'); + },function() + { + $(this).removeClass('tr-hover'); + }); }, initComplete: function(settings, json) { // display the first entry once it’s loaded diff --git a/entries/static/entries/js/unification_entries_for_frames_list.js b/entries/static/entries/js/unification_entries_for_frames_list.js index 85d88230d2b3fe2abc61cbf559a2940fb3017a72..8221e310bc12b1dc20c922363aeaa98bef06c0cd 100644 --- a/entries/static/entries/js/unification_entries_for_frames_list.js +++ b/entries/static/entries/js/unification_entries_for_frames_list.js @@ -57,11 +57,11 @@ function setup_lexical_units_for_frames_table(drilldown, lexical_units, can_see_ </tr> `).click(function () { $(this).addClass('table-primary').siblings().removeClass("table-primary"); - options.lexicalUnitSelected(lexical_unit.unified_frame_id); + options.lexicalUnitSelected(lexical_unit.unified_frame_id, $(drilldown.data("row")).data("entry"), lexical_unit.pk); }); } - var table = $(` - <table class="table"> + const table = $(` + <table class="table table-hover"> <thead> <tr> <th class="p-1">${gettext("Jednostka Leksykalna")}</th> @@ -78,6 +78,10 @@ function setup_lexical_units_for_frames_table(drilldown, lexical_units, can_see_ `); drilldown.append(table); lexical_units.map(function (lexical_unit) { - $("tbody", table).append(get_lexical_unit_row(lexical_unit)); + const row = get_lexical_unit_row(lexical_unit); + $("tbody", table).append(row); + if(lexical_unit.pk === options.secondarySelectEntryId) { + row.addClass('table-primary'); + } }); } diff --git a/entries/static/entries/js/unification_entries_list.js b/entries/static/entries/js/unification_entries_list.js index 81513975ed43461c02572674c848029c077f1535..24240f3893d2e37181ef191d808702e62ba1f5f9 100644 --- a/entries/static/entries/js/unification_entries_list.js +++ b/entries/static/entries/js/unification_entries_list.js @@ -58,8 +58,8 @@ function setup_lexical_units_table(drilldown, lexical_units, can_see_assignees, options.lexicalUnitSelected($(drilldown.data("row")).data("entry"), lexical_unit.pk); }); } - var table = $(` - <table class="table"> + const table = $(` + <table class="table table-hover"> <thead> <tr> <th class="p-1">${gettext("Jednostka Leksykalna")}</th> @@ -76,7 +76,11 @@ function setup_lexical_units_table(drilldown, lexical_units, can_see_assignees, `); drilldown.append(table); lexical_units.map(function (lexical_unit) { - $("tbody", table).append(get_lexical_unit_row(lexical_unit)); + const row = get_lexical_unit_row(lexical_unit); + $("tbody", table).append(row); + if(lexical_unit.pk === options.secondarySelectEntryId) { + row.addClass('table-primary'); + } }); }