Content Selector with page preview
This file contains 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
public class ExtendedContentReferenceSelctorAttribute : Attribute, IMetadataAware | |
{ | |
public void OnMetadataCreated(ModelMetadata metadata) | |
{ | |
((ExtendedMetadata)metadata).ClientEditingClass = "alloy.editors.extendedContentSelector"; | |
} | |
} |
This file contains 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
define([ | |
"dojo/_base/declare", | |
"dojo/_base/lang", | |
"dojo/on", | |
"epi-cms/widget/ContentSelector", | |
// resources | |
"epi/i18n!epi/cms/nls/episerver.shared.header" | |
], | |
function( | |
declare, | |
lang, | |
on, | |
ContentSelector, | |
headingResources | |
) { | |
return declare("alloy.editors.extendedContentSelector", [ContentSelector], { | |
contentId: null, | |
contentUri: null, | |
contentTypeName: null, | |
_updateDisplayNode: function (content) { | |
this.contentUri = content.uri; | |
this.contentId = content.contentLink; | |
this.contentTypeName = content.contentTypeName; | |
this.inherited(arguments); | |
}, | |
_updateDisplayNodeTitle: function () { | |
this.inherited(arguments); | |
this.resourceName.title = this.resourceName.title + ", " + headingResources.id + ": " + this.contentId + " (" + headingResources.type + ": " + this.contentTypeName + ")"; | |
}, | |
buildRendering: function () { | |
this.inherited(arguments); | |
on(this.resourceName, "dblclick", lang.hitch(this, function () { | |
var contextParameters = { uri: this.contentUri }; | |
dojo.publish("/epi/shell/context/request", [contextParameters]); | |
})); | |
} | |
}); | |
}); |
This file contains 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
public abstract class SitePageData : EPiServer.Core.PageData | |
{ | |
[Display(GroupName = SystemTabNames.Content)] | |
[UIHint(UIHint.Image)] | |
[ExtendedContentReferenceSelctor] | |
public virtual ContentReference PageImage { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment