-
Notifications
You must be signed in to change notification settings - Fork 0
Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel
#32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -96,9 +96,13 @@ class="btn btn-primary btn-xs pull-right" | |||||||||||||||||||||||||||||
| ?> | ||||||||||||||||||||||||||||||
| <p class="help-block rex-note" style="font-size: 0.8em;"> | ||||||||||||||||||||||||||||||
| Aufruf via | ||||||||||||||||||||||||||||||
| <code>rex_getUrl('', '', ['<?= htmlspecialchars($profile['namespace'] ?? '') ?>' => {id}])</code> | ||||||||||||||||||||||||||||||
| <code class="url-copy-code" | ||||||||||||||||||||||||||||||
| data-copy="rex_getUrl('', '', ['<?= htmlspecialchars($profile['namespace'] ?? '') ?>' => {id}])" | ||||||||||||||||||||||||||||||
| title="Klicken zum Kopieren">rex_getUrl('', '', ['<?= htmlspecialchars($profile['namespace'] ?? '') ?>' => {id}])</code> | ||||||||||||||||||||||||||||||
| oder via Artikel | ||||||||||||||||||||||||||||||
| <code>rex_article::get(<?= $article->getId() ?>)->getUrl(['<?= htmlspecialchars($profile['namespace'] ?? '') ?>' => {id}])</code><br> | ||||||||||||||||||||||||||||||
| <code class="url-copy-code" | ||||||||||||||||||||||||||||||
| data-copy="rex_article::get(<?= $article->getId() ?>)->getUrl(['<?= htmlspecialchars($profile['namespace'] ?? '') ?>' => {id}])" | ||||||||||||||||||||||||||||||
| title="Klicken zum Kopieren">rex_article::get(<?= $article->getId() ?>)->getUrl(['<?= htmlspecialchars($profile['namespace'] ?? '') ?>' => {id}])</code><br> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| </p> | ||||||||||||||||||||||||||||||
|
|
@@ -209,3 +213,93 @@ class="btn btn-danger pull-right" | |||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <script type="text/javascript"> | ||||||||||||||||||||||||||||||
| (function($) { | ||||||||||||||||||||||||||||||
| // Copy to clipboard functionality | ||||||||||||||||||||||||||||||
| function copyToClipboard(text) { | ||||||||||||||||||||||||||||||
| if (navigator.clipboard && window.isSecureContext) { | ||||||||||||||||||||||||||||||
| // Modern clipboard API | ||||||||||||||||||||||||||||||
| return navigator.clipboard.writeText(text); | ||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||
| // Fallback for older browsers | ||||||||||||||||||||||||||||||
| return new Promise(function(resolve, reject) { | ||||||||||||||||||||||||||||||
| var textArea = document.createElement("textarea"); | ||||||||||||||||||||||||||||||
| textArea.value = text; | ||||||||||||||||||||||||||||||
| textArea.style.position = "fixed"; | ||||||||||||||||||||||||||||||
| textArea.style.left = "-999999px"; | ||||||||||||||||||||||||||||||
| textArea.style.top = "-999999px"; | ||||||||||||||||||||||||||||||
| document.body.appendChild(textArea); | ||||||||||||||||||||||||||||||
| textArea.focus(); | ||||||||||||||||||||||||||||||
| textArea.select(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||
| var successful = document.execCommand('copy'); | ||||||||||||||||||||||||||||||
| document.body.removeChild(textArea); | ||||||||||||||||||||||||||||||
| if (successful) { | ||||||||||||||||||||||||||||||
| resolve(); | ||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||
| reject(new Error('Copy failed')); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } catch (err) { | ||||||||||||||||||||||||||||||
| document.body.removeChild(textArea); | ||||||||||||||||||||||||||||||
| reject(err); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| function showCopyFeedback(element) { | ||||||||||||||||||||||||||||||
| var feedback = $('<span class="url-copy-feedback">Kopiert!</span>'); | ||||||||||||||||||||||||||||||
|
Comment on lines
+252
to
+253
|
||||||||||||||||||||||||||||||
| function showCopyFeedback(element) { | |
| var feedback = $('<span class="url-copy-feedback">Kopiert!</span>'); | |
| /** | |
| * Shows feedback message near the element. | |
| * @param {jQuery} element - The element to attach feedback to. | |
| * @param {string} message - The feedback message. | |
| * @param {string} [background] - Optional background color. | |
| * @param {number} [duration] - Duration in ms before feedback disappears. | |
| */ | |
| function showCopyFeedback(element, message, background, duration) { | |
| var feedback = $('<span class="url-copy-feedback"></span>').text(message); | |
| if (background) { | |
| feedback.css('background', background); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you create a new issue from this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline JavaScript should be moved to external files for better separation of concerns and maintainability. Consider creating a separate JS file for the copy functionality.