valdisiljuconoks / optimizely-advanced-contentarea

Optimizely content area renderer on steroids
Apache License 2.0
34 stars 14 forks source link

Add default block display mode on content area #13

Closed marisks closed 6 years ago

marisks commented 8 years ago

It would be great if default width of the block could be added for content area. The setting could be configured through attribute on content are property like:

[DefaultDisplayMode("one-third")
public virtual ContentArea ContentArea {get;set;}

If "one-third" does not exist, fallback to full width.

valdisiljuconoks commented 8 years ago

Glimpse of upcoming feature:

[ContentType(...)]
[DefaultDisplayOption(ContentAreaTags.HalfWidth)]
[DefaultDisplayOptionForTag("ca-tag", ContentAreaTags.OneThirdWidth)]
[DefaultDisplayOptionForTag("ca-tag2", ContentAreaTags.ThreeQuartersWidth)]
public class SomeBlock : BlockData
{
}

DefaultDisplayOptionForTag regulates which DisplayOption will be chosen by default if Content Area was rendered with tag Html.ContentArea(m => m.ContentArea, new { tag = "..." })

valdisiljuconoks commented 8 years ago

New feature will control default display option from block's perspective at the moment though.

valdisiljuconoks commented 8 years ago

another upcoming feature:

public class StandardPage : PageData
{
    [DefaultDisplayOption(ContentAreaTags.OneThirdWidth)]
    public virtual ContentArea MainContentArea { get; set; }
}
kmukku commented 6 years ago

@valdisiljuconoks Is it possible to set the default DisplayOption for Block from inside the Block model, like you can do with the Additional Styles? It would be handy when migrating from another renderer with DisplayOption already set into Block.

valdisiljuconoks commented 6 years ago

hi,

you mean not like this with attributes:

[ContentType(...)]
[DefaultDisplayOption(ContentAreaTags.HalfWidth)]
public class Block { ... }

but from the block content type code itself?

valdisiljuconoks commented 6 years ago

not at the moment, but it might be pretty easy to add..

kmukku commented 6 years ago

Yes, from the block content type code itself. This might also be possible to achieve by using "Modify Block Start Element" technique, but I'm having difficulties to get it work. I'm converting old webforms site to MVC razor and trying to replace rendering engine used in web forms to this one. Such a mess. 🙈

valdisiljuconoks commented 6 years ago

hahhaaa.. that's phrase I haven't seen for a while good luck! :)

what do you think - who would win if you are dropping block with display option (DO1) set via attribute, having also override in method (DO2) into the content area with default display option set to DO3?

kmukku commented 6 years ago

Tough one. The most inner/specific setting (DO2) should be the winner?

valdisiljuconoks commented 6 years ago

moved to new issue #35