Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GéoContrib
Géocontrib Frontend
Commits
5ab31a04
Commit
5ab31a04
authored
1 year ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
use input field foreach list option & add sortable
parent
43e69278
No related branches found
No related tags found
1 merge request
!587
REDMINE_ISSUE-17413 | Nouveau formulaire de création des listes de valeurs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/FeatureType/FeatureTypeCustomForm.vue
+79
-32
79 additions, 32 deletions
src/components/FeatureType/FeatureTypeCustomForm.vue
src/views/Feature/FeatureEdit.vue
+0
-1
0 additions, 1 deletion
src/views/Feature/FeatureEdit.vue
with
79 additions
and
33 deletions
src/components/FeatureType/FeatureTypeCustomForm.vue
+
79
−
32
View file @
5ab31a04
...
...
@@ -138,36 +138,6 @@
</li>
</ul>
</div>
<div
v-if=
"selectedFieldType === 'Liste de valeurs' || selectedFieldType === 'Liste à choix multiples'"
class=
"field field-list-options required field"
>
<label
:for=
"form.options.id_for_label"
>
{{
form
.
options
.
label
}}
</label>
<input
:id=
"form.options.id_for_label"
v-model=
"arrayOption"
type=
"text"
:maxlength=
"form.options.field.max_length"
:name=
"form.options.html_name"
class=
"options-field"
>
<small>
{{
form
.
options
.
help_text
}}
</small>
<ul
id=
"errorlist"
class=
"errorlist"
>
<li
v-for=
"error in form.options.errors"
:key=
"error"
>
{{
error
}}
</li>
</ul>
</div>
<div
v-if=
"selectedFieldType === 'Liste de valeurs pré-enregistrées'"
class=
"field required"
...
...
@@ -193,12 +163,55 @@
</ul>
</div>
</div>
<div
v-if=
"selectedFieldType === 'Liste de valeurs' || selectedFieldType === 'Liste à choix multiples'"
class=
"field field-list-options required field"
>
<label
:for=
"form.options.id_for_label"
>
{{
form
.
options
.
label
}}
</label>
<div
:id=
"`list-options-$
{customForm.dataKey}`">
<div
v-for=
"(option, index) in form.options.value"
:key=
"option"
:id=
"option"
class=
"draggable-row"
>
<i
class=
"th icon"
aria-hidden=
"true"
/>
<input
:value=
"option"
type=
"text"
:maxlength=
"form.options.field.max_length"
:name=
"form.options.html_name"
class=
"options-field"
@
change=
"updateOptionValue(index, $event)"
>
</div>
</div>
<ul
id=
"errorlist"
class=
"errorlist"
>
<li
v-for=
"error in form.options.errors"
:key=
"error"
>
{{
error
}}
</li>
</ul>
</div>
</div>
</div>
</
template
>
<
script
>
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
Sortable
from
'
sortablejs
'
;
import
Dropdown
from
'
@/components/Dropdown.vue
'
;
...
...
@@ -295,7 +308,8 @@ export default {
value
:
[],
},
},
selectedPrerecordedList
:
null
selectedPrerecordedList
:
null
,
sortable
:
null
};
},
...
...
@@ -311,6 +325,11 @@ export default {
(
el
)
=>
el
.
value
===
this
.
form
.
field_type
.
value
);
if
(
currentFieldType
)
{
this
.
$nextTick
(()
=>
{
// to be executed after the fieldType is returned and the html generated
if
(
this
.
selectedFieldType
===
'
Liste de valeurs
'
||
this
.
selectedFieldType
===
'
Liste à choix multiples
'
)
{
this
.
initSortable
();
}
});
return
currentFieldType
.
name
;
}
return
null
;
...
...
@@ -386,6 +405,27 @@ export default {
);
},
updateOptionValue
(
index
,
e
)
{
this
.
form
.
options
.
value
[
index
]
=
e
.
target
.
value
;
if
(
!
this
.
hasDuplicateOptions
())
{
this
.
updateStore
();
}
},
updateOptionOrder
(
e
)
{
console
.
log
(
e
,
e
.
target
.
childNodes
);
},
initSortable
()
{
this
.
sortable
=
new
Sortable
(
document
.
getElementById
(
`list-options-
${
this
.
customForm
.
dataKey
}
`
),
{
animation
:
150
,
handle
:
'
.draggable-row
'
,
// The element that is active to drag
ghostClass
:
'
blue-background-class
'
,
dragClass
:
'
white-opacity-background-class
'
,
onEnd
:
this
.
updateOptionOrder
,
});
},
updateStore
()
{
const
data
=
{
dataKey
:
this
.
customForm
.
dataKey
,
...
...
@@ -489,5 +529,12 @@ export default {
}
}
}
.draggable-row {
display: flex;
align-items: baseline;
margin-bottom: 1em;
input {
margin-left: .5em !important;
}
}
</
style
>
This diff is collapsed.
Click to expand it.
src/views/Feature/FeatureEdit.vue
+
0
−
1
View file @
5ab31a04
...
...
@@ -270,7 +270,6 @@
id=
"popup-content"
/>
</div>
</div>
</div>
...
...
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