2020-07-06 10:49:18 +02:00
|
|
|
{% extends 'layouts/base.njk' %}
|
|
|
|
|
2021-03-29 12:55:05 +02:00
|
|
|
{% set title = app.name + ' - Shrink URL' %}
|
2020-07-06 10:49:18 +02:00
|
|
|
|
|
|
|
{% block scripts %}
|
2020-07-06 14:52:38 +02:00
|
|
|
<script src="/js/url-shrinker.js"></script>
|
2020-07-06 10:49:18 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block body %}
|
2020-07-06 14:52:38 +02:00
|
|
|
<h1>Shrink URLs</h1>
|
2021-03-29 12:55:05 +02:00
|
|
|
<p>For security reasons, shrinked URLs cannot be deleted.</p>
|
2020-07-06 10:49:18 +02:00
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
<section class="panel">
|
2021-01-26 14:29:29 +01:00
|
|
|
<h2><i data-feather="crosshair"></i> Shrink a URL</h2>
|
2020-07-06 10:49:18 +02:00
|
|
|
|
2020-07-06 14:52:38 +02:00
|
|
|
<form action="{{ route('shrink-url') }}" method="POST" id="url-shrink-form">
|
2020-07-06 10:49:18 +02:00
|
|
|
{{ macros.field(_locals, 'text', 'target_url', '', 'Target URL', 'Only valid URLs starting with http:// or https://', validation_attributes='required') }}
|
|
|
|
|
2020-07-06 14:52:38 +02:00
|
|
|
{{ macros.field(_locals, 'text', 'slug', '', 'Custom url slug', 'Example: bear sets url to https://'+default_domain+'/bear', validation_attributes='disabled') }}
|
2020-07-06 10:49:18 +02:00
|
|
|
{{ macros.field(_locals, 'checkbox', 'autogen_url', '', 'Generate url automatically', null, validation_attributes='checked') }}
|
|
|
|
|
2020-11-22 15:19:58 +01:00
|
|
|
{{ macros.csrf(getCsrfToken) }}
|
2020-07-06 10:49:18 +02:00
|
|
|
|
2020-07-06 14:52:38 +02:00
|
|
|
<button type="submit"><i data-feather="link"></i> Shrink URL</button>
|
2020-07-06 10:49:18 +02:00
|
|
|
</form>
|
|
|
|
|
|
|
|
{% set url = flash('url') %}
|
|
|
|
{% if url | length %}
|
|
|
|
<div class="copyable-text">
|
|
|
|
<div class="title">URL</div>
|
|
|
|
<div class="content">{{ url }}</div>
|
|
|
|
<button class="copy-button"><i data-feather="copy"></i></button>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</section>
|
|
|
|
|
2021-03-29 12:55:05 +02:00
|
|
|
|
|
|
|
<section class="panel">
|
|
|
|
<h2><i data-feather="link"></i> URL list</h2>
|
2021-03-30 12:31:47 +02:00
|
|
|
|
|
|
|
{{ macros.paginate(urls.pagination, 'url-shrinker', 3) }}
|
|
|
|
|
2021-03-29 12:55:05 +02:00
|
|
|
<table class="data-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th class="table-col-grow">URL</th>
|
|
|
|
<th>Target</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
{% for url in urls %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ url.id }}</td>
|
|
|
|
<td>
|
|
|
|
<div class="copyable-text">
|
|
|
|
<a class="content" href="{{ url.getURL() }}" target="_blank">{{ url.getURL() }}</a>
|
|
|
|
<button class="copy-button"><i data-feather="copy"></i></button>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td><pre>{{ url.target_url }}</pre></td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-03-30 12:31:47 +02:00
|
|
|
|
|
|
|
{{ macros.paginate(urls.pagination, 'url-shrinker', 3) }}
|
2021-03-29 12:55:05 +02:00
|
|
|
</section>
|
|
|
|
</div>
|
2020-11-22 15:19:58 +01:00
|
|
|
{% endblock %}
|