diff --git a/entries/static/entries/js/components/LexicalUnitEdit.js b/entries/static/entries/js/components/LexicalUnitEdit.js index a90fd682a9aed520ce8e668c09b6afec7be792a8..c696928cdd666c68f0b64d539d08ea107897745d 100644 --- a/entries/static/entries/js/components/LexicalUnitEdit.js +++ b/entries/static/entries/js/components/LexicalUnitEdit.js @@ -1,15 +1,298 @@ + export default { props: { lexicalUnitId: Number }, data() { - return { count: 0 } + return { + count: 0, + unified_frame: Object, + unified_frame_arguments: [], + title_str: Object, + slowal_frames2selecional_preferencies_mapping: {}, + lexical_units: [], + img_prefix: String + } + }, + watch: { + lexicalUnitId: function() { + console.log("xxxx"); + this.loadFrame(); + } }, methods: { clicked () { this.count++; - addSelectivePreference(); + // addSelectivePreference(); + }, + async loadFrame () { + try { + let unified_frame_id = 3; + // var data = { 'unified_frame_id' : this.lexicalUnitId }; + var data = { 'unified_frame_id' : 3}; + $.ajax({ + type : 'post', + url : '/' + lang + '/unifier/get_unified_frame/', + dataType : 'json', + data : data, + timeout : 60000, + success : function(response) { + + this.img_prefix = window.STATIC_URL; + + this.unified_frame = response.unified_frame; + this.unified_frame_arguments = this.unified_frame.arguments; + + this.count = this.count + 100; + + this.lexical_units = frames2lexical_units(response.frames); + + this.title_str = this.unified_frame.title; + if(this.title_str == null) { + //title as list of lexical units from all slowal frames + var lexical_units_html = lexical_units2dom(lexical_units); + this.title_str = lexical_units_html; + } + + this.slowal_frames2selecional_preferencies_mapping = slowal_frames2selecional_preferencies(this.unified_frame, response.frames); + + console.log('Submit Success') + + // unified_view_frame_content = response.frames + curr_entry = unified_frame_id; + // curr_no_filters = related; + clear_info(); + curr_alternations = response.alternations; + curr_realisation_phrases = response.realisation_phrases; + curr_realisation_descriptions = response.realisation_descriptions; + curr_examples = response.examples; + curr_examples_by_id = Object(); + for (var i in curr_examples) { + curr_examples_by_id[curr_examples[i].id] = curr_examples[i]; + } + // show_syntax(response.subentries); + show_unified_frame(response.unified_frame, response.frames) + show_unified_frame_lexical_units(response.frames) + fulfill_slowal_frames_arguments_with_empty_elems(response.unified_frame, response.frames) + show_semantics_unified_view(response.frames, response.subentries); + // show_unmatched_examples(); + + // tooltips with meaning gloss + activate_tooltips($('#semantics-frames-pane')); + update_last_visited(response.last_visited); + }.bind(this), + error: function(request, errorType, errorMessage) { + show_error(errorType + ' (' + errorMessage + ')'); + } + }); + + } + catch (error) { + console.log(error); + } } }, - template: `<div @click="clicked">edit {{ lexicalUnitId }} is {{ count }}</div>` + template: `<div @click="clicked">edit {{ lexicalUnitId }} is {{ count }}</div> + +<!--{% load i18n %}--> + + <div class="col h-100 w-100 p-0 tab-pane show active" id="semantics" role="tabpanel" aria-labelledby="semantics-tab"> + <div class="row m-0 p-0" id="semantics-top-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"> + <tr style="background-color: white;"> + <td id="change-title" style="padding: 10px 15px 10px 15px; color: #000000;"> + Zmień nazwę + </td> + <td id="add-arg" style="padding: 10px 15px 10px 15px; color: #000000;"> + Dodaj argum. + </td> + <td id="add-pref" style="padding: 10px 15px 10px 15px; color: #000000;" + onclick="addSelectivePreference()"> + Dodaj prefer. + </td> + <td id="merge" style="padding: 10px 15px 10px 15px; color: #000000;"> + Scal + </td> + <td id="ready" style="padding: 10px 15px 10px 15px; color: #000000;"> + Gotowe + </td> + </tr> + <tr style="background-color: white;"> + <td id="change-role" style="padding: 10px 15px 10px 15px; color: #000000;"> + Zmień rolę + </td> + <td id="remove-arg" 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="duplicates" style="padding: 10px 15px 10px 15px; color: #000000;"> + Duplikuj + </td> + <td id="save-changes" style="padding: 10px 15px 10px 15px; color: #000000;"> + Zapisz + </td> + </tr> + </table> + <br> + <div class="unifiedFrame mb-3" data-frame_id="3"><p class="mb-1"><span class="lexical-unit">{{ title_str }}</span></p> + <table class="table m-0 table-borderless border border-secondary text-dark"> + <tbody> + <tr> + <th scope="row" class="py-2 px-1 text-secondary">Role</th> + <td class="argument py-2 px-1 border-top border-left border-secondary role" + v-for="argument in unified_frame_arguments" + :key="argument.id" + >{{ argument.role_type }} + <ul> + <li + v-for='proposed_role in argument.proposed_roles' + > + {{ proposed_role.role }} + </li> + </ul> + </td> + </tr> + <tr> + <th scope="row" class="py-0 px-1 text-secondary">Selectional preferences</th> + + <td class="preferences py-0 px-0 border-top border-left border-secondary" + v-for='argument in unified_frame_arguments' + :key='argument.id' + > + <ul> + <li + v-for='preference in argument.preferences' + > + <div v-if="preference.url != null" class="preference py-2 px-1 preference-bold"><a class="synset-plwn" + v-bind:href="preference.url" + target="_blank">{{ preference.str }}</a></div> + <div v-else class="preference py-2 px-1 preference-bold">{{ preference.str }}</div> + </li> + </ul> + <ul> + <li + v-for='preference in slowal_frames2selecional_preferencies_mapping[argument.id]' + > + <div v-if="preference.url != null" class="preference py-2 px-1"><a class="synset-plwn" + v-bind:href="preference.url" + target="_blank">{{ preference.str }}</a></div> + <div v-else class="preference py-2 px-1">{{ preference.str }}</div> + </li> + </ul> + </td> + </tr> + </tbody> + </table> +</div> + + +<div class="frame mb-3"> + <table class="table m-0 table-borderless border border-secondary text-dark"> + <tbody> + <tr> + <th scope="row" class="py-2 px-1 text-secondary">Jednostka leksykalna</th> + <th scope="row" class="py-2 px-1 text-secondary">Opinion</th> + </tr> + + <tr class="preferences py-0 px-0 border-top border-left border-secondary" + v-for='lexical_unit in lexical_units' + > + <td class="argument py-2 px-1 border-top border-left border-secondary">{{ lexical_unit.str }}</td> + <td class="argument py-2 px-1 border-top border-left border-secondary"> + <img v-bind:src="img_prefix + 'entries/img/' +lexical_unit.opinion_key + '.svg'" width="12" height="12" v-bind:alt="lexical_unit.opinion"> + {{ lexical_unit.opinion }} + </td> + </tr> + </tbody> + </table> +</div> + + +<!-- <div id="unified-frame"></div>--> +<!-- <div id="unified-frame-lexical-units"></div>--> + <br> + <table class="table-button-menu" cellspacing="1"> + <tr style="background-color: white;"> + <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;"> + Błędna + </td> + <td id="extract-frame" style="padding: 10px 15px 10px 15px; color: #000000;" + onclick="extract_frames_to_new_frame(1, [104274,104238], null)"> + Rozdziel + </td> + <td id="hide-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;"> + Ukryj + </td> + <td id="ready-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;"> + Gotowe + </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;"> + Niepasująca + </td> + <td id="move-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" + onclick="extract_frames_to_new_frame(3, [104274], 1)"> + Przerzuć + </td> + <td id="show-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;"> + 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> + <br> + <div id="semantics-frames"></div> + </div> + <div class="gutter gutter-horizontal" style="width: 4px;"></div> + <div 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"> + <li class="nav-item mr-1"> + <a class="btn btn-sm btn-outline-dark nav-link active" id="unified-frame-semantics-tab" data-toggle="tab" href="#semantics" role="tab" aria-controls="semantics" aria-selected="true"> + {% trans "Schematy" %} + </a> + </li> + <li class="nav-item mr-1"> + <a class="btn btn-sm btn-outline-dark nav-link" id="unified-frame-view2-tab" data-toggle="tab" href="#syntax" role="tab" aria-controls="syntax" aria-selected="false"> + {% trans "Podgląd ram" %} + </a> + </li> + <li class="nav-item mr-0"> + <a class="btn btn-sm btn-outline-dark nav-link" id="unified-frame-notes-tab" data-toggle="tab" href="#examples" role="tab" aria-controls="examples" aria-selected="false"> + {% trans "Notatki" %} + </a> + </li> + </ul> + <div id="semantics-schemata"></div> + </div> + </div> + <div class="row m-0 p-0 overflow-auto" id="semantics-examples-pane"> + <table id="semantics-examples" class="table table-sm table-hover"> + <thead> + <tr> + <th scope="col">{% trans "Przykład" %}<i id="examples-argument"></i><i id="examples-lu"></i><i id="examples-schema"></i></th> + <th scope="col">{% trans "Źródło" %}</th> + <th scope="col">{% trans "Opinia" %}</th> + </tr> + </thead> + <tbody id="semantics-examples-list"> + </tbody> + </table> + <p class="mx-1 my-1" id="semantics-no-examples">{% trans "Brak przykładów" %}</p> + </div> + </div> + + +` } diff --git a/entries/static/entries/js/entries.js b/entries/static/entries/js/entries.js index 4e9ab7d93f59ce8f119729f9f1e05b199810b01b..e98ec505c39ece39033fff2da48ed91fb2476d9f 100644 --- a/entries/static/entries/js/entries.js +++ b/entries/static/entries/js/entries.js @@ -1095,11 +1095,11 @@ $(document).ready(function() { }, }); - $('#semantics-schemata-pane').length && Split(['#syntax-schemata-pane', '#syntax-examples-pane'], { - direction: 'vertical', - sizes: [75, 25], - gutterSize: 4, - }); + // $('#semantics-schemata-pane').length && Split(['#syntax-schemata-pane', '#syntax-examples-pane'], { + // direction: 'vertical', + // sizes: [75, 25], + // gutterSize: 4, + // }); adjust_heights(); diff --git a/entries/static/entries/js/unification.js b/entries/static/entries/js/unification.js index e9e03851679e29ad3548e34c56a63068fdbadd1f..2745f5e9d8ef0f72187738d27386181ded45160f 100644 --- a/entries/static/entries/js/unification.js +++ b/entries/static/entries/js/unification.js @@ -4,7 +4,7 @@ var unified_view_frame_content; var unified_frame_active_frame; var unified_frame_active_argument_id; -function change_slowal2unified_fram_argument_mapping(slowal_frame_id) { +function change_slowal2unified_frame_argument_mapping(slowal_frame_id) { var argument_ids = []; $('.argument.active').each(function() { var id = $(this).data('argument_id').split('-')[1]; @@ -50,7 +50,7 @@ function frames2dom_unidief_view(frames) { ' <input type="checkbox" id="slowal-verification-'+frames[i].id+'" class="custom-control-input" '+(frames[i].verified ? 'checked' : '')+' onclick="change_slowal2unified_mapping_verification('+frames[i].id+', this.checked)">\n' + ' <label class="custom-control-label" for="slowal-verification-'+frames[i].id+'">Zweryfikowane</label>\n' + ' <br><br>' + - ' <a href="#" class="btn btn-sm btn-dark" role="button" onclick="change_slowal2unified_fram_argument_mapping('+frames[i].id+')">Z</a>' + + ' <a href="#" class="btn btn-sm btn-dark" role="button" onclick="change_slowal2unified_frame_argument_mapping('+frames[i].id+')">Z</a>' + '</div>'; button_col.append(button_col_div); @@ -184,21 +184,6 @@ function get_unified_frame(unified_frame_id, related) { show_semantics_unified_view(response.frames, response.subentries); // show_unmatched_examples(); - // if current tab is empty, switch to an active tab - var active_tab = $('#entryTabs').find('.nav-link.active').attr('id'); - if (active_tab === 'semantics-tab' && $('.frame').length === 0) { - // current tab is semantics -> show syntax - $('#syntax-tab').tab('show'); - } else if (active_tab === 'examples-tab') { - if ($('.frame').length > 0) { - // current tab is examples, semantics nonempty -> show semantics - $('#semantics-tab').tab('show'); - } else { - // current tab is examples, semantics empty -> show syntax - $('#syntax-tab').tab('show'); - } - } - // tooltips with meaning gloss activate_tooltips($('#semantics-frames-pane')); update_last_visited(response.last_visited); diff --git a/entries/templates/unification.html b/entries/templates/unification.html index 7ed3f878aed755c497f92fabe21080fc0ac198f0..ab9dfe0350ee1397571287c9d504f7c3d513b812 100644 --- a/entries/templates/unification.html +++ b/entries/templates/unification.html @@ -7,7 +7,12 @@ {% block scripts %} {{ block.super }} + <link rel="stylesheet" type="text/css" href="{% static 'entries/css/unification_frames.css' %}"> <script src="{% static 'entries/js/unification_entries_list.js' %}"></script> +<script src="{% static 'entries/js/unification.js' %}"></script> +<!--<script src="{% static 'entries/js/unification_frames_list.js' %}"></script>--> +<script src="{% static 'entries/js/selectional_preference.js' %}"></script> +<script src="{% static 'entries/js/jquery-impromptu.min.js' %}"></script> {% endblock %} {% block left_pane %}{% include "unification_entries_list.html" %}{% endblock %} diff --git a/entries/templates/unification_edit_display.html b/entries/templates/unification_edit_display.html index af4a9b06daebbf8398841665b138d505f3c082a2..37d19449d37ad49c6e19b3ceb810a9daefe3f66d 100644 --- a/entries/templates/unification_edit_display.html +++ b/entries/templates/unification_edit_display.html @@ -122,37 +122,5 @@ <p class="mx-1 my-1"id="semantics-no-examples">{% trans "Brak przykładów" %}</p> </div> </div> - <div class="col h-100 w-100 p-0 tab-pane" id="syntax" role="tabpanel" aria-labelledby="syntax-tab"> - <div class="col w-100 px-1 pt-0 pb-0 overflow-auto" id="syntax-schemata-pane"> - <div id="syntax-schemata"></div> - </div> - <div class="col w-100 p-0 overflow-auto" id="syntax-examples-pane"> - <table id="syntax-examples" class="table table-sm table-hover"> - <thead> - <tr> - <th scope="col">{% trans "Przykład" %}</th> - <th scope="col">{% trans "Źródło" %}</th> - <th scope="col">{% trans "Opinia" %}</th> - </tr> - </thead> - <tbody id="syntax-examples-list"> - </tbody> - </table> - <p class="mx-1 my-1"id="syntax-no-examples">{% trans "Brak przykładów" %}</p> - </div> - </div> - <div class="col h-100 w-100 p-0 tab-pane" id="examples" role="tabpanel" aria-labelledby="examples-tab"> - <table id="unmatched-examples" class="table table-sm table-hover"> - <thead> - <tr> - <th scope="col">{% trans "Przykład" %}</th> - <th scope="col">{% trans "Źródło" %}</th> - <th scope="col">{% trans "Opinia" %}</th> - </tr> - </thead> - <tbody id="unmatched-examples-list"> - </tbody> - </table> - <p class="mx-1 my-1"id="unmatched-no-examples">{% trans "Brak przykładów" %}</p> - </div> + </div> diff --git a/entries/templates/unification_lexical_unit_display.html b/entries/templates/unification_lexical_unit_display.html index 275b7c4980dbba231149d23423fe735d1bb1fe7e..0db26ffaa12a1abf5fd06901c25c1e51f8db7afc 100644 --- a/entries/templates/unification_lexical_unit_display.html +++ b/entries/templates/unification_lexical_unit_display.html @@ -1,68 +1,71 @@ {% load i18n static %} <script src="https://unpkg.com/vue@3"></script> +<script src="https://unpkg.com/vuex@3"></script> +<!--<script type="module" src="https://unpkg.com/vue-axios@3/dist/vue-axios.min.js"></script>--> +<script src="https://unpkg.com/axios/dist/axios.min.js"></script> <div id="app"></div> <script type="module" src="{% static 'entries/js/unification_index.js' %}"></script> -<div class="tab-content h-100 w-100 p-0" id="entryTabsContent"> - <div class="col h-100 w-100 p-0 tab-pane show active" id="semantics" role="tabpanel" aria-labelledby="semantics-tab"> - <div class="row m-0 p-0" id="semantics-top-pane"> - <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-frames-pane"> - <div id="semantics-frames"></div> - <div id="unified-frame" class="mb-3"></div> - <div id="lexical-unit-notes-template" class="d-none">{% include 'notes.html' %}</div> - <div id="lexical-unit-notes"></div> - </div> - <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-schemata-pane"> - <div id="semantics-schemata"></div> - </div> - </div> - <div class="row m-0 p-0 overflow-auto" id="semantics-examples-pane"> - <table id="semantics-examples" class="table table-sm table-hover"> - <thead> - <tr> - <th scope="col">{% trans "Przykład" %}<i id="examples-argument"></i><i id="examples-lu"></i><i id="examples-schema"></i></th> - <th scope="col">{% trans "Źródło" %}</th> - <th scope="col">{% trans "Opinia" %}</th> - </tr> - </thead> - <tbody id="semantics-examples-list"> - </tbody> - </table> - <p class="mx-1 my-1"id="semantics-no-examples">{% trans "Brak przykładów" %}</p> - </div> - </div> - <div class="col h-100 w-100 p-0 tab-pane" id="syntax" role="tabpanel" aria-labelledby="syntax-tab"> - <div class="col w-100 px-1 pt-0 pb-0 overflow-auto" id="syntax-schemata-pane"> - <div id="syntax-schemata"></div> - </div> - <div class="col w-100 p-0 overflow-auto" id="syntax-examples-pane"> - <table id="syntax-examples" class="table table-sm table-hover"> - <thead> - <tr> - <th scope="col">{% trans "Przykład" %}</th> - <th scope="col">{% trans "Źródło" %}</th> - <th scope="col">{% trans "Opinia" %}</th> - </tr> - </thead> - <tbody id="syntax-examples-list"> - </tbody> - </table> - <p class="mx-1 my-1"id="syntax-no-examples">{% trans "Brak przykładów" %}</p> - </div> - </div> - <div class="col h-100 w-100 p-0 tab-pane" id="examples" role="tabpanel" aria-labelledby="examples-tab"> - <table id="unmatched-examples" class="table table-sm table-hover"> - <thead> - <tr> - <th scope="col">{% trans "Przykład" %}</th> - <th scope="col">{% trans "Źródło" %}</th> - <th scope="col">{% trans "Opinia" %}</th> - </tr> - </thead> - <tbody id="unmatched-examples-list"> - </tbody> - </table> - <p class="mx-1 my-1"id="unmatched-no-examples">{% trans "Brak przykładów" %}</p> - </div> -</div> +<!--<div class="tab-content h-100 w-100 p-0" id="entryTabsContent">--> +<!-- <div class="col h-100 w-100 p-0 tab-pane show active" id="semantics" role="tabpanel" aria-labelledby="semantics-tab">--> +<!-- <div class="row m-0 p-0" id="semantics-top-pane">--> +<!-- <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-frames-pane">--> +<!-- <div id="semantics-frames"></div>--> +<!-- <div id="unified-frame" class="mb-3"></div>--> +<!-- <div id="lexical-unit-notes-template" class="d-none">{% include 'notes.html' %}</div>--> +<!-- <div id="lexical-unit-notes"></div>--> +<!-- </div>--> +<!-- <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-schemata-pane">--> +<!-- <div id="semantics-schemata"></div>--> +<!-- </div>--> +<!-- </div>--> +<!-- <div class="row m-0 p-0 overflow-auto" id="semantics-examples-pane">--> +<!-- <table id="semantics-examples" class="table table-sm table-hover">--> +<!-- <thead>--> +<!-- <tr>--> +<!-- <th scope="col">{% trans "Przykład" %}<i id="examples-argument"></i><i id="examples-lu"></i><i id="examples-schema"></i></th>--> +<!-- <th scope="col">{% trans "Źródło" %}</th>--> +<!-- <th scope="col">{% trans "Opinia" %}</th>--> +<!-- </tr>--> +<!-- </thead>--> +<!-- <tbody id="semantics-examples-list">--> +<!-- </tbody>--> +<!-- </table>--> +<!-- <p class="mx-1 my-1"id="semantics-no-examples">{% trans "Brak przykładów" %}</p>--> +<!-- </div>--> +<!-- </div>--> +<!-- <div class="col h-100 w-100 p-0 tab-pane" id="syntax" role="tabpanel" aria-labelledby="syntax-tab">--> +<!-- <div class="col w-100 px-1 pt-0 pb-0 overflow-auto" id="syntax-schemata-pane">--> +<!-- <div id="syntax-schemata"></div>--> +<!-- </div>--> +<!-- <div class="col w-100 p-0 overflow-auto" id="syntax-examples-pane">--> +<!-- <table id="syntax-examples" class="table table-sm table-hover">--> +<!-- <thead>--> +<!-- <tr>--> +<!-- <th scope="col">{% trans "Przykład" %}</th>--> +<!-- <th scope="col">{% trans "Źródło" %}</th>--> +<!-- <th scope="col">{% trans "Opinia" %}</th>--> +<!-- </tr>--> +<!-- </thead>--> +<!-- <tbody id="syntax-examples-list">--> +<!-- </tbody>--> +<!-- </table>--> +<!-- <p class="mx-1 my-1"id="syntax-no-examples">{% trans "Brak przykładów" %}</p>--> +<!-- </div>--> +<!-- </div>--> +<!-- <div class="col h-100 w-100 p-0 tab-pane" id="examples" role="tabpanel" aria-labelledby="examples-tab">--> +<!-- <table id="unmatched-examples" class="table table-sm table-hover">--> +<!-- <thead>--> +<!-- <tr>--> +<!-- <th scope="col">{% trans "Przykład" %}</th>--> +<!-- <th scope="col">{% trans "Źródło" %}</th>--> +<!-- <th scope="col">{% trans "Opinia" %}</th>--> +<!-- </tr>--> +<!-- </thead>--> +<!-- <tbody id="unmatched-examples-list">--> +<!-- </tbody>--> +<!-- </table>--> +<!-- <p class="mx-1 my-1"id="unmatched-no-examples">{% trans "Brak przykładów" %}</p>--> +<!-- </div>--> +<!--</div>-->