Skip to content

Instantly share code, notes, and snippets.

View joshuwa's full-sized avatar

Joshuwa Jenkins joshuwa

View GitHub Profile
<a href="https://facebook.com/"><span class="fa fa-facebook-square"></span></a>
{{ sc_field i_item 'Link' [['text', "<span class="fa &quot; +  (sc_follow i_item &quot;Icon&quot; | sc_field &quot;Value&quot;) + &quot;"></span>" ]] }}
@joshuwa
joshuwa / userControl.ascx
Created February 19, 2013 16:43
Sample Glass User Control design
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DocumentRenderer.ascx.cs" Inherits="SCApplication.UI.Web.Components.Document.DocumentRenderer" %>
<h1>
<%= Editable(x => x.Title) %>
</h1>
<%= Model.DocumentTitle %>
@joshuwa
joshuwa / UserControl.ascx.cs
Created February 19, 2013 16:40
Smaple Glass User Control
public partial class DocumentRenderer : GlassUserControl<HomePage>
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
@joshuwa
joshuwa / Global.asax.cs
Created February 19, 2013 16:38
Sample Glass Global.asax
protected void Application_Start(object sender, EventArgs e)
{
var loader = new Glass.Sitecore.Mapper.Configuration.Attributes.AttributeConfigurationLoader(
"SCApplication.Core.Model, SCApplication.Core.Model");
Context context = new Context(loader);
}
@joshuwa
joshuwa / HomePage.cs
Last active December 13, 2015 22:49
A sample Glass Class
using SCApplication.Core.Interfaces;
namespace SCApplication.Core.Model
{
public class HomePage : IHomePage
{
public System.Collections.IEnumerable Children { get; set; }
public Guid Id { get; set; }
using Glass.Sitecore.Mapper.Configuration.Attributes;
namespace SCApplication.Core.Interfaces
{
[SitecoreClass]
public interface IItem
{
[SitecoreId]
Guid Id { get; set; }
}
using System.Collections;
using Glass.Sitecore.Mapper.Configuration.Attributes;
namespace SCApplication.Core.Interfaces
{
[SitecoreClass]
public interface IHomePage: IBasePage
{
[SitecoreChildren(IsLazy = true, InferType = true)]
IEnumerable Children { get; set; }
using Glass.Sitecore.Mapper.Configuration.Attributes;
namespace SCApplication.Core.Interfaces
{
[SitecoreClass]
public interface IDocument
{
[SitecoreField]
string DocumentTitle { get; set; }
}
using Glass.Sitecore.Mapper.Configuration.Attributes;
namespace SCApplication.Core.Interfaces
{
[SitecoreClass]
public interface IMetaData
{
[SitecoreField]
string MetaDataTitle { get; set; }
}