Skip to content
Snippets Groups Projects
Forked from Ad Aures / Castopod
1024 commits behind the upstream repository.
platforms.php 3.37 KiB
<?= $this->extend('admin/_layout') ?>

<?= $this->section('title') ?>
<?= lang('Platforms.title') ?>
<?= $this->endSection() ?>

<?= $this->section('pageTitle') ?>
<?= lang('Platforms.title') ?>
<?= $this->endSection() ?>

<?= $this->section('content') ?>

<?= form_open(route_to('platforms', $podcast->id), [
    'class' => 'flex flex-col max-w-md',
]) ?>
<?= csrf_field() ?>

<?php foreach ($platforms as $platform): ?>

<div class="relative flex items-start mb-4">
    <div class="flex flex-col w-12 mr-4">
        <?= platform_icon($platform->icon_filename, 'w-full mb-1') ?>
        <div class="inline-flex bg-gray-200">
            <?= anchor($platform->home_url, icon('external-link', 'mx-auto'), [
                'class' => 'flex-1 text-gray-600 hover:text-gray-900',
                'target' => '_blank',
                'rel' => 'noopener noreferrer',
                'data-toggle' => 'tooltip',
                'data-placement' => 'bottom',
                'title' => lang('Platforms.home_url', [
                    'platformName' => $platform->label,
                ]),
            ]) ?>
            <?= $platform->submit_url
                ? anchor($platform->submit_url, icon('upload', 'mx-auto'), [
                    'class' => 'flex-1 text-gray-600 hover:text-gray-900',
                    'target' => '_blank',
                    'rel' => 'noopener noreferrer',
                    'data-toggle' => 'tooltip',
                    'data-placement' => 'bottom',
                    'title' => lang('Platforms.submit_url', [
                        'platformName' => $platform->label,
                    ]),
                ])
                : '' ?>
        </div>
    </div>
    <div class="flex flex-col flex-1">
        <?= $platform->link_url
            ? anchor(
                route_to('platforms-remove', $podcast->id, $platform->id),
                icon('delete-bin', 'mx-auto'),
                [
                    'class' =>
                        'absolute right-0 p-1 bg-red-200 rounded-full text-red-700 hover:text-red-900',
                    'data-toggle' => 'tooltip',
                    'data-placement' => 'bottom',
                    'title' => lang('Platforms.remove', [
                        'platformName' => $platform->label,
                    ]),
                ]
            )
            : '' ?>
        <?= form_label($platform->label, $platform->name, [
            'class' => 'font-semibold mb-2',
        ]) ?>
        <?= form_input([
            'id' => $platform->name,
            'name' => 'platforms[' . $platform->name . '][url]',
            'class' => 'form-input mb-1 w-full',
            'value' => old($platform->name, $platform->link_url),
            'type' => 'url',
            'placeholder' => 'https://...',
        ]) ?>
        <?= form_switch(
            lang('Platforms.visible'),
            [
                'id' => $platform->name . '_visible',
                'name' => 'platforms[' . $platform->name . '][visible]',
            ],
            'yes',
            old(
                $platform->name . '_visible',
                $platform->visible ? $platform->visible : false
            ),
            'text-sm'
        ) ?>
    </div>
</div>

<?php endforeach; ?>

<?= button(
    lang('Platforms.submit'),
    null,
    ['variant' => 'primary'],
    ['type' => 'submit', 'class' => 'self-end']
) ?>

<?= form_close() ?>

<?= $this->endSection() ?>