Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dmx-plugins
dmx-zukunftswerk
Commits
0da25363
Commit
0da25363
authored
Jan 27, 2022
by
Jörg Richter
Browse files
Fix: edit documents, pt. 2
See dmx-projects/zukunftswerk#47
parent
49283b0f
Pipeline
#15520
passed with stages
in 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/js/components/zw-document.vue
View file @
0da25363
...
...
@@ -98,28 +98,33 @@ export default {
computed
:
{
docName
()
{
if
(
this
.
docNameTopics
.
de
&&
this
.
docNameTopics
.
fr
)
{
return
this
.
docNameTopics
[
this
.
lang
].
value
}
else
if
(
this
.
docNameTopics
.
de
)
{
return
this
.
docNameTopics
.
de
.
value
}
else
if
(
this
.
docNameTopics
.
fr
)
{
return
this
.
docNameTopics
.
fr
.
value
const
de
=
this
.
docNames
.
de
&&
this
.
docNames
.
de
.
value
const
fr
=
this
.
docNames
.
fr
&&
this
.
docNames
.
fr
.
value
if
(
de
&&
fr
)
{
return
this
.
docNames
[
this
.
lang
].
value
}
else
if
(
de
)
{
return
this
.
docNames
.
de
.
value
}
else
if
(
fr
)
{
return
this
.
docNames
.
fr
.
value
}
},
docName
Topic
s
()
{
docNames
()
{
return
{
de
:
this
.
getDocName
Topic
(
'
de
'
),
fr
:
this
.
getDocName
Topic
(
'
fr
'
)
de
:
this
.
getDocName
(
'
de
'
),
fr
:
this
.
getDocName
(
'
fr
'
)
}
},
file
()
{
if
(
this
.
files
.
de
&&
this
.
files
.
fr
)
{
// Note: empty topics created while edit have ID -1
const
de
=
this
.
files
.
de
&&
this
.
files
.
de
.
id
!=
-
1
const
fr
=
this
.
files
.
fr
&&
this
.
files
.
fr
.
id
!=
-
1
if
(
de
&&
fr
)
{
return
this
.
files
[
this
.
lang
]
}
else
if
(
this
.
files
.
de
)
{
}
else
if
(
de
)
{
return
this
.
files
.
de
}
else
if
(
this
.
files
.
fr
)
{
}
else
if
(
fr
)
{
return
this
.
files
.
fr
}
},
...
...
@@ -135,8 +140,8 @@ export default {
if
(
this
.
isNew
)
{
return
{
name
:
{
de
:
this
.
docName
Topic
s
.
de
,
fr
:
this
.
docName
Topic
s
.
fr
de
:
this
.
docNames
.
de
,
fr
:
this
.
docNames
.
fr
},
path
:
{
de
:
this
.
pathTopics
.
de
,
...
...
@@ -241,7 +246,7 @@ export default {
}
},
getDocName
Topic
(
lang
)
{
getDocName
(
lang
)
{
return
this
.
topic
.
children
[
'
zukunftswerk.document_name.
'
+
lang
]
},
...
...
@@ -265,7 +270,7 @@ export default {
save
()
{
this
.
saving
=
true
const
p
=
this
.
isNew
?
this
.
$store
.
dispatch
(
'
createDocument
'
,
this
.
topic
)
:
this
.
$store
.
dispatch
(
'
updateDocument
'
,
this
.
docModel
)
this
.
$store
.
dispatch
(
'
updateDocument
'
,
{
topic
:
this
.
topic
,
docModel
:
this
.
docModel
}
)
p
.
then
(()
=>
{
this
.
saving
=
false
})
...
...
src/main/js/store.js
View file @
0da25363
...
...
@@ -94,19 +94,19 @@ const actions = {
})
},
updateDocument
({
dispatch
},
docModel
)
{
updateDocument
({
dispatch
},
{
topic
,
docModel
}
)
{
// Fill-in missing document children, e.g. "File (fr)". Note: a file path can only be updated if there is a
// file in the first place.
// "allChildren" is required to keep the file's "Media Type". Note: Media Type is required for file rendering,
// but it would be omitted/dropped due to "Reduced Details" as it is not an identity attribute.
state
.
topic
.
type
.
newFormModel
(
state
.
topic
,
true
)
// allChildren=true
topic
.
type
.
newFormModel
(
topic
,
true
)
// allChildren=true
// Transfer edit buffer to topic model
state
.
topic
.
children
[
'
zukunftswerk.document_name.de
'
].
value
=
docModel
.
name
.
de
.
value
state
.
topic
.
children
[
'
zukunftswerk.document_name.fr
'
].
value
=
docModel
.
name
.
fr
.
value
state
.
topic
.
children
[
'
dmx.files.file#zukunftswerk.de
'
].
children
[
'
dmx.files.path
'
].
value
=
docModel
.
path
.
de
.
value
state
.
topic
.
children
[
'
dmx.files.file#zukunftswerk.fr
'
].
children
[
'
dmx.files.path
'
].
value
=
docModel
.
path
.
fr
.
value
topic
.
children
[
'
zukunftswerk.document_name.de
'
].
value
=
docModel
.
name
.
de
.
value
topic
.
children
[
'
zukunftswerk.document_name.fr
'
].
value
=
docModel
.
name
.
fr
.
value
topic
.
children
[
'
dmx.files.file#zukunftswerk.de
'
].
children
[
'
dmx.files.path
'
].
value
=
docModel
.
path
.
de
.
value
topic
.
children
[
'
dmx.files.file#zukunftswerk.fr
'
].
children
[
'
dmx.files.path
'
].
value
=
docModel
.
path
.
fr
.
value
//
dispatch
(
'
update
'
,
state
.
topic
)
dispatch
(
'
update
'
,
topic
)
},
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment