I'm working on feeds, which have textfields holding the url.
I have separated each URL for each store into own textfields (since some has wondered what the URL's are for each when they don't display), and wants to have a simple copy function for them.
T.ex. for multi select of checkboxes we can add links like:
Is there a similar easy way to add a copy link for textfields, or do we need to add a JS for each feed view?
At the moment I have a button, but if it can be improved and made a link it would be better.
Button Code:
JS Code:
PS! When I'm done with my feeds, I'll make PR for the core feeds. Adding multi store support etc.
I have separated each URL for each store into own textfields (since some has wondered what the URL's are for each when they don't display), and wants to have a simple copy function for them.
T.ex. for multi select of checkboxes we can add links like:
<a on-click="$(this).parent().find(':checkbox').prop('checked', true);"><?php echo $text_select_all; ?></a>
/ <a on-click="$(this).parent().find(':checkbox').prop('checked', false);"><?php echo $text_unselect_all; ?></a>
Is there a similar easy way to add a copy link for textfields, or do we need to add a JS for each feed view?
At the moment I have a button, but if it can be improved and made a link it would be better.
Button Code:
<button type="button" class="btn btn-default badge" on-click="copyToClipboard('#input-data-feed-<?php echo $store['store_id']; ?>')"><?php echo $text_copy; ?></a>
JS Code:
function copyToClipboard(element) {
var $temp = $("");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
}
PS! When I'm done with my feeds, I'll make PR for the core feeds. Adding multi store support etc.
In Development
Share this post:
Your Reply
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »