diff --git a/entries/static/entries/js/components/LexicalUnitEdit.js b/entries/static/entries/js/components/LexicalUnitEdit.js index 0f3948b74fa6ba41a2ae16741528a074ba87b3c1..507a781f7d0a31d61d44c2e343e05c333f7bcaa1 100644 --- a/entries/static/entries/js/components/LexicalUnitEdit.js +++ b/entries/static/entries/js/components/LexicalUnitEdit.js @@ -74,7 +74,7 @@ export default { for (var i in curr_examples) { curr_examples_by_id[curr_examples[i].id] = curr_examples[i]; } - show_unified_frame_lexical_units(response.frames) + // show_unified_frame_lexical_units(response.frames) fulfill_slowal_frames_arguments_with_empty_elems(response.unified_frame, response.frames) this.show_semantics_unified_view(response.frames, response.subentries); // show_unmatched_examples(); diff --git a/entries/static/entries/js/unification.js b/entries/static/entries/js/unification.js index d55eb8a3ff17fbb90d8a6279dc54088f63d2d80b..b6e95745fa0636c6d7614b7665148bc394022821 100644 --- a/entries/static/entries/js/unification.js +++ b/entries/static/entries/js/unification.js @@ -13,7 +13,6 @@ function get_unified_frame(unified_frame_id, related) { data : data, timeout : 60000, success : function(response) { - unified_view_frame_content = response.frames curr_entry = unified_frame_id; curr_no_filters = related; clear_info(); @@ -96,94 +95,6 @@ function fulfill_slowal_frames_arguments_with_empty_elems(unified_frame, slowal_ } } -function unifiedFrame2dom(unifiedFrame, slowal_frames) { - var div = document.createElement('div'); - div.className = 'unifiedFrame mb-3'; - div.setAttribute('data-frame_id', unifiedFrame.id); - - var p = document.createElement('p'); - p.className = 'mb-1' - - let title = unifiedFrame.title; - if(title == null) { - //title as list of lexical units from all slowal frames - var lexical_units = frames2lexical_units(slowal_frames); - var lexical_units_html = lexical_units2dom(lexical_units); - title = lexical_units_html; - } - - p.innerHTML = '<span class="lexical-unit">' + title + '</span>'; - div.append(p) - - let slowal_frames2selecional_preferencies_mapping = slowal_frames2selecional_preferencies(unifiedFrame, slowal_frames); - - var table = document.createElement('table'); - table.className = 'table m-0 table-borderless border border-secondary text-dark'; - var tbody = document.createElement('tbody'); - - // roles and selectional preferences - var roles_row = document.createElement('tr'); - var roles_html = '<th scope="row" class="py-2 px-1 text-secondary">' + gettext('Rola') + '</td>'; - var preferences_row = document.createElement('tr'); - var preferences_html = '<th scope="row" class="py-0 px-1 text-secondary">' + gettext('Preferencje selekcyjne') + '</td>'; - unifiedFrame.arguments.map(argument => { - var cls = ''; - var data = ' data-argument_id="' + argument.id + '" data-role="' + argument.role + '"'; - roles_html += '<td class="argument py-2 px-1 border-top border-left border-secondary' + cls + ' ' + argument.role_type + '"' + data + '>' + argument.role_type; - roles_html += '<ul>' - for (var j in argument.proposed_roles) { - var proposed_role = argument.proposed_roles[j]; - roles_html += '<li>' + proposed_role.role + '</li>'; - } - roles_html += '</ul>' - roles_html += '</td>' - - preferences_html += '<td class="preferences py-0 px-0 border-top border-left border-secondary' + cls + '"' + data + '>' - - // don’t append to preferences_html.innerHTML since it automatically closes tags *** (?) - let selectional_preference_html = create_selectional_preference_html(argument.preferences, 'preference-bold'); - preferences_html += selectional_preference_html; - - let selecional_preferencies_poposition = slowal_frames2selecional_preferencies_mapping[argument.id] - if(selecional_preferencies_poposition != null) { - preferences_html += create_selectional_preference_html(selecional_preferencies_poposition, ''); - } - - // *** and we want to close the <td> here - preferences_html += '</td>'; - }); - preferences_row.innerHTML += preferences_html; - roles_row.innerHTML = roles_html; - tbody.append(roles_row); - tbody.append(preferences_row); - table.append(tbody); - div.append(table); - return div; -} - -function create_selectional_preference_html(preferences, additional_css_class) { - let preferences_html_local = ''; - for (var j in preferences) { - var preference = preferences[j]; - var cls = j > 0 ? ' border-top' : ''; - if (preference.str.length > 12) { - cls += ' text-break'; - } - preferences_html_local += '<div class="preference py-2 px-1' + cls + '">'; - if (preference.url) { - preferences_html_local += ' <a class="synset-plwn '+additional_css_class+'" href="' + preference.url + '" target="_blank">' + preference.str + '</a>'; - } else { - preferences_html_local += ' <span class="'+additional_css_class+'">' + preference.str +'</span>'; - } - if (preference.info) { - preferences_html_local += ' ' + tooltipped_info(preference.info); - } - preferences_html_local += '</div>'; - } - return preferences_html_local; -} - - function frames2lexical_units(frames) { var lexical_units = [] for (var i in frames) { @@ -198,43 +109,6 @@ function frames2lexical_units(frames) { return lexical_units; } -function frames2lexical_unitsHTML(frames) { - var div = document.createElement('div'); - div.className = 'frame mb-3'; - var lexical_units = frames2lexical_units(frames) - var table = document.createElement('table'); - table.className = 'table m-0 table-borderless border border-secondary text-dark'; - var tbody = document.createElement('tbody'); - - var header_row = document.createElement('tr'); - header_row.innerHTML += '<th scope="row" class="py-2 px-1 text-secondary">' + gettext('Jednostka leksykalna') + '</td>'; - header_row.innerHTML += '<th scope="row" class="py-2 px-1 text-secondary">' + gettext('Opinia') + '</td>'; - tbody.append(header_row); - - for (var j in lexical_units) { - let lexical_unit = lexical_units[j]; - let lexical_unit_row = document.createElement('tr'); - lexical_unit_row.innerHTML += '<td class="argument py-2 px-1 border-top border-left border-secondary">' + gettext(lexical_unit.str) + '</td>'; - lexical_unit_row.innerHTML += '<td class="argument py-2 px-1 border-top border-left border-secondary">' + '<img src="' + window.STATIC_URL + 'entries/img/' + lexical_unit.opinion_key + '.svg" width="12" height="12" alt="' + lexical_unit.opinion + '"> ' + gettext(lexical_unit.opinion) + '</td>'; - tbody.append(lexical_unit_row); - } - table.append(tbody); - div.append(table); - - return div; -} - -function show_unified_frame(unified_frame, slowal_frames) { - var unified_frame_dom = unifiedFrame2dom(unified_frame, slowal_frames); - unified_frame_active_frame = unified_frame; - $('#unified-frame').empty().append($(unified_frame_dom)); -} - -function show_unified_frame_lexical_units(frames) { - $('#unified-frame-lexical-units').empty(); - $('#unified-frame-lexical-units').append($(frames2lexical_unitsHTML(frames))); -} - function extract_frames_to_new_frame(unified_frame_id, slowal_frame_ids, target_unified_frame_id) { check_import_status(); clear_entry();