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
815e6b04
Commit
815e6b04
authored
Jun 9, 2022
by
dcz2
Committed by
Piotr Bieńkowski
Jun 15, 2022
Browse files
Options
Downloads
Patches
Plain Diff
Existing preferences popup tab
parent
6eff79b5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
entries/static/entries/js/selectional_preference.js
+22
-4
22 additions, 4 deletions
entries/static/entries/js/selectional_preference.js
entries/static/entries/js/unification.js
+4
-5
4 additions, 5 deletions
entries/static/entries/js/unification.js
entries/views.py
+7
-1
7 additions, 1 deletion
entries/views.py
with
33 additions
and
10 deletions
entries/static/entries/js/selectional_preference.js
+
22
−
4
View file @
815e6b04
...
@@ -3,6 +3,16 @@ var relations = [];
...
@@ -3,6 +3,16 @@ var relations = [];
var
synsets
=
[];
var
synsets
=
[];
var
change
=
false
;
var
change
=
false
;
function
existingSelect
()
{
let
availablePreferencies
=
slowal_frames2selecional_preferencies
(
unified_frame_active_frame
,
unified_view_frame_content
)[
unified_frame_active_argument_id
];
if
(
!
availablePreferencies
)
{
return
gettext
(
'
Brak preferencji selekcyjnych do wyboru.
'
)
}
return
availablePreferencies
.
map
(
preference
=>
{
return
`<label><input type="checkbox" name="existing" value="
${
preference
.
type
}
:
${
preference
.
id
}
" />
${
preference
.
str
}
</label><br />`
;
}).
join
(
""
);
}
function
predefinedSelect
()
{
function
predefinedSelect
()
{
var
display
=
""
;
var
display
=
""
;
...
@@ -251,7 +261,7 @@ function addSelectivePreferenceBase(unified_frame, frame, complement_id) {
...
@@ -251,7 +261,7 @@ function addSelectivePreferenceBase(unified_frame, frame, complement_id) {
},
},
state4
:
{
state4
:
{
title
:
'
Wybierz z istniejących
'
,
title
:
'
Wybierz z istniejących
'
,
html
:
'
TODO
'
,
html
:
existingSelect
()
,
buttons
:
{
Anuluj
:
-
1
,
Zatwierdź
:
1
},
buttons
:
{
Anuluj
:
-
1
,
Zatwierdź
:
1
},
focus
:
1
,
focus
:
1
,
submit
:
function
(
e
,
v
,
m
,
f
){
submit
:
function
(
e
,
v
,
m
,
f
){
...
@@ -261,9 +271,17 @@ function addSelectivePreferenceBase(unified_frame, frame, complement_id) {
...
@@ -261,9 +271,17 @@ function addSelectivePreferenceBase(unified_frame, frame, complement_id) {
}
}
if
(
v
==
1
)
{
if
(
v
==
1
)
{
e
.
preventDefault
();
e
.
preventDefault
();
normalizeFormData
(
f
.
existing
).
map
(
choice
=>
{
// TODO
let
[
type
,
id
]
=
choice
.
split
(
'
:
'
);
switch
(
type
)
{
case
'
meanings.Synset
'
:
saveSynsetPreference
(
unified_frame_id
,
complement_id
,
id
);
case
'
semantics.PredefinedSelectionalPreference
'
:
savePredefinedPreference
(
unified_frame_id
,
complement_id
,
id
);
case
'
semantics.RelationalSelectionalPreference
'
:
saveRelationalSelectionalPreference
(
unified_frame_id
,
complement_id
,
null
,
null
);
// TODO
}
});
$
.
prompt
.
goToState
(
'
state0
'
);
$
.
prompt
.
goToState
(
'
state0
'
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
entries/static/entries/js/unification.js
+
4
−
5
View file @
815e6b04
...
@@ -298,8 +298,7 @@ function unifiedFrame2dom(unifiedFrame, slowal_frames) {
...
@@ -298,8 +298,7 @@ function unifiedFrame2dom(unifiedFrame, slowal_frames) {
let
selecional_preferencies_poposition
=
slowal_frames2selecional_preferencies_mapping
[
argument
.
id
]
let
selecional_preferencies_poposition
=
slowal_frames2selecional_preferencies_mapping
[
argument
.
id
]
if
(
selecional_preferencies_poposition
!=
null
)
{
if
(
selecional_preferencies_poposition
!=
null
)
{
let
selectional_preference_proposition_html
=
create_selectional_preference_html
(
selecional_preferencies_poposition
,
''
);
preferences_html
+=
create_selectional_preference_html
(
selecional_preferencies_poposition
,
''
);
preferences_html
+=
selectional_preference_proposition_html
;
}
}
// *** and we want to close the <td> here
// *** and we want to close the <td> here
...
@@ -314,7 +313,7 @@ function unifiedFrame2dom(unifiedFrame, slowal_frames) {
...
@@ -314,7 +313,7 @@ function unifiedFrame2dom(unifiedFrame, slowal_frames) {
return
div
;
return
div
;
}
}
function
create_selectional_preference_html
(
preferences
,
additio
a
n_css_class
)
{
function
create_selectional_preference_html
(
preferences
,
addition
al
_css_class
)
{
let
preferences_html_local
=
''
;
let
preferences_html_local
=
''
;
for
(
var
j
in
preferences
)
{
for
(
var
j
in
preferences
)
{
var
preference
=
preferences
[
j
];
var
preference
=
preferences
[
j
];
...
@@ -324,9 +323,9 @@ function create_selectional_preference_html(preferences, additioan_css_class) {
...
@@ -324,9 +323,9 @@ function create_selectional_preference_html(preferences, additioan_css_class) {
}
}
preferences_html_local
+=
'
<div class="preference py-2 px-1
'
+
cls
+
'
">
'
;
preferences_html_local
+=
'
<div class="preference py-2 px-1
'
+
cls
+
'
">
'
;
if
(
preference
.
url
)
{
if
(
preference
.
url
)
{
preferences_html_local
+=
'
<a class="synset-plwn
'
+
additio
a
n_css_class
+
'
" href="
'
+
preference
.
url
+
'
" target="_blank">
'
+
preference
.
str
+
'
</a>
'
;
preferences_html_local
+=
'
<a class="synset-plwn
'
+
addition
al
_css_class
+
'
" href="
'
+
preference
.
url
+
'
" target="_blank">
'
+
preference
.
str
+
'
</a>
'
;
}
else
{
}
else
{
preferences_html_local
+=
'
<span class="
'
+
additio
a
n_css_class
+
'
">
'
+
preference
.
str
+
'
</span>
'
;
preferences_html_local
+=
'
<span class="
'
+
addition
al
_css_class
+
'
">
'
+
preference
.
str
+
'
</span>
'
;
}
}
if
(
preference
.
info
)
{
if
(
preference
.
info
)
{
preferences_html_local
+=
'
'
+
tooltipped_info
(
preference
.
info
);
preferences_html_local
+=
'
'
+
tooltipped_info
(
preference
.
info
);
...
...
This diff is collapsed.
Click to expand it.
entries/views.py
+
7
−
1
View file @
815e6b04
...
@@ -516,11 +516,15 @@ def get_synset_def(synset):
...
@@ -516,11 +516,15 @@ def get_synset_def(synset):
def
get_prefs_list
(
argument
):
def
get_prefs_list
(
argument
):
return
sorted
(
return
sorted
(
({
({
'
id
'
:
p
.
pk
,
'
type
'
:
p
.
_meta
.
label
,
'
str
'
:
str
(
p
),
'
str
'
:
str
(
p
),
}
for
p
in
argument
.
predefined
.
all
()),
}
for
p
in
argument
.
predefined
.
all
()),
key
=
lambda
x
:
x
[
'
str
'
]
key
=
lambda
x
:
x
[
'
str
'
]
)
+
sorted
(
)
+
sorted
(
({
({
'
id
'
:
s
.
pk
,
'
type
'
:
s
.
_meta
.
label
,
'
str
'
:
str
(
s
),
'
str
'
:
str
(
s
),
# can be a new synset
# can be a new synset
'
url
'
:
None
if
s
.
id
<
0
else
'
http://plwordnet21.clarin-pl.eu/synset/{}
'
.
format
(
s
.
id
),
'
url
'
:
None
if
s
.
id
<
0
else
'
http://plwordnet21.clarin-pl.eu/synset/{}
'
.
format
(
s
.
id
),
...
@@ -529,6 +533,8 @@ def get_prefs_list(argument):
...
@@ -529,6 +533,8 @@ def get_prefs_list(argument):
key
=
lambda
x
:
x
[
'
str
'
]
key
=
lambda
x
:
x
[
'
str
'
]
)
+
sorted
(
)
+
sorted
(
({
({
'
id
'
:
r
.
pk
,
'
type
'
:
r
.
_meta
.
label
,
'
str
'
:
str
(
r
),
'
str
'
:
str
(
r
),
'
info
'
:
get_rel_pref_desc
(
r
),
'
info
'
:
get_rel_pref_desc
(
r
),
}
for
r
in
argument
.
relations
.
all
()),
}
for
r
in
argument
.
relations
.
all
()),
...
...
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