Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevinblake/3980738 to your computer and use it in GitHub Desktop.
Save kevinblake/3980738 to your computer and use it in GitHub Desktop.
Remove preview button in Umbraco
public class RemovePreviewButton : ApplicationBase
{
public RemovePreviewButton()
{
umbracoPage.Load += this.umbracoPage_Load;
}
private void umbracoPage_Load(object sender, EventArgs e)
{
var umbracoPage = (umbracoPage)sender;
var path = umbracoPage.Page.Request.Path.ToLower().Replace(
(umbraco.GlobalSettings.Path + "/").ToLower(), string.Empty);
if (path != "editcontent.aspx")
{
return;
}
var script = @"<script type=""text/javascript"">
$(document).ready(function () {
$('img[title=Preview]').siblings('img.editorIconSplit:first').remove();
$('img[title=Preview]').remove();
});
</script>";
umbracoPage.Page.ClientScript.RegisterClientScriptBlock(
umbracoPage.GetType(), "RemovePreviewButton", script, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment