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
ceb40e5c
Commit
ceb40e5c
authored
Jul 13, 2022
by
dcz
Browse files
Options
Downloads
Patches
Plain Diff
New unified frame require title.
parent
269520f0
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/components/LexicalUnitDisplay.js
+39
-12
39 additions, 12 deletions
entries/static/entries/js/components/LexicalUnitDisplay.js
unifier/urls.py
+1
-1
1 addition, 1 deletion
unifier/urls.py
unifier/views.py
+41
-15
41 additions, 15 deletions
unifier/views.py
with
81 additions
and
28 deletions
entries/static/entries/js/components/LexicalUnitDisplay.js
+
39
−
12
View file @
ceb40e5c
...
...
@@ -31,11 +31,32 @@ export default {
goToEdit
(
unifiedFrameId
,
entryId
,
lexicalUnitId
)
{
window
.
location
=
`/
${
lang
}
/entries/unification?unified_frame_id=
${
unifiedFrameId
}
&entry_id=
${
entryId
}
&lexical_unit_id=
${
lexicalUnitId
}
`
;
},
hasWhiteSpace
(
s
)
{
return
/
\s
/g
.
test
(
s
);
},
take
()
{
const
create_title_popup
=
{
state0
:
{
title
:
'
Wprowadź nazwę ramy
'
,
html
:
'
<input type="text" size="32" name="title" />
'
,
buttons
:
{
Anuluj
:
0
,
Zapisz
:
1
},
focus
:
-
1
,
submit
:
function
(
e
,
v
,
m
,
f
)
{
if
(
v
==
0
)
{
$
.
prompt
.
close
();
}
if
(
v
===
1
)
{
e
.
preventDefault
();
const
title
=
f
.
title
;
if
(
this
.
hasWhiteSpace
(
title
)
||
title
.
length
===
0
)
{
alert
(
gettext
(
"
Nazwa zunifikowanej ramy nie może być pusta oraz nie może zawierać białych znaków.
"
));
}
else
{
const
data
=
{
'
lu_id
'
:
this
.
lexicalUnitId
,
'
unified_frame_title
'
:
title
};
$
.
ajax
({
type
:
'
post
'
,
url
:
`/
${
lang
}
/unifier/frame_assign/
${
this
.
lexicalUnitId
}
/
`
,
url
:
`/
${
lang
}
/unifier/frame_assign/`
,
dataType
:
'
json
'
,
data
:
data
,
timeout
:
60000
,
success
:
function
(
response
)
{
show_info
(
'
Rama została stworzona oraz przypisana użytkownikowi.
'
);
...
...
@@ -45,6 +66,12 @@ export default {
show_error
(
errorType
+
'
(
'
+
errorMessage
+
'
)
'
);
}
});
}
}
}.
bind
(
this
)
}
}
$
.
prompt
(
create_title_popup
);
},
statusChange
(
api_method
)
{
$
.
ajax
({
...
...
This diff is collapsed.
Click to expand it.
unifier/urls.py
+
1
−
1
View file @
ceb40e5c
...
...
@@ -22,7 +22,7 @@ urlpatterns = [
path
(
'
change_unified_frame_status_to_ready/
'
,
views
.
change_unified_frame_status_to_ready
,
name
=
'
change_unified_frame_status_to_ready
'
),
path
(
'
remove_selectional_preference/
'
,
views
.
remove_selectional_preference
,
name
=
'
remove_selectional_preference
'
),
path
(
'
build_unified_frame_xml/
'
,
views
.
build_unified_frame_xml
,
name
=
'
build_unified_frame_xml
'
),
path
(
'
frame_assign/
<int:lu_id>/
'
,
views
.
frame_assign
,
name
=
'
frame_assign
'
),
path
(
'
frame_assign/
'
,
views
.
frame_assign
,
name
=
'
frame_assign
'
),
path
(
'
delete_unified_frame/<int:unified_frame_id>/
'
,
views
.
delete_unified_frame
,
name
=
'
delete_unified_frame
'
),
]
This diff is collapsed.
Click to expand it.
unifier/views.py
+
41
−
15
View file @
ceb40e5c
...
...
@@ -223,6 +223,7 @@ def get_unified_frame(request):
return
JsonResponse
({})
@ajax_required
@transaction.atomic
def
extract_frames_to_new_frame
(
request
):
if
request
.
method
==
'
POST
'
:
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
...
...
@@ -239,6 +240,7 @@ def extract_frames_to_new_frame(request):
return
JsonResponse
({})
@ajax_required
@transaction.atomic
def
remove_selectional_preference
(
request
):
if
request
.
method
==
'
POST
'
:
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
...
...
@@ -255,6 +257,7 @@ def remove_selectional_preference(request):
return
JsonResponse
({})
@ajax_required
@transaction.atomic
def
duplicate_unified_frame
(
request
):
if
request
.
method
==
'
POST
'
:
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
...
...
@@ -266,6 +269,7 @@ def duplicate_unified_frame(request):
return
JsonResponse
({})
@ajax_required
@transaction.atomic
def
change_slowal2unified_fram_argument_mapping
(
request
):
if
request
.
method
==
'
POST
'
:
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
...
...
@@ -302,6 +306,7 @@ def change_slowal2unified_fram_argument_mapping(request):
return
JsonResponse
({})
@ajax_required
@transaction.atomic
def
change_slowal_frame_status
(
request
):
if
request
.
method
==
'
POST
'
:
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
...
...
@@ -454,7 +459,25 @@ def build_unified_frame_xml(request):
@ajax_required
@transaction.atomic
def
frame_assign
(
request
,
lu_id
):
def
save_unified_frame_title
(
request
):
if
request
.
method
==
'
POST
'
:
unified_frame_id
=
request
.
POST
[
'
unified_frame_id
'
]
unified_frame_title
=
request
.
POST
[
'
unified_frame_title
'
]
unifiedFrame
=
UnifiedFrame
.
objects
.
get
(
id
=
unified_frame_id
)
if
unifiedFrame
:
unifiedFrame
.
title
=
unified_frame_title
unifiedFrame
.
save
()
return
JsonResponse
({})
@ajax_required
@transaction.atomic
def
frame_assign
(
request
):
if
request
.
method
==
'
POST
'
:
lu_id
=
request
.
POST
[
'
lu_id
'
]
unified_frame_title
=
request
.
POST
[
'
unified_frame_title
'
]
unified_frame_pk
=
create_unified_frame
(
lu_id
)
...
...
@@ -462,6 +485,8 @@ def frame_assign(request, lu_id):
UnifiedFrame
.
objects
,
pk
=
unified_frame_pk
,
)
unifiedFrame
.
title
=
unified_frame_title
unifiedFrame
.
save
()
slowal_frames
=
[
connection
.
slowal_frame
for
connection
in
unifiedFrame
.
unified_frame_2_slowal_frame
.
all
()]
...
...
@@ -475,6 +500,7 @@ def frame_assign(request, lu_id):
}
return
JsonResponse
(
ret
)
return
JsonResponse
({})
def
removeUnifiedFrameMappingsAndAssigments
(
unified_frame_id
):
#odpianie z ramy zunifikowanej
...
...
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