Last active
August 29, 2015 14:19
-
-
Save komainu85/36496a4a4bbb3cea6770 to your computer and use it in GitHub Desktop.
Glass Helpers for attributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Specialized; | |
namespace MikeRobbins | |
{ | |
public class GlassHelpers | |
{ | |
public static NameValueCollection CssClass(string cssClass) | |
{ | |
var collection = new System.Collections.Specialized.NameValueCollection { { "class", cssClass } }; | |
return collection; | |
} | |
public static NameValueCollection Image(string cssClass, int height, int width) | |
{ | |
var collection = new System.Collections.Specialized.NameValueCollection { { "class", cssClass }, { "height", height.ToString() }, { "width", width.ToString() } }; | |
return collection; | |
} | |
public static NameValueCollection Attribute(string attributeName, string attributeValue) | |
{ | |
var collection = new System.Collections.Specialized.NameValueCollection { { attributeName, attributeValue } }; | |
return collection; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Editable(x => x.Link,MikeRobbins.GlassHelders.CssClass("cssClassName")) | |
@Editable(x => x.FeaturedImage,MikeRobbins.GlassHelders.Image("cssClassName",200,200)) | |
@Editable(x => x.Link,MikeRobbins.GlassHelders.Attribute("AttributeName","AttributeValue")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%=Editable(x=>x.Link,MikeRobbins.GlassHelders.CssClass("cssClassName") ) %> | |
<%=Editable(x=>x.FeaturedImage,MikeRobbins.GlassHelders.Image("cssClassName", 200, 200) ) %> | |
<%=Editable(x=>x.Link,MikeRobbins.GlassHelders.Attribute("AttributeName","AttributeValue") ) %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment