The requirements here seem to get a little contradictory: you want it out of 
the Razor views but still from within a shape. I'm getting confused about what 
your scenario is but it seems like a handler could do that. Would a handler 
work for you?

From: Chris Bower [mailto:[email protected]]
Sent: Monday, February 14, 2011 4:20 PM
To: [email protected]
Subject: Re: Common Areas of a Site

I'm following the concept of how to actually dynamically insert a shape... But 
both of those examples are doing so in a 'filter' type way (or IThemeSelector 
as it may be). Is there a good way to add a shape to a zone from within another 
shape and have it run controller logic behind the shape without having to 
analyze every request? For instance, on a custom layout, maybe I want to make a 
call like this:



WorkContext.Layout.BeforeHeader.Add(New.HeaderBar(), "1");

But I need to get some model data through to the HeaderBar shape without having 
to be tightly coupled to whatever controller needs to populate that shape. I 
was going to try to use a ShapeAttribute, but I can't figure out how to then 
allow that shape to be overrideable so that the view itself is decoupled from 
the controller.

From: Bertrand Le Roy 
<[email protected]<mailto:[email protected]>>
Reply-To: 
<[email protected]<mailto:[email protected]>>
Date: Mon, 14 Feb 2011 23:54:51 +0000
To: 
<[email protected]<mailto:[email protected]>>
Subject: RE: Common Areas of a Site

Yes, you can also look at the Vandelay Theme Picker for another example of 
injecting a shape into a zone without a widget. The notification feature is 
also doing the same thing.

From: Chris Bower [mailto:[email protected]]
Sent: Monday, February 14, 2011 1:28 PM
To: 
[email protected]<mailto:[email protected]>
Subject: Common Areas of a Site

Hey all,
So we're trying to figure out the best way to have controller logic behind 
common areas of a site, without doing it in a razor view. Here's the user story:

As a user, I want to see a list of the featured 'cases' on our site at the top 
of every page.

  *   Cases are populated based on a list of content items configured as 
'featured'
It doesn't seem to make sense to do this as a widget, because it would just be 
an empty content part with no fields, but that's the only place we can think to 
be able to put controller logic in there to drive the shape. I saw that on the 
ThemeMachine a User shape is being added to a zone manually, and there is logic 
in the User shape to display the user's name or the option to log in.

Is there a way to add a shape to a zone with logic behind it without making it 
a widget?

We have dozens of more complicated examples than this. This is just the 
simplest one I could think of. Most of our pages are composited of a lot of 
different shapes that all need separate logic behind them. If I recall, this 
was always one of my sticking points with MVC as well, as far as how to render 
out composited views without tightly coupling controllers.
---
You are currently subscribed to orchard-discuss as: 
[email protected]<mailto:[email protected]>.
To unsubscribe send a blank email to 
[email protected]<mailto:[email protected]>.
---
You are currently subscribed to orchard-discuss as: 
[email protected]<mailto:[email protected]>.
To unsubscribe send a blank email to 
[email protected]<mailto:[email protected]>.
---
You are currently subscribed to orchard-discuss as: 
[email protected]<mailto:[email protected]>.
To unsubscribe send a blank email to 
[email protected]<mailto:[email protected]>.


---
You are currently subscribed to orchard-discuss as: [email protected].
To unsubscribe send a blank email to [email protected].

Reply via email to