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

Lus bugfixes.

parent e9eba7c5
No related branches found
No related tags found
No related merge requests found
......@@ -4,3 +4,10 @@ window.update_entries = function () {
window.unificationLeftPaneApp.lexicalUnitId = null;
}
}
window.update_view = function () {
if(window.unificationLeftPaneApp) {
window.unificationLeftPaneApp.unificationEntriesListRefreshKey++;
window.unificationLeftPaneApp.lexicalUnitId = null;
}
}
......@@ -31,6 +31,11 @@
</script>
<template>
<div id="overlay">
<div class="cv-spinner">
<span class="spinner"></span>
</div>
</div>
<div id="entries-list" class="col h-100 w-100 pr-0 overflow-hidden">
<div id="entries-list-div" class="col p-0 h-100 w-100 overflow-hidden">
<free-lus-list @entry-selected="entrySelected"/>
......
......@@ -161,7 +161,7 @@
{
'frame_id': this.active_slowal_frame.id,
},
(reponse) => {
(response) => {
show_info('Rama została przełączona w tryb edycji.');
this.loadEntry();
$.prompt.close();
......@@ -210,27 +210,22 @@
if (v === 1) {
e.preventDefault();
let lu_ids = normalizeFormData(f.lus);
const data = {
send_post_request('/freelus/' + (frame_in_progress ? 'change_lus_in_slowal_frame' : 'create_new_slowal_frame') + '/',
{
'lu_ids': JSON.stringify(lu_ids),
'entry_id': this.entryId,
'frame_id': frame_in_progress ? frame_in_progress.id : null
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/' + (frame_in_progress ? 'change_lus_in_slowal_frame' : 'create_new_slowal_frame') + '/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
// show_info(frame_in_progress ? 'Nowa rama została stworzona.' : 'Lista podpiętych jednostek leksyklanych zostala zmieniona.');
},
(response) => {
show_info(frame_in_progress ? 'Nowa rama została stworzona.' : 'Lista podpiętych jednostek leksyklanych zostala zmieniona.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
}
}.bind(this)
}
......@@ -260,26 +255,21 @@
if (v === 1) {
e.preventDefault();
let example_ids = normalizeFormData(f.lus);
const data = {
send_post_request('/freelus/attach_examples_to_frame/',
{
'example_ids': JSON.stringify(example_ids),
'selected_lus': JSON.stringify(this.selectedLus.map(e => e.id)),
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/attach_examples_to_frame/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
},
(response) => {
show_info('Przykłady zostały przypisane.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
}
}.bind(this)
}
......@@ -319,7 +309,7 @@
'frame_id': this.frame_in_progress.id,
'opinion_id': opinion_id,
},
(reponse) => {
(response) => {
show_info('Opinia została zmieniona.');
this.loadEntry();
$.prompt.close();
......@@ -351,26 +341,19 @@
if (this.selected_frame_argument_id === null) {
alert(gettext("Zaznacz argument, który chcesz usunąć."));
} else {
const data = {
send_post_request('/freelus/remove_argument_from_frame/',
{
'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]),
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/remove_argument_from_frame/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
// alert(gettext("Argument został usunięty."));
},
(response) => {
show_info('Argument został usunięty.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
}
},
change_role(selected_frame_argument_id, api_path) {
......@@ -414,31 +397,24 @@
const sub_attribute_id = normalizeFormData(f.sub_attribute)[0];
const data = {
send_post_request('/freelus/' + api_path + '/',
{
'frame_id': this.frame_in_progress.id,
'argument_id': selected_frame_argument_id,
'role_id': role_id,
'attribute_id': attribute_id,
'sub_attribute_id': sub_attribute_id
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/' + api_path + '/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
// alert(gettext("Nowa rola zosała zapisana."));
},
(response) => {
show_info('Nowa rola zosała zapisana.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
} else {
alert(gettext("Musisz wybrać typ oraz rolę."));
}
......@@ -462,101 +438,79 @@
this.selected_frame_argument_id = null;
this.selectedFrameArguments = [];
}
// const selectedArguments = this.frame_in_progress.arguments.filter(argument => argument.selected)
// this.$emit('frameSelectionChanged', selectedArguments);
},
assign_schema() {
if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) {
const data = {
send_post_request('/freelus/attach_schema_to_argument/',
{
'frame_id': parseInt(this.frame_in_progress.id),
'subentry_id': parseInt(this.selected_schemata_subentry_id),
'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]),
'schema_id': parseInt(this.selectedSchemas[0].id),
'schema_position_id': parseInt(this.selected_schemata_position_id.split('-')[1]),
'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1)
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/attach_schema_to_argument/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
},
(response) => {
if(response['succ'] == true) {
// alert(gettext("Argument ramy został powiązany z tybranym argumentem schematu."));
show_info('Argument ramy został powiązany z tybranym argumentem schematu.');
show_info('Argument ramy został powiązany z wybranym argumentem schematu.');
this.loadEntry();
} else {
alert(gettext(response['error']));
show_info(response['error']);
}
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
} else {
alert(gettext("W celu powiązania schamatu oraz ramy zaznacz argument ramy oraz argument schematu."));
}
},
delete_schema_connections() {
if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) {
const data = {
send_post_request('/freelus/delete_schema_to_argument_connection/',
{
'frame_id': this.frame_in_progress.id,
'subentry_id': parseInt(this.selected_schemata_subentry_id),
'argument_id': this.selected_frame_argument_id.split('-')[1],
'schema_id': this.selectedSchemas[0].id,
'schema_position_id': this.selected_schemata_position_id.split('-')[1],
'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1)
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/delete_schema_to_argument_connection/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
// alert(gettext("Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte."));
},
(response) => {
show_info('Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
} else {
alert(gettext("W celu usunięcia powiązania schamatu oraz ramy zaznacz argument ramy oraz argument schematu."));
}
},
finish_frame_building() {
if (this.frame_in_progress) {
const data = {
send_post_request('/freelus/finish_frame_processing/',
{
'frame_id': this.frame_in_progress.id,
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/finish_frame_processing/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
},
(response) => {
alert(gettext("Rama została oznaczona jako gotowa."));
show_info('Rama została oznaczona jako gotowa.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
},
(request, errorType, errorMessage) => {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
})
} else {
alert(gettext("W celu usunięcia powiązania schamatu oraz ramy zaznacz argument ramy oraz argument schematu."));
}
......@@ -620,12 +574,12 @@
@click="change_role(selected_frame_argument_id ? selected_frame_argument_id.split('-')[1] : null, 'change_role')"
style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę
</td>
<td id="remove-argument" class="table-button-menu-td" @click="remove_argument()"
style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argument
</td>
<td id="delete-schema" class="table-button-menu-td" @click="delete_schema_connections()"
style="padding: 10px 15px 10px 15px; color: #000000;">Odłącz argument
</td>
<td id="remove-argument" class="table-button-menu-td" @click="remove_argument()"
style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argument
</td>
<td id="change-frame-opinion" class="table-button-menu-td" @click="change_frame_opinion()"
style="padding: 10px 15px 10px 15px; color: #000000;">Zmień opinię
</td>
......
......@@ -50,6 +50,11 @@ export default {
</script>
<template>
<div id="overlay">
<div class="cv-spinner">
<span class="spinner"></span>
</div>
</div>
<div id="entries-list" class="col h-100 w-100 pr-0 overflow-hidden">
<div id="entries-list-div" class="col p-0 h-100 w-100 overflow-hidden">
<unification-frames-list
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment