Skip to content

Instantly share code, notes, and snippets.

@sotirisf
Last active August 11, 2018 23:06
Show Gist options
  • Select an option

  • Save sotirisf/477c41be2e8dca3b3755c4c53a9f62f4 to your computer and use it in GitHub Desktop.

Select an option

Save sotirisf/477c41be2e8dca3b3755c4c53a9f62f4 to your computer and use it in GitHub Desktop.
Code behind for Umbraco dynamically- generated Javascript for hiding back-end properties
using System.Configuration;
using System.Web;
namespace MyNamespace
{
public class HidePropertiesJsOutput : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/javascript";
string fieldsToHide = ConfigurationManager.AppSettings.Get("HideBackEndFields");
if (!string.IsNullOrEmpty(fieldsToHide))
{
foreach (string field in fieldsToHide.Split(','))
{
context.Response.Write("$(document).arrive(\"div[data-element='property-" + field + "']\", function () { $(this).hide(); });\r\n");
}
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment