From d67e67014c5bb2477a5c178e8b16cda906319ed9 Mon Sep 17 00:00:00 2001 From: dcz <dcz@ipipan.waw.pl> Date: Mon, 24 Jul 2023 16:15:13 +0200 Subject: [PATCH] +colors to frame role change window simple unification frame service bugfix --- entries/views.py | 7 +++++-- .../unification/Unification/LexicalUnitEdit.vue | 2 +- unifier/views.py | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/entries/views.py b/entries/views.py index 9ad899e..eb3210f 100644 --- a/entries/views.py +++ b/entries/views.py @@ -1018,11 +1018,12 @@ def ajax_predefined_preferences(request): return context + @ajax(method='get', encode_result=True) def ajax_roles(request): roles = [] for role in SemanticRole.objects.order_by('priority'): - roles.append({"id": role.id, "role": role.role, "priority": role.priority}) + roles.append({"id": role.id, "role": role.role, "priority": role.priority, "color": role.color}) context = { 'roles': roles, @@ -1030,11 +1031,13 @@ def ajax_roles(request): return context + @ajax(method='get', encode_result=True) def ajax_role_attributes(request): roleAttributes = [] for roleAttribute in RoleAttribute.objects.order_by('priority'): - roleAttributes.append({"id": roleAttribute.id, "attribute": roleAttribute.attribute, "priority": roleAttribute.priority}) + roleAttributes.append({"id": roleAttribute.id, "attribute": roleAttribute.attribute, + "priority": roleAttribute.priority, "gradient": roleAttribute.gradient}) context = { 'role_attributes': roleAttributes, diff --git a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue index a2ea35f..11d5298 100644 --- a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue +++ b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue @@ -273,7 +273,7 @@ Object.assign(LexicalUnitEdit, { const newSelect = function () { let rolesHTML = roles.map(role => { - return `<label><input type="radio" name="role" value="${role.id}" /> ${role.role}</label><br />`; + return `<label style="background-color:rgb(${role.color})"><input type="radio" name="role" value="${role.id}" /> ${role.role}</label><br />`; }).join(""); let attributesHTML = role_attributes.map(attribute => { return `<label><input type="radio" name="attribute" value="${attribute.id}" /> ${attribute.attribute}</label><br />`; diff --git a/unifier/views.py b/unifier/views.py index f9ca637..41a0d07 100644 --- a/unifier/views.py +++ b/unifier/views.py @@ -550,11 +550,12 @@ def create_unified_frame(frame_id): @csrf_exempt def build_unified_frame_xml(request): - if request.method == 'POST': - lu_id = request.GET.get('lu_id') + if request.method == 'GET': + frame_id = request.GET.get('frame_id') - lu = LexicalUnit.objects.get(pk=lu_id) - frames = list(lu.frames.all()) + frames = Frame.objects.filter(id=frame_id) + # lu = LexicalUnit.objects.get(pk=lu_id) + # frames = list(lu.frames.all()) if len(frames) > 0: matching_elem = Element('matching') unifier_frame_elem = SubElement(matching_elem, 'unifier_frame') -- GitLab