Fix edit link visibility, fixes #125
This commit is contained in:
parent
8aaf4b527d
commit
073f12f14e
@ -138,7 +138,7 @@
|
|||||||
<a id="adduser" class="menu-link" data-bind="onUserAdd"><?= $lang['adduser'] ?></a>
|
<a id="adduser" class="menu-link" data-bind="onUserAdd"><?= $lang['adduser'] ?></a>
|
||||||
<a id="edituser" class="menu-link" data-bind="onUserEdit"><?= $lang['edituser'] ?></a>
|
<a id="edituser" class="menu-link" data-bind="onUserEdit"><?= $lang['edituser'] ?></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<a id="edittrack" class="menu-link" data-bind="onTrackEdit"><?= $lang['edittrack'] ?></a>
|
<a id="edittrack" class="menu-link menu-hidden" data-bind="onTrackEdit"><?= $lang['edittrack'] ?></a>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ export default class MapViewModel extends ViewModel {
|
|||||||
const pos = this.state.currentTrack.positions[id];
|
const pos = this.state.currentTrack.positions[id];
|
||||||
const count = this.state.currentTrack.length;
|
const count = this.state.currentTrack.length;
|
||||||
const user = this.state.currentTrack.user;
|
const user = this.state.currentTrack.user;
|
||||||
const isEditable = auth.user && (auth.isAdmin || auth.user === user);
|
const isEditable = auth.user && (auth.isAdmin || auth.user.id === user.id);
|
||||||
let date = '–––';
|
let date = '–––';
|
||||||
let time = '–––';
|
let time = '–––';
|
||||||
if (pos.timestamp > 0) {
|
if (pos.timestamp > 0) {
|
||||||
|
@ -98,7 +98,10 @@ export default class TrackViewModel extends ViewModel {
|
|||||||
this.state.onChanged('currentUser', (user) => {
|
this.state.onChanged('currentUser', (user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
this.loadTrackList();
|
this.loadTrackList();
|
||||||
TrackViewModel.setMenuVisible(this.editEl, true);
|
const isEditable = auth.user && (auth.isAdmin || auth.user.id === user.id);
|
||||||
|
if (isEditable) {
|
||||||
|
TrackViewModel.setMenuVisible(this.editEl, true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.model.currentTrackId = '';
|
this.model.currentTrackId = '';
|
||||||
this.model.trackList = [];
|
this.model.trackList = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user