Published on

Sitefinitys ContentView can be an ass#$%@ sometimes

Authors

Just about all content controls in sitefinity in one way or another inherits from ContentView…and ContentView can toggle between a MasterView (list mode) and DetailMode (single view).

So here’s the problem…ContentView assumes if you only have ONE item selected you want it to render in DetailMode.  In every case, no exceptions…

BAD CONTENTVIEW, BAD!

Ashamed dog

Why is this bad?

Well it makes assumptions for you…so your designer might say “On the left bar I want a list of images, when someone clicks them, a lightbox pops up showing the larger image”.

So great, you plop on the ImageAssetsField control and all looks fine…until someone uploads only one image.

What happens now is that your list of thumbnails has turned into one giant fullsized image which (unless you do overflow:hidden on the sf_cols) is overflowing into your content area with no lightboxing  So now we’re wayyyy down the rabbit hole of unintended content with no ability to even fix it.

Lets even say that your designer wants a piece of module builder related content to appear in a list on a page…again, all works…until only one Guid is linked, then the stupid item shows up in full detail mode instead of maybe just a simple ul\li with a title and description.

MOREOVER…when it’s in detail mode it also changes the stupid Page title and breadcrumb :p…

“Well can’t I just make the detail view template look like the master item?”

Technically?..yeah, you could…but it’s a huge pain and literally duplicates all your templates.  Make a quick tweak to master, better make sure to do it as well in the DetailFakeMaster template…and also better remember to duplicate the master views on every single new content type (just in case)…pain in the ass

“Well why don’t you just set it to render in Master?”

…you can’t, believe me, I’d love to…this is where I think there’s a bug or a fundamental design “oops”.  It just toggles based on count > 1…

“What about a custom control?”

Sure, but…for every piece of content in sitefinity?..go nuts…crazy person :)

Where to go from here

Ivan says he’ll look into it, for 6.0?..doubtful…but hopefully not to much longer after :/  I’d LOOVE it to be in 6 if it’s such a small change…but seeing as everyone keeps saying 6.0 will be out in april…we’re down to the wire.