Created
August 9, 2016 16:30
-
-
Save csdear/b2b97bcf05e3aec69874bf2cf5a72fe2 to your computer and use it in GitHub Desktop.
N2 : Parts Template
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
//e.g SocialMediaItemPart.cs | |
using Cadence.Web.Models.N2.Base; | |
using N2; | |
using N2.Details; | |
using N2.Persistence.Serialization; | |
namespace Cadence.Web.Models.N2.Parts { | |
//similar to the PageDefinition attribute on the page template, this attribute | |
//tells N2 that this is a Part with the friendly name "Social Media Link" | |
[PartDefinition("Social Media Link")] | |
//this attribute tells the admin to allow the user to edit the title (a built-in property of N2Item) while editing the part | |
[WithEditableTitle] | |
//AbstractPart inherits from N2tem - same comments apply as AbstractPage above | |
public class SocialMediaItemPart : AbstractPart { | |
//Both parts and pages can have files attached to them. These two attributes denote that the property represents a | |
//file attachment and that the admin should display the property as a file upload input, respectively | |
[FileAttachment, EditableFileUpload("Button Image", 1)] | |
public virtual string SocialMediaButtonImage { get; set; } | |
//the most typical editable input attribute | |
[EditableTextBox("Social Media Url", 5)] | |
public virtual string SocialMediaUrl { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment