mirror of
https://github.com/openvk/openvk
synced 2024-12-27 11:01:28 +03:00
102 lines
4.1 KiB
XML
102 lines
4.1 KiB
XML
{extends "../@layout.xml"}
|
|
|
|
{block title}{_edit_playlist}{/block}
|
|
|
|
{block header}
|
|
<a href="{$owner->getURL()}">{$owner->getCanonicalName()}</a>
|
|
»
|
|
<a href="/playlists{$ownerId}">{_playlists}</a>
|
|
»
|
|
<a href="/playlist{$playlist->getPrettyId()}">{_playlist}</a>
|
|
»
|
|
{_edit_playlist}
|
|
{/block}
|
|
|
|
{block content}
|
|
<div class="playlistBlock" style="display: flex;margin-top: 0px;">
|
|
<div class="playlistCover">
|
|
<a>
|
|
<img src="{$playlist->getCoverURL('normal')}" alt="{_playlist_cover}">
|
|
</a>
|
|
|
|
<div class="profile_links" style="width: 139px;">
|
|
<a class="profile_link" style="width: 98%;" id="_deletePlaylist" data-id="{$playlist->getId()}">{_delete_playlist}</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="padding-left: 13px;width:75%">
|
|
<div class="playlistInfo">
|
|
<input value="{$playlist->getName()}" type="text" name="title" maxlength="125">
|
|
</div>
|
|
|
|
<div class="moreInfo">
|
|
<textarea placeholder="{_description}" name="description" maxlength="2045" style="margin-top: 11px;">{$playlist->getDescription()}</textarea>
|
|
</div>
|
|
|
|
<label>
|
|
<input type='checkbox' name='is_unlisted' n:attr='checked => $playlist->isUnlisted()'>
|
|
{_playlist_hide_from_search}
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="margin-top: 19px;">
|
|
<input id="playlist_query" type="text" style="height: 26px;" placeholder="{_header_search}">
|
|
<div class="playlistAudiosContainer editContainer">
|
|
<div id="newPlaylistAudios" n:foreach="$audios as $audio">
|
|
<div class="playerContainer">
|
|
{include "player.xml", audio => $audio, hideButtons => true}
|
|
</div>
|
|
<div class="attachAudio addToPlaylist" data-id="{$audio->getId()}">
|
|
<span>{_remove_from_playlist}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="showMoreAudiosPlaylist" data-page="2" data-playlist="{$playlist->getId()}" n:if="$pagesCount > 1">
|
|
{_show_more_audios}
|
|
</div>
|
|
</div>
|
|
|
|
<form method="post" id="editPlaylistForm" data-id="{$playlist->getId()}" enctype="multipart/form-data">
|
|
<input type="hidden" name="title" maxlength="128" />
|
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
|
<input type="hidden" name="is_unlisted" value="0" />
|
|
<textarea style="display:none;" name="description" maxlength="2048" />
|
|
<input type="hidden" name="audios">
|
|
<input type="file" style="display:none;" name="new_cover" accept=".jpg,.png">
|
|
|
|
<div style="float:right;margin-top: 8px;">
|
|
<button class="button" type="submit">{_save}</button>
|
|
</div>
|
|
</form>
|
|
|
|
<script>
|
|
document.querySelector("input[name='audios']").value = {$audiosIds}
|
|
|
|
u("#editPlaylistForm").on("submit", (e) => {
|
|
document.querySelector("#editPlaylistForm input[name='title']").value = document.querySelector(".playlistInfo input[name='title']").value
|
|
document.querySelector("#editPlaylistForm textarea[name='description']").value = document.querySelector(".playlistBlock textarea[name='description']").value
|
|
document.querySelector("#editPlaylistForm input[name='is_unlisted']").value = document.querySelector("input[name='is_unlisted']").checked ? 1 : 0
|
|
})
|
|
|
|
u("#editPlaylistForm input[name='new_cover']").on("change", (e) => {
|
|
if(!e.currentTarget.files[0].type.startsWith("image/")) {
|
|
fastError(tr("not_a_photo"))
|
|
return
|
|
}
|
|
|
|
let image = URL.createObjectURL(e.currentTarget.files[0])
|
|
|
|
document.querySelector(".playlistCover img").src = image
|
|
})
|
|
|
|
u(".playlistCover img").on("click", (e) => {
|
|
document.querySelector("input[name='new_cover']").click()
|
|
})
|
|
|
|
document.querySelector("#editPlaylistForm input[name='new_cover']").value = ""
|
|
</script>
|
|
|
|
{script "js/al_playlists.js"}
|
|
{/block}
|