This project is read-only.

Variable+orderable widgets per content item

Topics: Customizing Orchard, Writing modules
Apr 8, 2013 at 2:18 AM
In a previous CMS I worked with, it was possible to create a page, then drop in per-page "widgets" into zones in the page. You could drag and drop the widgets within each zone to control the ordering, and you could edit content in the widgets per-page.

For instance, I might have a page and drop into the Content zone in order:
  1. HTML widget
  2. Form widget
See the attached screenshot for an example - I have a 'page content' widget followed by a 'contact form'. The page content is editable in-place. Both are re-orderable in the zone by drag-and-drop.


The content in the HTML widget is be strongly associated with the page. This approach gave the end user a lot of flexibility in constructing pages.

Now... jumping into Orchard land, I want to achieve something similar. The user needs to be able to create a page and put content in certain zones and re-order that content, just like I did above.

I foresee the user clicking on 'create new page' in the CMS, and then where the 'body' editor would normally be, they can add and control the ordering of 'widgets' - but I will use the term 'gizmo' instead now to denote a kind of widget that is associated with a zone AND an instance of a content item, not just a zone+layer.

It would be a requirement that they can edit the content of each of these gizmos in-place during page creation/editing - it would be too difficult for our users to try to understand parent/child relationships between pages and gizmos, and create a page then have to go off and create children and edit them individually.

I have a rough idea that this kind of thing could be achieved using Container/Containable. However, the thing I'm concerned about is whether it would be possible to create/edit the parent page and the child gizmos simultaneously on the same create/edit page.

I'd really appreciate any suggestions. Achieving this is crucial to the success of our project.

Apr 10, 2013 at 12:53 PM
Although it is not exactly as you described, there is a module that allows you to associate widgets with content items. You can't edit the widgets within the content item editor itself - it will take you to another widget editor page (future updates my have dialogs so the user stays on the same page).
You can move widgets around using drag & drop though.

There has been talk about improving and/or replacing the above mentioned module with something more sophisticated.
We may have gizmos in a future release, but there are no concrete plans yet as far as I know.
Apr 10, 2013 at 12:58 PM
You such a salesman Sipke :)
Apr 10, 2013 at 1:06 PM
Just pointing out potentials :)
Apr 10, 2013 at 10:45 PM
Thanks mate...that will do the trick for the time being.

What I would really like to see is in-page editing, as in the screenshots above. I don't think this would be all that hard to achieve really....
Apr 13, 2013 at 12:31 AM
Agreed. We'll see...
Apr 13, 2013 at 12:49 AM
Another thing for the wishlist... it would be great to be able to share widget content across multiple pages. So rather than instantiating a widget for every single content item you want to associate it with, you could instantiate and share across multiple pages. :)
Apr 13, 2013 at 6:51 AM
Now you got me confused. What's wrong with good old widget layers to share widgets across pages?
Apr 13, 2013 at 11:38 AM
I was just about to say the same: isn't that why we have widget layers? :)
Apr 14, 2013 at 4:41 AM
Because layers aren't properly tied to pages... they are loose with URL rule matching. Also it's messy if you just have a few pages you want to show a widget on to create a rule for that.

If you associate the widget with the content item it's much stronger, in my opinion.
Apr 14, 2013 at 11:19 PM
Edited Apr 14, 2013 at 11:20 PM
I don't agree. The fact that it isn't tied to just content items is much stronger in my opinion.
To give an example, I have been working on a number of sites that require widgets being rendered, not just on content items, but on pages generated by other controllers as well.
This allowed me to create layer rules based for example on the current route values, displaying the same widgets on both a content item and a page generated by a different controller where no content items were involved.
Very flexible.

That being said, you can of course totally do what you are looking for as a custom module.
Apr 15, 2013 at 2:16 AM
Yup, for example you could build a layer rule that takes a list of content ids.
Apr 15, 2013 at 9:12 AM
Our CMS users aren't really technically minded people though... I can't expect them to create/modify layer rules for widgets. Nor would I really want to give them permission to edit them 'cause they could break the site.

On the other hand... if they can drop gizmos into content items, they can't break anything except the page they're editing.
Apr 17, 2013 at 7:35 AM
Well, you can't have it both ways.
Apr 17, 2013 at 7:37 AM
I'm not sure what you mean Bertrand. Which are the two ways that I ostensibly want? What's wrong with trying to make things easier for the user...?
Apr 17, 2013 at 7:39 AM
There is nothing wrong with making things easier. The two ways are:
  1. manage your widgets across pages
  2. not using layers
If you want something different, you'll have to build it yourself.