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
c193375b
Commit
c193375b
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
adjust routing for project and feature
parent
e44ad0cd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/store/modules/feature.js
+21
-19
21 additions, 19 deletions
src/store/modules/feature.js
src/views/feature/Feature_edit.vue
+0
-11
0 additions, 11 deletions
src/views/feature/Feature_edit.vue
src/views/project/Project_edit.vue
+32
-36
32 additions, 36 deletions
src/views/project/Project_edit.vue
with
53 additions
and
66 deletions
src/store/modules/feature.js
+
21
−
19
View file @
c193375b
...
...
@@ -104,10 +104,11 @@ const feature = {
.
then
((
response
)
=>
{
if
(
response
.
status
===
200
&&
response
.
data
)
{
router
.
push
({
name
:
"
project_detail
"
,
name
:
"
details-signalement
"
,
params
:
{
slug
:
rootState
.
project_slug
,
message
:
"
Le signalement a été mis à jour
"
,
slug_type_signal
:
rootState
.
feature_type
.
current_feature_type_slug
,
slug_signal
:
state
.
form
.
feature_id
,
//message: "Le signalement a été mis à jour",
},
});
}
...
...
@@ -122,10 +123,11 @@ const feature = {
if
(
response
.
status
===
201
&&
response
.
data
)
{
dispatch
(
"
SEND_ATTACHMENTS
"
,
response
.
data
.
id
)
router
.
push
({
name
:
"
project_detail
"
,
name
:
"
details-signalement
"
,
params
:
{
slug
:
rootState
.
project_slug
,
message
:
"
Le signalement a été crée
"
,
slug_type_signal
:
rootState
.
feature_type
.
current_feature_type_slug
,
slug_signal
:
response
.
data
.
id
,
//message: "Le signalement a été crée",
},
});
}
...
...
@@ -159,21 +161,21 @@ const feature = {
}
},
/* GET_FEATURE_LINK({ commit }, featureId) {
featureAPI
.getlinked_features(featureId)
.then((data) => commit("SET_FEATURE_LINKS", data));
} */
/* GET_FEATURE_LINK({ commit }, featureId) {
featureAPI
.getlinked_features(featureId)
.then((data) => commit("SET_FEATURE_LINKS", data));
} */
DELETE_FEATURE
({
state
,
rootState
},
feature_id
)
{
console
.
log
(
"
Deleting feature:
"
,
feature_id
,
state
)
const
url
=
`
${
rootState
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
features/
${
feature_id
}
`
;
axios
.
delete
(
url
,
{
})
.
then
()
.
catch
(()
=>
{
return
false
;
});
const
url
=
`
${
rootState
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
features/
${
feature_id
}
`
;
axios
.
delete
(
url
,
{
})
.
then
()
.
catch
(()
=>
{
return
false
;
});
},
// POST_COMMENT({ state }, data) {
...
...
This diff is collapsed.
Click to expand it.
src/views/feature/Feature_edit.vue
+
0
−
11
View file @
c193375b
...
...
@@ -579,16 +579,6 @@ export default {
return
isValid
;
},
goBackToProject
(
message
)
{
this
.
$router
.
push
({
name
:
"
project_detail
"
,
params
:
{
slug
:
this
.
$store
.
state
.
project_slug
,
message
,
},
});
},
postForm
()
{
let
is_valid
=
true
;
if
(
!
this
.
feature_type
.
title_optional
)
{
...
...
@@ -876,7 +866,6 @@ export default {
},
created
()
{
if
(
!
this
.
project
)
{
this
.
project
=
this
.
$store
.
state
.
projects
.
find
((
project
)
=>
project
.
slug
===
this
.
$store
.
state
.
project_slug
);
this
.
makeStatusChoicesFilter
();
...
...
This diff is collapsed.
Click to expand it.
src/views/project/Project_edit.vue
+
32
−
36
View file @
c193375b
...
...
@@ -172,12 +172,11 @@ import Dropdown from "@/components/Dropdown.vue";
import
{
mapGetters
}
from
"
vuex
"
;
axios
.
defaults
.
headers
.
common
[
'
X-CSRFToken
'
]
=
(
name
=>
{
var
re
=
new
RegExp
(
name
+
"
=([^;]+)
"
);
var
value
=
re
.
exec
(
document
.
cookie
);
return
(
value
!=
null
)
?
unescape
(
value
[
1
])
:
null
;
})(
'
csrftoken
'
);
axios
.
defaults
.
headers
.
common
[
"
X-CSRFToken
"
]
=
((
name
)
=>
{
var
re
=
new
RegExp
(
name
+
"
=([^;]+)
"
);
var
value
=
re
.
exec
(
document
.
cookie
);
return
value
!=
null
?
unescape
(
value
[
1
])
:
null
;
})(
"
csrftoken
"
);
export
default
{
name
:
"
Project_edit
"
,
...
...
@@ -284,30 +283,28 @@ export default {
postProjectThumbnail
(
projectSlug
)
{
//* send img to the backend when feature_type is created
if
(
this
.
fileToImport
.
size
>
0
)
{
let
formData
=
new
FormData
();
formData
.
append
(
"
file
"
,
this
.
fileToImport
);
const
url
=
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
+
"
projects/
"
+
projectSlug
+
"
/thumbnail/
"
;
return
axios
.
put
(
url
,
formData
,
{
headers
:
{
"
Content-Type
"
:
"
multipart/form-data
"
,
},
})
.
then
((
response
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
//dispatch("GET_IMPORTS", feature_type_slug); // ? Besoin de vérifier le statut de l'import ?
this
.
goBackNrefresh
(
projectSlug
);
}
})
.
catch
((
error
)
=>
{
throw
error
;
});
}
let
formData
=
new
FormData
();
formData
.
append
(
"
file
"
,
this
.
fileToImport
);
const
url
=
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
+
"
projects/
"
+
projectSlug
+
"
/thumbnail/
"
;
return
axios
.
put
(
url
,
formData
,
{
headers
:
{
"
Content-Type
"
:
"
multipart/form-data
"
,
},
})
.
then
((
response
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
//dispatch("GET_IMPORTS", feature_type_slug); // ? Besoin de vérifier le statut de l'import ?
this
.
goBackNrefresh
(
projectSlug
);
}
})
.
catch
((
error
)
=>
{
throw
error
;
});
},
checkForm
()
{
...
...
@@ -331,8 +328,6 @@ export default {
async
postForm
()
{
if
(
!
this
.
checkForm
())
return
;
// todo: check form
//let url = `${configuration.VUE_APP_DJANGO_API_BASE}projects/`;
const
projectData
=
{
title
:
this
.
form
.
title
,
description
:
this
.
form
.
description
,
...
...
@@ -371,11 +366,12 @@ export default {
)
.
then
((
response
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
//* send thumbnail after feature_type was
cre
ated
if
(
this
.
fileToImport
)
//* send thumbnail after feature_type was
upd
ated
if
(
this
.
fileToImport
.
size
>
0
)
{
this
.
postProjectThumbnail
(
this
.
project
.
slug
);
}
else
{
this
.
goBackNrefresh
(
this
.
project
.
slug
);
}
else
{
this
.
goBackNrefresh
(
this
.
project
.
slug
);
}
}
})
.
catch
((
error
)
=>
{
...
...
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