add code
This commit is contained in:
parent
f1da01193b
commit
b0a4567169
20 changed files with 1734 additions and 0 deletions
130
templates/asset_detail.html
Normal file
130
templates/asset_detail.html
Normal file
|
@ -0,0 +1,130 @@
|
|||
{% extends "base.html" %} {% block content %}
|
||||
<div class="asset-detail">
|
||||
<div class="page-header">
|
||||
<h1>{{ asset.title }}</h1>
|
||||
<div class="page-actions">
|
||||
<a
|
||||
href="{{ url_for('edit_asset', id=asset.id) }}"
|
||||
class="button button-secondary"
|
||||
>
|
||||
<i class="fas fa-edit"></i> Edit
|
||||
</a>
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ url_for('delete_asset', id=asset.id) }}"
|
||||
class="inline-form"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
class="button button-danger"
|
||||
onclick="return confirm('Are you sure you want to delete this asset?')"
|
||||
>
|
||||
<i class="fas fa-trash"></i> Delete
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="asset-content">
|
||||
<div class="asset-main-image">
|
||||
<img
|
||||
src="{{ url_for('static', filename='uploads/' + asset.featured_image) }}"
|
||||
alt="{{ asset.title }}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="asset-info">
|
||||
<div class="description content-box">
|
||||
<h2>Description</h2>
|
||||
{{ asset.safe_description|safe }}
|
||||
</div>
|
||||
|
||||
{% if asset.license_key %}
|
||||
<div class="content-box">
|
||||
<h2>License Key</h2>
|
||||
<div class="license-key-container">
|
||||
<div class="license-key-wrapper">
|
||||
<input
|
||||
type="text"
|
||||
class="form-input license-key-input"
|
||||
value="{{ asset.license_key }}"
|
||||
readonly
|
||||
aria-label="License Key"
|
||||
/>
|
||||
<button
|
||||
class="button button-secondary license-copy-btn"
|
||||
type="button"
|
||||
aria-label="Copy License Key"
|
||||
>
|
||||
<i class="fas fa-copy"></i>
|
||||
<span>Copy</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="attached-files content-box">
|
||||
<h2>Attached Files</h2>
|
||||
{% if asset.files %}
|
||||
<ul class="files-list">
|
||||
{% for file in asset.files %}
|
||||
<li class="file-item">
|
||||
<a
|
||||
href="{{ url_for('static', filename='uploads/' + file.filename) }}"
|
||||
target="_blank"
|
||||
class="file-link"
|
||||
>
|
||||
<i class="fas fa-file"></i>
|
||||
{{ file.original_filename or file.filename }}
|
||||
</a>
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ url_for('delete_asset_file', id=file.id) }}"
|
||||
class="inline-form"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
class="button button-small button-danger"
|
||||
onclick="return confirm('Are you sure you want to delete this file?')"
|
||||
>
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p class="text-muted">No files attached</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %} {% block scripts %}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const copyButton = document.querySelector(".license-copy-btn");
|
||||
if (copyButton) {
|
||||
copyButton.addEventListener("click", async function () {
|
||||
const input = this.previousElementSibling;
|
||||
try {
|
||||
await navigator.clipboard.writeText(input.value);
|
||||
const buttonText = this.querySelector("span");
|
||||
const buttonIcon = this.querySelector("i");
|
||||
|
||||
buttonText.textContent = "Copied!";
|
||||
buttonIcon.classList.replace("fa-copy", "fa-check");
|
||||
|
||||
setTimeout(() => {
|
||||
buttonText.textContent = "Copy";
|
||||
buttonIcon.classList.replace("fa-check", "fa-copy");
|
||||
}, 2000);
|
||||
} catch (err) {
|
||||
console.error("Failed to copy text: ", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue