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

Change unified frame status

parent 2c2fed56
Branches
Tags
No related merge requests found
...@@ -378,6 +378,28 @@ export default { ...@@ -378,6 +378,28 @@ export default {
} }
} }
$.prompt(duplicate_popup); $.prompt(duplicate_popup);
},
changeUnifiedFrameStatusToReady() {
let foundNotVerifiedFrame = this.frames.find(frame => !frame.verified);
if(foundNotVerifiedFrame) {
alert(gettext("Wszystkie podpięte ramy powinny być zweryfikowane."));
} else {
var data = {'unified_frame_id': this.unified_frame.id};
$.ajax({
type: 'post',
url: '/' + lang + '/unifier/change_unified_frame_status_to_ready/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
show_info('Status ramy został zmieniony');
this.$emit('goToDisplay')
}.bind(this),
error: function (request, errorType, errorMessage) {
show_error(errorType + ' (' + errorMessage + ')');
}
});
}
} }
}, },
mounted () { mounted () {
...@@ -401,7 +423,7 @@ export default { ...@@ -401,7 +423,7 @@ export default {
<td id="add-arg" @click="addArgument" style="padding: 10px 15px 10px 15px; color: #000000;">Dodaj argum.</td> <td id="add-arg" @click="addArgument" style="padding: 10px 15px 10px 15px; color: #000000;">Dodaj argum.</td>
<td style="padding: 10px 15px 10px 15px; color: #000000;" @click="addSelectivePreference">Dodaj prefer.</td> <td style="padding: 10px 15px 10px 15px; color: #000000;" @click="addSelectivePreference">Dodaj prefer.</td>
<td id="merge" style="padding: 10px 15px 10px 15px; color: #000000;">Scal</td> <td id="merge" style="padding: 10px 15px 10px 15px; color: #000000;">Scal</td>
<td style="padding: 10px 15px 10px 15px; color: #000000;" @click="$emit('goToDisplay')">Gotowe</td> <td style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeUnifiedFrameStatusToReady">Gotowe</td>
</tr> </tr>
<tr style="background-color: white;"> <tr style="background-color: white;">
<td id="change-role" @click="changeRole" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę</td> <td id="change-role" @click="changeRole" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę</td>
......
...@@ -32,7 +32,6 @@ function frames2dom_unidief_view(frames) { ...@@ -32,7 +32,6 @@ function frames2dom_unidief_view(frames) {
table.className = 'table m-0 table-borderless border border-secondary text-dark'; table.className = 'table m-0 table-borderless border border-secondary text-dark';
var tbody = document.createElement('tbody'); var tbody = document.createElement('tbody');
// roles and selectional preferences
var roles_row = document.createElement('tr'); var roles_row = document.createElement('tr');
var frame_col = document.createElement('th'); var frame_col = document.createElement('th');
......
...@@ -19,5 +19,6 @@ urlpatterns = [ ...@@ -19,5 +19,6 @@ urlpatterns = [
path('add_argument/', views.add_argument, name='add_argument'), path('add_argument/', views.add_argument, name='add_argument'),
path('remove_argument/', views.remove_argument, name='remove_argument'), path('remove_argument/', views.remove_argument, name='remove_argument'),
path('duplicate_unified_frame/', views.duplicate_unified_frame, name='duplicate_unified_frame'), path('duplicate_unified_frame/', views.duplicate_unified_frame, name='duplicate_unified_frame'),
path('change_unified_frame_status_to_ready/', views.change_unified_frame_status_to_ready, name='change_unified_frame_status_to_ready'),
] ]
...@@ -10,7 +10,7 @@ from semantics.models import Frame, ArgumentRole, SemanticRole, RoleAttribute ...@@ -10,7 +10,7 @@ from semantics.models import Frame, ArgumentRole, SemanticRole, RoleAttribute
from syntax.models import Schema from syntax.models import Schema
from unifier.models import UnifiedFrameArgument, UnifiedRelationalSelectionalPreference, UnifiedFrame, \ from unifier.models import UnifiedFrameArgument, UnifiedRelationalSelectionalPreference, UnifiedFrame, \
UnifiedFrame2SlowalFrameMapping, UnifiedFrameArgumentSlowalFrameMapping UnifiedFrame2SlowalFrameMapping, UnifiedFrameArgumentSlowalFrameMapping
from . import choices
@ajax_required @ajax_required
@transaction.atomic @transaction.atomic
...@@ -356,3 +356,19 @@ def remove_argument(request): ...@@ -356,3 +356,19 @@ def remove_argument(request):
newUnifiedFrameArgument = UnifiedFrameArgument.objects.get(id=complement_id) newUnifiedFrameArgument = UnifiedFrameArgument.objects.get(id=complement_id)
newUnifiedFrameArgument.delete() newUnifiedFrameArgument.delete()
return JsonResponse({}) return JsonResponse({})
@ajax_required
@transaction.atomic
def change_unified_frame_status_to_ready(request):
if request.method == 'POST':
unified_frame_id = request.POST['unified_frame_id']
unifiedFrame = UnifiedFrame.objects.get(pk=unified_frame_id)
unifiedFrame.status = choices.UnifiedFrameStatus.READY
for mapping in unifiedFrame.unified_frame_2_slowal_frame.all():
mapping.verified = True
mapping.save()
unifiedFrame.save()
return JsonResponse({})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment