EPiServer

Shorter epi prefix for EPiServer:Property

Posted on Updated on

Declaration of a property output in Page.aspx. This is one the most common code through the whole solution.

<EPiServer:Property runat="server" PropertyName="ContactsArea"></EPiServer:Property>

I like to make repetitive markup to be smaller and have:

<epi:Property runat="server" PropertyName="ContactsArea"></epi:Property>

In your web.confing instead of

<add tagPrefix="EPiServer" namespace="EPiServer.Web.WebControls" assembly="EPiServer" />
<add tagPrefix="EPiServer" namespace="EPiServer.Web.WebControls" assembly="EPiServer.Web.WebControls" />
<add tagPrefix="EPiServer" namespace="EPiServer.Framework.Web.WebControls" assembly="EPiServer.Framework" />

you put:

<add tagPrefix="epi" namespace="EPiServer.Web.WebControls" assembly="EPiServer" />
<add tagPrefix="epi" namespace="EPiServer.Web.WebControls" assembly="EPiServer.Web.WebControls" />
<add tagPrefix="epi" namespace="EPiServer.Framework.Web.WebControls" assembly="EPiServer.Framework" />
Advertisements

Why I don’t like Web Forms in EPiServer

Posted on Updated on

It can be avoided using Macio code (lambdas).

Feedback after academy

Posted on

I had an Academy today. It’s a time when anybody from company can have a presentation on any topic. I had a presentation about EPiServer 7 (MVC) development.

I want to point the feedback I get to not forget it for the next Academy:

  • I could focus on less topics, but cover them more deeply with more examples
  • It was too much chaotic, I was not following a plan (there was no strict plan, let’s say). And it would be difficult to make the same presentation again.

Fill CurrentPage after PostBack in MVC

Posted on

public class PageContextActionFilter : IResultFilter
{
    private readonly IContentLoader _contentLoader;

    public PageContextActionFilter(IContentLoader contentLoader)
    {
        _contentLoader = contentLoader;
    }

    public void OnResultExecuting(ResultExecutingContext filterContext)
    {
        var model = filterContext.Controller.ViewData.Model as IPageViewModel<StandardPage>;
        if (model == null)
            return;

        // code like in Alloy Template

        // When ViewModel is posted back to server by POST, CurrentPage is null, so its set here
        if (model.CurrentPage == null)
        {
            var pageReferene = filterContext.RequestContext.GetContentLink();
            var concreteModel = model as PageViewModel<StandardPage>;
            if (concreteModel != null)
            {
                var currentPage = _contentLoader.Get<StandardPage>(pageReferene);
                concreteModel.CurrentPage = currentPage;
            }
        }
    }

    public void OnResultExecuted(ResultExecutedContext filterContext) { }
}

TinyMCE in EPiServer

Posted on

You can embed a video using TinyMCE, and there is even a preview:
insert video in TinyMCE EPiServer

Defenition of done

Posted on

For EPi page/task (still WIP)

• Validators
• Localization of everything user visible (this is tricky, sometimes it’s better to leave it to one person responsibly for this near the end).
• Description of done things, funny, some info funny info for customer like in Joel.
• Explain to person responsible for contacting customer, but first let them read the Description from previous point.

EPiServer misc

Posted on Updated on

Post that is constantly being edited.

ImageAlternateText is better name than ImageDescription, then we are talkinga bout alt attribute needed for images.

string.IsNullOrEmpty(Container.Item.Intro ?? “”) – czy gdy wrocimy do pustego to bedzie null czy puste?
– gdy wrócimy do pustego to jest nullem, więc nie trzeba żadnych IsNullOrEmpty() robić.

private readonly IContentLoader _contentLoader;
Zamiast IContentRepository

var currentContextPage = ControllerContext.RequestContext.GetContentLink();

From

[Required] nadawać na rzeczy od których zależy logika w innych miejscach. Czyli gdy jest to:

[Required]
[UIHint("CatalogNode")]
[BackingType(typeof(CatalogNodeBrowserProperty))]
public virtual string CatalogNode { get; set; }

W przypadku rzeczy które też muszą być, ale ostatecznie będzie tylko gorzej wyglądać to bym nie ograniczał:

[CultureSpecific]
public virtual String Subtitle { get; set; }