mirror of
https://github.com/openvk/openvk
synced 2025-01-09 17:29:42 +03:00
AJAX: Fix when group does not adding to left menu if the group itself have a custom url
This commit is contained in:
parent
f4baf46a72
commit
735e75fa21
2 changed files with 4 additions and 4 deletions
|
@ -56,7 +56,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_actions}: </span></td>
|
<td width="120" valign="top"><span class="nobold">{_actions}: </span></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" id="_pinGroup" data-group-name="{$x->getName()}" data-group-id="{$x->getId()}">
|
<a href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" id="_pinGroup" data-group-name="{$x->getName()}" data-group-url="{$x->getUrl()}">
|
||||||
{if $clubPinned}
|
{if $clubPinned}
|
||||||
{_remove_from_left_menu}
|
{_remove_from_left_menu}
|
||||||
{else}
|
{else}
|
||||||
|
|
|
@ -91,7 +91,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
|
||||||
let link = u(this).attr("href");
|
let link = u(this).attr("href");
|
||||||
let thisButton = u(this);
|
let thisButton = u(this);
|
||||||
let groupName = u(this).attr("data-group-name");
|
let groupName = u(this).attr("data-group-name");
|
||||||
let groupId = u(this).attr("data-group-id");
|
let groupUrl = u(this).attr("data-group-url");
|
||||||
let list = u('#_groupListPinnedGroups');
|
let list = u('#_groupListPinnedGroups');
|
||||||
|
|
||||||
let req = await ky(link);
|
let req = await ky(link);
|
||||||
|
@ -109,13 +109,13 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
|
||||||
thisButton.html(tr('add_to_left_menu'));
|
thisButton.html(tr('add_to_left_menu'));
|
||||||
for(let i = 0; i < list.nodes[0].children.length; i++) {
|
for(let i = 0; i < list.nodes[0].children.length; i++) {
|
||||||
let element = list.nodes[0].children[i];
|
let element = list.nodes[0].children[i];
|
||||||
if(element.pathname == '/club'+groupId) {
|
if(element.pathname == groupUrl) {
|
||||||
element.remove();
|
element.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
thisButton.html(tr('remove_from_left_menu'));
|
thisButton.html(tr('remove_from_left_menu'));
|
||||||
list.nodes[0].append(u('<a href="/club' + groupId + '" class="link group_link">' + groupName + '</a>').first());
|
list.nodes[0].append(u('<a href="' + groupUrl + '" class="link group_link">' + groupName + '</a>').first());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding the group to the left group list
|
// Adding the group to the left group list
|
||||||
|
|
Loading…
Reference in a new issue