diff --git a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue index 48742de688ec329f70b397225550a23a2293bf1e..7cfdf510196279529ac87a00673d5411ff0e387b 100644 --- a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue +++ b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue @@ -704,8 +704,10 @@ Object.assign(LexicalUnitEdit, { } else if (isSuperLeksykograf && frame.status === 'S') { //ustawiany Sprawdzone status = 'G'; - } else { + } else if (isSuperLeksykograf) { status = 'S'; + } else { + alert(gettext("Nie można zmienić statusu ramy.")); } this.change_slowal_frame_status(status); @@ -996,6 +998,25 @@ Object.assign(LexicalUnitEdit, { }); }, }); + }, + frame_reject_as_not_matching_unified_frame() { + this.select_slowal_frame_req(() => { + let selectedFrame = this.active_slowal_frame; + send_post_request(`/unifier/reject_unified_frame_ready_status/`, + {"slowal_frame_id" : selectedFrame.id, "unified_frame_id" : this.unified_frame.id}, + (reponse) => { + show_info('Rama zostaÅ‚a zwrócona do obróbki.'); + alert(gettext("Rama zostaÅ‚a zwrócona do obróbki.")); + this.$emit('refreshEntriesList'); + this.loadFrame(); + $.prompt.close(); + }, + (request, errorType, errorMessage) => { + show_error(errorType + ' (' + errorMessage + ')'); + alert(gettext("Status ramy niew zostaÅ‚ zmieniony. BÅ‚Ä…d: " + errorType + ' (' + errorMessage + ')')); + $.prompt.close(); + }) + }); } }, mounted() { @@ -1131,8 +1152,8 @@ export default LexicalUnitEdit; </tbody> </table> </td><td style="vertical-align: text-top; padding-left: 10px; padding-top: 8px; min-width: 50px;"> - <span class="cursor-pointer" @click.stop="hideSelectionalPreferencies()" title="Ukryj jednostki leksykalne">▴</span> / - <span class="cursor-pointer" @click.stop="showSelectionalPreferencies()" title="Pokaż jednostki leksykalne">▾</span> + <span class="cursor-pointer" @click.stop="hideSelectionalPreferencies()" title="Ukryj preferencje selekcyjne">▴</span> / + <span class="cursor-pointer" @click.stop="showSelectionalPreferencies()" title="Pokaż preferencje selekcyjne">▾</span> </td></tr> </table> </div> @@ -1173,14 +1194,14 @@ export default LexicalUnitEdit; <div :id="'semantics-slowal-frames-pane' + (readOnly ? '-preview' : '')" class="col w-100 p-0 overflow-auto"> <table v-if="!readOnly && unified_frame.id && !isReadOnlyForSuperLeksykograf()" class="table-button-menu sticky-top" cellspacing="1"> <tr style="background-color: white;"> - <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('B')">BÅ‚Ä™dna</td> + <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('B')">{{this.isSuperLeksykograf() ? 'ZÅ‚a' : 'BÅ‚Ä™dna'}}</td> <td id="hide-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(false)">Ukryj gotowe {{showVerifiedFrames ? '' : getSlowalReadyFrameCnt() > 0 ? '(ukrytych: ' + getSlowalReadyFrameCnt() + ')' : ''}}</td> <td id="ready-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="slowal_frame_ready_rollback">{{ statusButtonTitle }}</td> <td id="attach-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="attachSlowalFrame">Podepnij</td> </tr> <tr style="background-color: white;"> <td id="inccorect-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('C')"> - NiepasujÄ…ca + {{this.isSuperLeksykograf() ? 'Nowa' : 'NiepasujÄ…ca'}} </td> <td id="show-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(true)"> Pokaż wszystkie {{this.hidden_frames.length > 0 ? '(ukrytych: ' + this.hidden_frames.length + ')' : ''}} @@ -1189,7 +1210,8 @@ export default LexicalUnitEdit; @click="extract_frame_to_preview_frame"> Przerzuć </td> - <td id="empty-2" style="padding: 10px 15px 10px 15px; color: #000000;"></td> + <td v-if="this.isSuperLeksykograf()" id="reject-button" @click="frame_reject_as_not_matching_unified_frame" style="padding: 10px 15px 10px 15px; color: #000000;">Zwróć</td> + <td v-else id="empty-2" style="padding: 10px 15px 10px 15px; color: #000000;"></td> </tr> </table> <div id="semantics-frames"> diff --git a/unifier/urls.py b/unifier/urls.py index a04cda776be3636ed73142eee23473305097bf46..fe76fed1fbad0c80ea2a812e7741637ba5b70ca8 100644 --- a/unifier/urls.py +++ b/unifier/urls.py @@ -34,4 +34,6 @@ urlpatterns = [ path('check_unified_frame_title_uniq/', views.check_unified_frame_title_uniq, name='check_unified_frame_title_uniq'), path('attach_lu_to_unified_frame/', views.attach_lu_to_unified_frame, name='attach_lu_to_unified_frame'), + path('reject_unified_frame_ready_status/', views.reject_unified_frame_ready_status, name='reject_unified_frame_ready_status'), + ] diff --git a/unifier/views.py b/unifier/views.py index 5297c7627827ec14d53b3b26c7a74502807cc914..e7c63b87beef16a2711e18f69bc6879651c02fde 100644 --- a/unifier/views.py +++ b/unifier/views.py @@ -528,12 +528,23 @@ def change_unified_frame_status_to_ready(request): unified_frame_id = request.POST['unified_frame_id'] unified_frame = UnifiedFrame.objects.get(pk=unified_frame_id) unified_frame.status = UnifiedFrameStatus.READY + unified_frame.save() + return JsonResponse({}) - for mapping in unified_frame.unified_frame_2_slowal_frame.all(): - mapping.verified = True - mapping.save() +@ajax_required +@transaction.atomic +def reject_unified_frame_ready_status(request): + if request.method == 'POST': + unified_frame_id = request.POST['unified_frame_id'] + slowal_frame_id = request.POST['slowal_frame_id'] + unified_frame = UnifiedFrame.objects.get(pk=unified_frame_id) + unified_frame.status = UnifiedFrameStatus.PROCESSING unified_frame.save() + + slowal_frame = Frame.objects.get(pk=slowal_frame_id) + slowal_frame.status = FrameStatus.PROCESSING + slowal_frame.save() return JsonResponse({})