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
externe Matthieu
Géocontrib Frontend
Commits
77cf2e93
Commit
77cf2e93
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
WIP: selecting features to edit
parent
503be29e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/feature/FeatureListTable.vue
+34
-18
34 additions, 18 deletions
src/components/feature/FeatureListTable.vue
src/views/feature/Feature_list.vue
+61
-3
61 additions, 3 deletions
src/views/feature/Feature_list.vue
with
95 additions
and
21 deletions
src/components/feature/FeatureListTable.vue
+
34
−
18
View file @
77cf2e93
...
...
@@ -78,28 +78,21 @@
<tr
v-for=
"(feature, index) in paginatedFeatures"
:key=
"index"
>
<td
class=
"center"
>
<div
class=
"ui checkbox"
:class=
"
feature.properties.creator.username !== user.username &&
!user.is_superuser &&
!isUserProjectAdministrator
? 'disabled'
: ''
"
:class=
"['ui checkbox',
{disabled: isEditDisabled(feature)}]"
>
<!-- :class="['ui checkbox',
{disabled: canDeleteFeature(feature)}]" -->
<input
type=
"checkbox"
:id=
"feature.id"
:value=
"feature.id"
v-model=
"checked"
:disabled=
"
feature.properties.creator.username !== user.username &&
!user.is_superuser &&
!isUserProjectAdministrator
"
:disabled=
"isEditDisabled(feature)"
name=
"select"
/>
<label></label>
<label
for=
"select"
></label>
<!-- :disabled="canDeleteFeature(feature)" -->
</div>
{{
canDeleteFeature
(
feature
)
}}
</td>
<td
class=
"center"
>
...
...
@@ -269,10 +262,7 @@ export default {
computed
:
{
...
mapState
([
"
user
"
]),
...
mapGetters
([
"
project
"
,
"
permissions
"
]),
isUserProjectAdministrator
()
{
return
this
.
permissions
.
is_project_administrator
;
},
...
mapState
([
"
user
"
,
"
USER_LEVEL_PROJECTS
"
]),
checked
:
{
get
()
{
...
...
@@ -321,6 +311,32 @@ export default {
},
methods
:
{
canDeleteFeature
(
feature
)
{
return
feature
.
properties
.
creator
.
username
!==
this
.
user
.
username
&&
!
this
.
user
.
is_superuser
&&
!
this
.
permissions
.
is_project_administrator
},
isEditDisabled
(
feature
)
{
//console.log("feature", feature)
const
userStatus
=
this
.
USER_LEVEL_PROJECTS
[
this
.
project
.
slug
];
const
access
=
{
"
Administrateur projet
"
:
[
"
draft
"
,
"
published
"
,
"
archived
"
],
"
Modérateur
"
:
[
"
pending
"
],
"
Super Contributeur
"
:
[
"
draft
"
,
this
.
project
.
moderation
?
"
pending
"
:
"
published
"
],
"
Contributeur
"
:
[
"
draft
"
,
this
.
project
.
moderation
?
"
pending
"
:
"
published
"
],
};
console
.
log
(
"
userStatus
"
,
userStatus
)
if
(
userStatus
===
"
Super Contributeur
"
||
userStatus
===
"
Contributeur
"
)
{
console
.
log
(
"
feature.properties.creator.username
"
,
feature
.
properties
.
creator
.
username
)
console
.
log
(
"
this.user.username
"
,
this
.
user
.
username
)
if
(
feature
.
properties
.
creator
.
username
!==
this
.
user
.
username
)
return
true
;
}
//console.log("access[userStatus].includes(feature.properties.status.value)", access[userStatus].includes(feature.properties.status.value))
return
!
access
[
userStatus
].
includes
(
feature
.
properties
.
status
.
value
);
},
getUserName
(
feature
)
{
if
(
!
feature
.
properties
.
creator
)
{
return
"
----
"
;
...
...
This diff is collapsed.
Click to expand it.
src/views/feature/Feature_list.vue
+
61
−
3
View file @
77cf2e93
...
...
@@ -36,10 +36,11 @@
feature_types.length > 0 &&
permissions.can_create_feature
"
id=
"button-dropdown"
class=
"item right"
>
<div
@
click=
"
showAddFeature = !show
AddFeature"
@
click=
"
toggle
AddFeature"
class=
"ui dropdown button compact button-hover-green"
data-tooltip=
"Ajouter un signalement"
data-position=
"bottom left"
...
...
@@ -67,13 +68,40 @@
</div>
</div>
<div
v-if=
"checkedFeatures.length > 0"
@
click=
"toggleModifyStatus"
class=
"ui dropdown button compact button-hover-green margin-left-25"
data-tooltip=
"Modifier le statut des Signalements"
data-position=
"bottom center"
>
<i
class=
"pencil fitted icon"
></i>
<div
v-if=
"showModifyStatus"
class=
"menu transition visible"
style=
"z-index: 9999"
>
<div
class=
"header"
>
Modifier le statut des Signalements
</div>
<div
class=
"scrolling menu text-wrap"
>
<span
v-for=
"status in availableStatus"
:key=
"status.value"
@
click=
"modifyStatus(status.value)"
class=
"item"
>
{{
status
.
name
}}
</span>
</div>
</div>
</div>
<div
v-if=
"checkedFeatures.length"
@
click=
"modalAllDelete"
class=
"ui button compact button-hover-red margin-left-25"
data-tooltip=
"Effacer tous les types de signalements sélectionnés"
data-position=
"left center"
data-variation=
"mini"
data-position=
"bottom right"
>
<i
class=
"grey trash fitted icon"
></i>
</div>
...
...
@@ -250,6 +278,7 @@ export default {
},
showMap
:
true
,
showAddFeature
:
false
,
showModifyStatus
:
false
,
};
},
...
...
@@ -322,6 +351,12 @@ export default {
);
},
availableStatus
()
{
return
this
.
statusChoices
.
filter
((
status
)
=>
status
)
},
featureTypeChoices
()
{
return
this
.
feature_types
.
map
((
el
)
=>
el
.
title
);
},
...
...
@@ -331,10 +366,31 @@ export default {
...
mapActions
(
'
feature
'
,
[
'
GET_PROJECT_FEATURES
'
]),
toggleAddFeature
()
{
this
.
showAddFeature
=
!
this
.
showAddFeature
;
this
.
showModifyStatus
=
false
;
},
toggleModifyStatus
()
{
this
.
showModifyStatus
=
!
this
.
showModifyStatus
;
this
.
showAddFeature
=
false
;
},
modalAllDelete
()
{
this
.
modalAllDeleteOpen
=
!
this
.
modalAllDeleteOpen
;
},
clickOutsideDropdown
(
e
)
{
if
(
!
e
.
target
.
closest
(
'
#button-dropdown
'
))
this
.
showModifyStatus
=
false
;
this
.
showAddFeature
=
false
;
},
modifyStatus
(
newValue
)
{
console
.
log
(
"
newValue
"
,
newValue
)
},
deleteFeature
(
feature_id
)
{
const
url
=
`
${
this
.
API_BASE_URL
}
features/
${
feature_id
}
/?project__slug=
${
this
.
project
.
slug
}
`
;
axios
...
...
@@ -550,9 +606,11 @@ export default {
this
.
initMap
();
}
this
.
fetchPagedFeatures
();
window
.
addEventListener
(
"
mousedown
"
,
this
.
clickOutsideDropdown
);
},
destroyed
()
{
window
.
removeEventListener
(
"
mousedown
"
,
this
.
clickOutsideDropdown
);
//* allow user to change page if ever stuck on loader
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
},
...
...
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