mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
fix: hide "my profile" from dropdown menu if ALLOW_EDIT_PROFILE=False
This commit is contained in:
parent
6876bb1ba5
commit
21be2e4fd0
3 changed files with 12 additions and 6 deletions
|
@ -5,10 +5,14 @@ export default class URLs {
|
||||||
this.urls = serverUrls
|
this.urls = serverUrls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has(urlName) {
|
||||||
|
return urlName in this.urls
|
||||||
|
}
|
||||||
|
|
||||||
get(urlName, params) {
|
get(urlName, params) {
|
||||||
if (typeof this[urlName] === 'function') return this[urlName](params)
|
if (typeof this[urlName] === 'function') return this[urlName](params)
|
||||||
|
|
||||||
if (this.urls.hasOwnProperty(urlName)) {
|
if (this.has(urlName)) {
|
||||||
return template(this.urls[urlName], params)
|
return template(this.urls[urlName], params)
|
||||||
}
|
}
|
||||||
throw `Unable to find a URL for route ${urlName}`
|
throw `Unable to find a URL for route ${urlName}`
|
||||||
|
|
|
@ -654,10 +654,6 @@ const ControlsMixin = {
|
||||||
label: L._('New map'),
|
label: L._('New map'),
|
||||||
action: this.urls.get('map_new'),
|
action: this.urls.get('map_new'),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: L._('My profile'),
|
|
||||||
action: this.urls.get('user_profile'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: L._('My maps'),
|
label: L._('My maps'),
|
||||||
action: this.urls.get('user_dashboard'),
|
action: this.urls.get('user_dashboard'),
|
||||||
|
@ -667,6 +663,12 @@ const ControlsMixin = {
|
||||||
action: this.urls.get('user_teams'),
|
action: this.urls.get('user_teams'),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
if (this.urls.has('user_profile')) {
|
||||||
|
actions.push({
|
||||||
|
label: L._('My profile'),
|
||||||
|
action: this.urls.get('user_profile'),
|
||||||
|
})
|
||||||
|
}
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
const x = button.offsetLeft
|
const x = button.offsetLeft
|
||||||
const y = button.offsetTop + button.offsetHeight
|
const y = button.offsetTop + button.offsetHeight
|
||||||
|
|
|
@ -94,4 +94,4 @@ def test_login_from_map_page(live_server, page, tilelayer, settings, user, conte
|
||||||
# Save should have proceed
|
# Save should have proceed
|
||||||
assert Map.objects.count() == 1
|
assert Map.objects.count() == 1
|
||||||
# Use name should now appear on the header toolbar
|
# Use name should now appear on the header toolbar
|
||||||
expect(page.get_by_text("My Dashboard (Joe)")).to_be_visible()
|
expect(page.get_by_role("button", name="Joe")).to_be_visible()
|
||||||
|
|
Loading…
Reference in a new issue