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
994f5585
Commit
994f5585
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
display attachments in feature_detail
parent
5f7b96c3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/services/feature-api.js
+37
-0
37 additions, 0 deletions
src/services/feature-api.js
src/views/feature/Feature_detail.vue
+13
-19
13 additions, 19 deletions
src/views/feature/Feature_detail.vue
with
50 additions
and
19 deletions
src/services/feature-api.js
0 → 100644
+
37
−
0
View file @
994f5585
import
axios
from
'
axios
'
;
import
store
from
'
../store
'
const
baseUrl
=
store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
;
const
featureAPI
=
{
async
getFeatureAttachments
(
featureId
)
{
const
response
=
await
axios
.
get
(
`
${
baseUrl
}
features/
${
featureId
}
/attachments/`
);
if
(
response
.
status
===
200
&&
response
.
data
)
{
return
response
.
data
;
}
else
{
return
null
;
}
},
/* async subscribeProject({ projectSlug, suscribe }) {
const response = await axios.put(
`${baseUrl}projects/${projectSlug}/subscription/`,
{ is_suscriber: suscribe }
);
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
}, */
}
export
default
featureAPI
;
This diff is collapsed.
Click to expand it.
src/views/feature/Feature_detail.vue
+
13
−
19
View file @
994f5585
...
...
@@ -183,18 +183,15 @@
target=
"_blank"
:href=
"pj.attachment_file.url"
>
<img
v-if=
"pj.extension === '.pdf'"
src=
"
{% static 'geocontrib/img/pdf.png' %}"
/>
<!-- // ? que faire ? -->
<img
v-else
:src=
"pj.attachment_file.url"
/>
<!-- // ? que faire avec un pdf ? -->
<img
v-if=
"pj.extension === '.pdf'"
src=
"@/assets/img/pdf.png"
/>
<img
v-else
:src=
"DJANGO_BASE_URL + pj.attachment_file"
/>
</a>
<div
class=
"middle aligned content"
>
<a
class=
"header"
target=
"_blank"
:href=
"pj.attachment_file.url"
:href=
"
DJANGO_BASE_URL +
pj.attachment_file.url"
>
{{
pj
.
title
}}
</a
>
<div
class=
"description"
>
...
...
@@ -382,6 +379,7 @@
import
frag
from
"
vue-frag
"
;
import
{
mapState
}
from
"
vuex
"
;
import
{
mapUtil
}
from
"
@/assets/js/map-util.js
"
;
import
featureAPI
from
"
@/services/feature-api
"
;
const
axios
=
require
(
"
axios
"
);
export
default
{
...
...
@@ -407,18 +405,8 @@ export default {
},
}, */
],
attachments
:
[
// TODO : Récupérer depuis l'api
/* {
attachment_file: {
url: "http://localhost:8000/media/user_1/albinoscom.jpg",
},
extension: "jpg",
title: "albinos",
info: "Drôle de bête",
}, */
],
// TODO : Récupérer depuis l'api
attachments
:
[],
// TODO : Récupérer events depuis l'api
events
:
[],
comment_form
:
{
attachment_file
:
{
...
...
@@ -444,6 +432,9 @@ export default {
computed
:
{
...
mapState
([
"
user
"
]),
DJANGO_BASE_URL
:
function
()
{
return
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_BASE
;
},
feature
:
function
()
{
return
(
this
.
$store
.
state
.
feature
.
features
.
find
(
...
...
@@ -564,6 +555,9 @@ export default {
"
feature_type/SET_CURRENT_FEATURE_TYPE_SLUG
"
,
this
.
$route
.
params
.
slug_type_signal
);
featureAPI
.
getFeatureAttachments
(
this
.
$route
.
params
.
slug_signal
)
.
then
((
data
)
=>
(
this
.
attachments
=
data
));
},
mounted
()
{
...
...
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