Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am albertromkes on github.
  • I am albertromkes (https://keybase.io/albertromkes) on keybase.
  • I have a public key whose fingerprint is B6CD DF86 4CA5 EAF8 DD71 FB4C EF67 B197 F7DC F0FD

To claim this, I am signing this object:

@*Start of Component Presentation in View*@
@XPM.StartInlineEditingZone()
@* or for a 'submodel' (Component Presentation in a Component Presentation) *@
@XPM.StartInlineEditingZone(Model.Teaser)
@*Write out MarkUp and value*@
<h2>@XPM.Editable(m => m.Title)</h2>
var model = new ArticleModel();
new XpmActions().MakeInlineEditable<ArticleModel>(model, tridionComponentPresentation);
return model;
[InlineEditable]
public class ArticleModel
{
[InlineEditableField(FieldName="title")]
public string Title { get; set; }
[InlineEditableField(FieldName="complink_to_article")]
public HyperLink LinkToFullArticle { get; set; }
[InlineEditableField(FieldName="related_articles")]
Tridion.Configuration.ConfigurationSections tcmConfigSections = (Tridion.Configuration.ConfigurationSections)ConfigurationManager.GetSection(Tridion.Configuration.ConfigurationSections.SectionName);
var tcmSectionElem = tcmConfigSections.Sections.Cast<Tridion.Configuration.SectionElement>().FirstOrDefault(s => !string.IsNullOrEmpty(s.FilePath) && s.FilePath.EndsWith("tridion.contentmanager.config", StringComparison.InvariantCultureIgnoreCase));
if(tcmSectionElem != null)
{
var tcmConfigFilePath = tcmSectionElem.FilePath;
//load Tridion.ContentManager.config
ExeConfigurationFileMap map = new ExeConfigurationFileMap { ExeConfigFilename = tcmConfigFilePath };
var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
var myCustomResolverSettings = ((AppSettingsSection)config.GetSection("My.Tridion.CustomResolving")).Settings;
var schemaTitles = myCustomResolverSettings["schemaTitles"].Value.ToString();
@model ArticleViewModel
@foreach(var relatedLink in Model.RelatedLinks)
{
<div class="cd-list">
<a class="cd-link-ext" title="@relatedLink.Title" href="@relatedLink.Url" target="_blank">
@Html.RenderImage(relatedLink)
</a>
</div>
}
@model DD4T.ContentModel.IComponent
@foreach (IFieldSet fieldset in Model.Fields["RelatedLinks"].EmbeddedValues)
{
<div class="cd-list">@if (fieldset.ContainsKey("Link") || fieldset.ContainsKey("ExternalLink"))
{
<a class="cd-link-ext" title="" href="@fieldset[" target="_blank">
@Html.SiteEditField(Model, fieldset["Image"])
@fieldset["Image"].GetImage("img")
</a>
<div>
@XPM.MarkUp(m => m.ImageUrl)
<img src="@Model.ImageUrl" />
</div>
@model ArticleViewModel
<div class="middleContent">
@XPM.StartInlineEditingZone()
<h2>@XPM.Editable(m => m.Title)</h2>
<div class="intro">
@XPM.Editable(m => m.Summary)
</div>
public class ArticleBuilder : BuilderBase
{
private ComponentPresentation TridionComponentPresentation { get; set; }
public ArticleBuilder(ComponentPresentation componentPresentation)
{
TridionComponentPresentation = componentPresentation;
}
public Article Build()