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

+extract_frames_to_new_frame

+extract_frames_to_frame
parent 97e03b20
Branches
No related tags found
No related merge requests found
......@@ -447,6 +447,7 @@ export default {
data: data,
timeout: 60000,
success: function (response) {
show_info('Argumenty w ramie zostały zmienione');
this.loadFrame();
}.bind(this),
error: function (request, errorType, errorMessage) {
......@@ -456,8 +457,6 @@ export default {
}
},
change_slowal2unified_mapping_verification(slowal_frame_id, verified) {
// check_import_status();
// show_entry_spinners();
var data = {
'unified_frame_id': this.unified_frame.id,
'slowal_frame_id': slowal_frame_id,
......@@ -470,6 +469,7 @@ export default {
data: data,
timeout: 60000,
success: function (response) {
show_info('Status ramy został zmieniony');
this.loadFrame();
}.bind(this),
error: function (request, errorType, errorMessage) {
......@@ -477,6 +477,77 @@ export default {
}
});
},
slowalFrameSelected(frame) {
if (this.active_slowal_frame === frame) {
this.active_slowal_frame = null;
} else {
this.active_slowal_frame = frame;
}
},
extract_frames_to_new_frame() {
var existingSelect = function () {
return this.frames.map(frame => {
return `<label><input type="checkbox" name="frames" value="${frame.id}" /> ${lexical_units2dom(frame.lexical_units)}</label><br />`;
}).join("");
}.bind(this);
var extract_frames_to_new_frame_popup = {
state0: {
title: 'Podaj nazwę zduplikowanej ramy',
html: existingSelect,
buttons: {Anuluj: 0, Wydziel: 1},
focus: -1,
submit: function (e, v, m, f) {
if (v == 0) {
e.preventDefault();
$.prompt.close();
}
if (v === 1) {
e.preventDefault();
let frame_ids = normalizeFormData(f.frames);
var data = { 'unified_frame_id' : this.unified_frame.id, 'slowal_frame_ids' : JSON.stringify(frame_ids),
'target_unified_frame_id': ''};
$.ajax({
type : 'post',
url : '/' + lang + '/unifier/extract_frames_to_new_frame/',
dataType : 'json',
data : data,
timeout : 60000,
success : function(response) {
show_info('Ramy zostały wydzielone do nowej ramy zunifikowanej.');
this.loadFrame();
$.prompt.close();
}.bind(this),
error: function(request, errorType, errorMessage) {
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
}
}.bind(this)
}
}
$.prompt(extract_frames_to_new_frame_popup);
},
extract_frames_to_frame(target_unified_frame_id) {
var data = { 'unified_frame_id' : this.unified_frame.id, 'slowal_frame_ids' : JSON.stringify([this.active_slowal_frame.id]),
'target_unified_frame_id': target_unified_frame_id };
$.ajax({
type : 'post',
url : '/' + lang + '/unifier/extract_frames_to_new_frame/',
dataType : 'json',
data : data,
timeout : 60000,
success : function(response) {
show_info('Zaznaczona rama została przeniosiona.');
this.loadFrame();
},
error: function(request, errorType, errorMessage) {
show_error(errorType + ' (' + errorMessage + ')');
}
});
}
},
mounted() {
Split(['#semantics-frames-pane', '#semantics-schemata-pane'], {
......@@ -596,7 +667,7 @@ export default {
<td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;">Błędna</td>
<td
style="padding: 10px 15px 10px 15px; color: #000000;"
onclick="extract_frames_to_new_frame(1, [104274,104238], null)"
@click="extract_frames_to_new_frame()"
>
Rozdziel
</td>
......@@ -609,7 +680,7 @@ export default {
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)">
@click="extract_frames_to_frame(1)">
Przerzuć
</td>
<td id="show-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;">
......@@ -630,7 +701,7 @@ export default {
<tbody>
<tr>
<th scope="row">
<div v-html="slowal_frame_html(frame)"></div>
<div v-html="slowal_frame_html(frame)" @click="slowalFrameSelected(frame)"></div>
</th>
<th scope="row">
<div>
......
......@@ -108,25 +108,3 @@ function frames2lexical_units(frames) {
}
return lexical_units;
}
function extract_frames_to_new_frame(unified_frame_id, slowal_frame_ids, target_unified_frame_id) {
check_import_status();
clear_entry();
show_entry_spinners();
var data = { 'unified_frame_id' : unified_frame_id, 'slowal_frame_ids' : JSON.stringify(slowal_frame_ids),
'target_unified_frame_id': target_unified_frame_id };
$.ajax({
type : 'post',
url : '/' + lang + '/unifier/extract_frames_to_new_frame/',
dataType : 'json',
data : data,
timeout : 60000,
success : function(response) {
unified_frame_id = response.unified_frame_id;
},
error: function(request, errorType, errorMessage) {
show_error(errorType + ' (' + errorMessage + ')');
}
});
}
......@@ -121,6 +121,7 @@ class UnifiedRelationalSelectionalPreference(models.Model):
class UnifiedFrame2SlowalFrameMapping(models.Model):
verified = models.BooleanField(default=False)
removed = models.BooleanField(default=False)
unified_frame = models.ForeignKey(UnifiedFrame, related_name='unified_frame_2_slowal_frame', on_delete=models.PROTECT)
slowal_frame = models.OneToOneField(Frame, related_name='slowal_frame_2_unified_frame', on_delete=models.PROTECT)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment