Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add this to a snippet and include that snippet before the </body> tag. Adds an edit link to edit content. Only shows up if you are logged-in your store's admin.
{{ '//' | stylesheet_tag }}
.edit-tool {
float: right;
position: fixed;
right: 0;
top: 70px;
background-color: white;
padding: 5px 10px;
-webkit-box-shadow: -1px 0px 3px 0px rgba(50, 50, 50, 0.6);
-moz-box-shadow: -1px 0px 3px 0px rgba(50, 50, 50, 0.6);
box-shadow: -1px 0px 3px 0px rgba(50, 50, 50, 0.6);
.edit-tool a {
color: #555;
cursor: pointer;
$(window).load(function() {
if ( $('#admin_bar_iframe').size() ) {
$('body').append('<div class="edit-tool"><a><i class="fa fa-pencil-square-o"></i> Edit this </a></div>').find('.edit-tool a').click(function(e) {
(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src=""+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.10.1",function($,L){var s=$(location).attr("hostname"),u=$(location).attr("href")+".json";$.ajax({url:u,type:"GET",dataType:"json",success:function(o){if(o.hasOwnProperty("product")){var;window.location.href="https://"+s+"/admin/products/"+t}else if(o.hasOwnProperty("collection")){var;window.location.href="https://"+s+"/admin/collections/"+t}else if(o.hasOwnProperty("page")){var;window.location.href="https://"+s+"/admin/pages/"+t}else alert("Sorry, but you cannot use this here.")},error:function(){alert("This cannot be used here.")}});});

This comment has been minimized.

Copy link

@suture suture commented Jul 15, 2016

It no longer works on Article pages, now that the URL system has been changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment