Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ValUnifer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IPIPAN
ValUnifer
Commits
ce8faaf3
Commit
ce8faaf3
authored
Jun 30, 2022
by
dcz
Browse files
Options
Downloads
Patches
Plain Diff
Role type selection.
parent
8caf4974
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
entries/static/entries/js/components/LexicalUnitEdit.js
+12
-3
12 additions, 3 deletions
entries/static/entries/js/components/LexicalUnitEdit.js
unifier/views.py
+3
-1
3 additions, 1 deletion
unifier/views.py
with
15 additions
and
4 deletions
entries/static/entries/js/components/LexicalUnitEdit.js
+
12
−
3
View file @
ce8faaf3
...
...
@@ -265,7 +265,14 @@ Object.assign(LexicalUnitEdit, {
let
attributesHTML
=
role_attributes
.
map
(
attribute
=>
{
return
`<label><input type="radio" name="attribute" value="
${
attribute
.
id
}
" />
${
attribute
.
attribute
}
</label><br />`
;
}).
join
(
""
);
return
'
<div class="row"><div class="column"><div class="role_select_header">Role</div>
'
+
rolesHTML
+
'
</div><div class="column"><div class="role_select_header">Atrybuty</div>
'
+
attributesHTML
+
'
</div></div>
'
;
const
roleTypeHTML
=
[
'
role
'
,
'
modifier
'
].
map
(
type
=>
{
return
`<label><input type="radio" name="role_type" value="
${
type
}
" />
${
type
}
</label><br />`
;
}).
join
(
""
);
return
'
<div class="row">
'
+
'
<div class="column"><div class="role_select_header">Type</div>
'
+
roleTypeHTML
+
'
</div>
'
+
'
<div class="column"><div class="role_select_header">Role</div>
'
+
rolesHTML
+
'
</div>
'
+
'
<div class="column"><div class="role_select_header">Atrybuty</div>
'
+
attributesHTML
+
'
</div>
'
+
'
</div>
'
;
}.
bind
(
this
);
let
change_role_popup
=
{
...
...
@@ -343,13 +350,15 @@ Object.assign(LexicalUnitEdit, {
e
.
preventDefault
();
var
role_id
=
normalizeFormData
(
f
.
role
)[
0
];
var
role_type
=
normalizeFormData
(
f
.
role_type
)[
0
];
if
(
role_id
!=
null
)
{
if
(
role_id
!=
null
&&
role_type
!=
null
)
{
var
attribute_id
=
normalizeFormData
(
f
.
attribute
)[
0
];
var
data
=
{
'
unified_frame_id
'
:
this
.
unified_frame
.
id
,
'
complement_id
'
:
this
.
active_unified_frame_argument
.
id
,
'
role_type
'
:
role_type
,
'
role_id
'
:
role_id
,
'
attribute_id
'
:
attribute_id
};
...
...
@@ -369,7 +378,7 @@ Object.assign(LexicalUnitEdit, {
}
});
}
else
{
alert
(
gettext
(
"
Musisz wybrać
pzynajmniej
rolę.
"
));
alert
(
gettext
(
"
Musisz wybrać
typ oraz
rolę.
"
));
}
}
}.
bind
(
this
)
...
...
This diff is collapsed.
Click to expand it.
unifier/views.py
+
3
−
1
View file @
ce8faaf3
...
...
@@ -6,7 +6,7 @@ from django.http import JsonResponse
from
common.decorators
import
ajax_required
from
entries.polish_strings
import
EXAMPLE_SOURCE
,
EXAMPLE_OPINION
from
entries.views
import
get_scroller_params
,
get_alternations
,
get_prefs_list
,
schema2dict
,
frame2dict
from
semantics.models
import
Frame
,
ArgumentRole
,
SemanticRole
,
RoleAttribute
from
semantics.models
import
Frame
,
ArgumentRole
,
SemanticRole
,
RoleAttribute
,
RoleType
from
syntax.models
import
Schema
from
unifier.models
import
UnifiedFrameArgument
,
UnifiedRelationalSelectionalPreference
,
UnifiedFrame
,
\
UnifiedFrame2SlowalFrameMapping
,
UnifiedFrameArgumentSlowalFrameMapping
...
...
@@ -321,6 +321,7 @@ def save_new_role(request):
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
complement_id
=
request
.
POST
[
'
complement_id
'
]
role_id
=
request
.
POST
[
'
role_id
'
]
role_type
=
request
.
POST
[
'
role_type
'
]
attribute_id
=
request
.
POST
.
get
(
'
attribute_id
'
,
None
)
argumentRole
=
ArgumentRole
.
objects
.
filter
(
role_id
=
role_id
,
attribute_id
=
attribute_id
).
first
()
...
...
@@ -330,6 +331,7 @@ def save_new_role(request):
unifiedFrameArgument
=
UnifiedFrameArgument
.
objects
.
get
(
unified_frame_id
=
unified_frame_id
,
id
=
complement_id
)
unifiedFrameArgument
.
role
=
argumentRole
unifiedFrameArgument
.
role_type
=
RoleType
.
objects
.
get
(
type
=
role_type
)
unifiedFrameArgument
.
save
()
return
JsonResponse
({})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment