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
1f5bd34b
Commit
1f5bd34b
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
update thumbnails src format and add user_permissions fetch
parent
aa36b8d8
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/main.js
+1
-0
1 addition, 0 deletions
src/main.js
src/store/index.js
+22
-5
22 additions, 5 deletions
src/store/index.js
src/views/My_account.vue
+14
-2
14 additions, 2 deletions
src/views/My_account.vue
src/views/project/Project_type_list.vue
+14
-1
14 additions, 1 deletion
src/views/project/Project_type_list.vue
with
51 additions
and
8 deletions
src/main.js
+
1
−
0
View file @
1f5bd34b
...
@@ -13,6 +13,7 @@ store.dispatch("GET_ALL_PROJECTS"),
...
@@ -13,6 +13,7 @@ store.dispatch("GET_ALL_PROJECTS"),
store
.
dispatch
(
"
GET_STATIC_PAGES
"
),
store
.
dispatch
(
"
GET_STATIC_PAGES
"
),
store
.
dispatch
(
"
GET_USER_LEVEL_PROJECTS
"
),
store
.
dispatch
(
"
GET_USER_LEVEL_PROJECTS
"
),
store
.
dispatch
(
"
map/GET_LAYERS
"
),
store
.
dispatch
(
"
map/GET_LAYERS
"
),
store
.
dispatch
(
"
GET_USER_LEVEL_PERMISSIONS
"
),
]).
then
(
axios
.
spread
(
function
()
{
]).
then
(
axios
.
spread
(
function
()
{
new
Vue
({
new
Vue
({
router
,
router
,
...
...
This diff is collapsed.
Click to expand it.
src/store/index.js
+
22
−
5
View file @
1f5bd34b
...
@@ -38,7 +38,8 @@ export default new Vuex.Store({
...
@@ -38,7 +38,8 @@ export default new Vuex.Store({
last_comments
:
[],
last_comments
:
[],
staticPages
:
null
,
staticPages
:
null
,
SSO_SETTED
:
false
,
SSO_SETTED
:
false
,
USER_LEVEL_PROJECTS
:
null
USER_LEVEL_PROJECTS
:
null
,
user_permissions
:
null
,
},
},
mutations
:
{
mutations
:
{
...
@@ -75,6 +76,9 @@ export default new Vuex.Store({
...
@@ -75,6 +76,9 @@ export default new Vuex.Store({
SET_PROJECT_COMMENTS
(
state
,
last_comments
)
{
SET_PROJECT_COMMENTS
(
state
,
last_comments
)
{
state
.
last_comments
=
last_comments
state
.
last_comments
=
last_comments
},
},
SET_USER_PERMISSIONS
(
state
,
userPermissions
)
{
state
.
user_permissions
=
userPermissions
},
},
},
getters
:
{
getters
:
{
...
@@ -139,18 +143,18 @@ export default new Vuex.Store({
...
@@ -139,18 +143,18 @@ export default new Vuex.Store({
if
(
response
&&
response
.
status
===
200
)
{
if
(
response
&&
response
.
status
===
200
)
{
const
user
=
response
.
data
.
user
;
const
user
=
response
.
data
.
user
;
commit
(
"
SET_USER
"
,
user
);
commit
(
"
SET_USER
"
,
user
);
window
.
localStorage
.
setItem
(
"
user
"
,
JSON
.
stringify
(
user
));
window
.
localStorage
.
setItem
(
"
user
"
,
JSON
.
stringify
(
user
));
//? toujours nécessaire ?
}
}
})
// todo: ajouter au localestorage
})
.
catch
(()
=>
{
.
catch
(()
=>
{
router
.
push
({
name
:
"
login
"
});
router
.
push
({
name
:
"
login
"
});
});
});
},
},
LOGOUT
({
commit
})
{
// ? logout bien dans django ?
LOGOUT
({
commit
})
{
// ? logout
se fait
bien dans django ?
axios
axios
.
get
(
`
${
DJANGO_API_BASE
}
logout/`
)
.
get
(
`
${
DJANGO_API_BASE
}
logout/`
)
.
then
((
response
)
=>
{
// todo: check status
.
then
((
response
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
if
(
response
&&
response
.
status
===
200
)
{
commit
(
"
SET_USER
"
,
false
);
// ? better false or null
commit
(
"
SET_USER
"
,
false
);
// ? better false or null
commit
(
"
SET_USER_LEVEL_PROJECTS
"
,
null
);
commit
(
"
SET_USER_LEVEL_PROJECTS
"
,
null
);
...
@@ -175,6 +179,19 @@ export default new Vuex.Store({
...
@@ -175,6 +179,19 @@ export default new Vuex.Store({
});
});
},
},
GET_USER_LEVEL_PERMISSIONS
({
commit
})
{
axios
.
get
(
`
${
DJANGO_API_BASE
}
user-permissions/`
)
.
then
((
response
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
commit
(
"
SET_USER_PERMISSIONS
"
,
response
.
data
)
}
})
.
catch
((
error
)
=>
{
throw
error
;
});
},
GET_PROJECT_INFO
({
commit
,
dispatch
},
slug
)
{
GET_PROJECT_INFO
({
commit
,
dispatch
},
slug
)
{
commit
(
"
SET_PROJECT_SLUG
"
,
slug
);
commit
(
"
SET_PROJECT_SLUG
"
,
slug
);
dispatch
(
"
GET_PROJECT_LAST_MESSAGES
"
,
slug
);
dispatch
(
"
GET_PROJECT_LAST_MESSAGES
"
,
slug
);
...
...
This diff is collapsed.
Click to expand it.
src/views/My_account.vue
+
14
−
2
View file @
1f5bd34b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<div
class=
"item"
>
<div
class=
"item"
>
<div
class=
"right floated content"
>
<div
class=
"right floated content"
>
<div
class=
"description"
>
<div
class=
"description"
>
{{
user
.
get_f
ull
_
name
}}
{{
user
F
ullname
}}
</div>
</div>
</div>
</div>
<div
class=
"content"
>
Nom complet
</div>
<div
class=
"content"
>
Nom complet
</div>
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
:src=
"
:src=
"
project.thumbnail.includes('default')
project.thumbnail.includes('default')
? require('@/assets/img/default.png')
? require('@/assets/img/default.png')
: project.thumbnail
:
DJANGO_BASE_URL +
project.thumbnail
+ refreshId()
"
"
height=
"200"
height=
"200"
/>
/>
...
@@ -288,6 +288,18 @@ export default {
...
@@ -288,6 +288,18 @@ export default {
computed
:
{
computed
:
{
// todo : filter projects to user
// todo : filter projects to user
...
mapState
([
"
user
"
,
"
projects
"
,
"
USER_LEVEL_PROJECTS
"
]),
...
mapState
([
"
user
"
,
"
projects
"
,
"
USER_LEVEL_PROJECTS
"
]),
DJANGO_BASE_URL
:
()
=>
process
.
env
.
VUE_APP_DJANGO_BASE
,
userFullname
:
function
()
{
if
(
this
.
user
.
first_name
||
this
.
user
.
last_name
)
return
this
.
user
.
first_name
+
"
"
+
this
.
user
.
last_name
;
return
null
;
},
},
methods
:
{
refreshId
()
{
return
"
?ver=
"
+
Math
.
random
();
},
},
},
};
};
</
script
>
</
script
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/views/project/Project_type_list.vue
+
14
−
1
View file @
1f5bd34b
...
@@ -7,7 +7,13 @@
...
@@ -7,7 +7,13 @@
<div
class=
"ui divided items"
>
<div
class=
"ui divided items"
>
<div
v-for=
"project in project_types"
:key=
"project.slug"
class=
"item"
>
<div
v-for=
"project in project_types"
:key=
"project.slug"
class=
"item"
>
<div
class=
"ui tiny image"
>
<div
class=
"ui tiny image"
>
<img
:src=
"project.thumbnail"
/>
<img
:src=
"
project.thumbnail.includes('default')
? require('@/assets/img/default.png')
: DJANGO_BASE_URL + project.thumbnail + refreshId()
"
/>
</div>
</div>
<div
class=
"middle aligned content"
>
<div
class=
"middle aligned content"
>
<div
class=
"description"
>
<div
class=
"description"
>
...
@@ -67,6 +73,13 @@ export default {
...
@@ -67,6 +73,13 @@ export default {
computed
:
{
computed
:
{
...
mapGetters
([
"
project_types
"
]),
...
mapGetters
([
"
project_types
"
]),
DJANGO_BASE_URL
:
()
=>
process
.
env
.
VUE_APP_DJANGO_BASE
,
},
methods
:
{
refreshId
()
{
return
"
?ver=
"
+
Math
.
random
();
},
},
},
};
};
</
script
>
</
script
>
\ No newline at end of file
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