UPDATE: Really good discussion http://drupal.org/node/948066
Posting this here whilst I get my head round stuff. I'm just going to write all thoughts down in one place. If we go with this I might try and see if we can take over this abandoned project. Here I'm trying to summarise my current research on the whole Drupal community's approach to draggble blocks.
What we're after
We want to be able to give an end-user the ability to nicely move blocks around the page and add to it. The end user has lots of events which will be a node content type. The events will have loads of different information attached to it. Speakers, Programmes, Promotional videos, images, terms and conditions, etc. These will probably all be displayed via views.
What I would like is for the end-user to be able to click "Edit layout of page" or something and move the blocks around. These blocks would only move around for that one event page and they would go into a default location for the first time when the event is created.
We'd also give them the ability to add custom blocks. They'd drag them into some area and an overlay would pop up allowing them to edit this empty block. These custom blocks really should be using Fields and so different types of custom blocks could be created (Images, videos, etc) all with the nice UI stuff that fields brings (like Media).
When clicking "Edit Layout of the page" we only want the end-user to see the blocks that are relevant to that particular page, depending on their role.
Where in Drupal is this already done?
Panels - Panels has an awesome "in-place panels editor" that allows people to click "Customise this page" and then drag and drop stuff. However the "add content" dialogue box was brilliant for when it was built but its D7 stuff isn't quite there. The dialogue box itself causes javascript issues with wysiwyg. For end users it starts getting complicated knowing the difference between panes, custom panes, reusable custom panes, custom blocks, mini-panels etc. Finally I don't know how easy it is to edit the "Add content" dialogue block to make it context sensitive such that you only see the relevant stuff.
OpenAtrium - Context, Spaces, Boxes - The Spaces Dashboard on Open Atrium is really nice. There is a brilliant screencast here.. The only issue is this is very much Drupal 6 and complicated. Do we learn this paradigm and work on porting it to Drupal 7? For example whilst boxes are better then boxes really they should be fielded and probably should be entities. There is work to do this kind of stuff so there might be mileage here and anyway, its likely that some things we need will require contexts or spaces (such as blocks only being shown depending on which page you're editing)
SubHub - www.subhub.com - These guys have a UI aimed completely at end-users. They have wrapped the core drupal 7 blocks module and built their own java script draggable UI thingy. You drag an "App" from a "select apps thingy". The "select apps thingy" also allows you to filter by your own apps you've created. An app includes for example custom text.
What is the ideal solution? - WSSCCI
I think for Drupal as a whole the ideal solution is simply the Web Services and Context Core Iniative's Phase 4. These guys will overhaul blocks and everything from the ground up and then eventually allow people to do layouts well. They are a core iniative so obviously have huge community traction, they are planning to back-port some stuff to Drupal 7 through modules and they have people like the panels team joining in the discussion.
However these guys will take 2 years, and it may be 3 years before contrib catches up with Drupal 8. So we can't use this stuff now.
Why create a whole new module for this? Why not work with others?
Well the draggable bit is probably not going to be complicated. I've been told that we can use jquery to do this quite easily as long as there is a method of defining draggable regions which shouldn't be too complicated.
Also we could work with those other modules such as panels or contexts. But they are large beasts that are also working towards the holy grail of WSSCI. So its not likely that panels will be super-user friendly for end users in 2 months time even if we got involved. Besides in doing "Draggable blocks" the problem is not the draggable but its the Blocks.
What is it we plan on dragging?
The main thing we need to decide is what we want to drag. It can't be purely core drupal blocks as they are not flexible enough to for example, appear in different regions of different pages. They also don't use fields. Here are the alternatives and the first question I want to answer is what we plan on dragging.
http://drupal.org/project/panels - They have Panes, Custom Panes, Reusable Custom Panes
http://drupal.org/project/boxes - Fits in with the Contexts, Spaces ecosystem. Worked well in D6
http://drupal.org/project/block - Block 2.0, last modified May 2011. Has no Code. Issues compare it to other solutions
http://drupal.org/project/block_api - Has the best namespace. Work started on Drupal6 though so I don't know how much of drupal 7 it takes advantage of.
http://drupal.org/sandbox/fabsor/1158058 - Entity Block. Yet another implentation of blocks! This has merged with Beans
http://drupal.org/project/bean - Beans are block entities and therefore fieldable. Has has the most amount of development work on it and sponsered by some agencies. Has a name that makes it look like a block alternative rather then replacement.
http://drupal.org/project/brick - Another group of people doing blocks. These integrate with Context and Panels better but are still in development.
Things I'd like:
- A Block replacement. Therefore it should do literally everything you'd expect a block to do and more. Drupal should barely see this as any differently to a block and therefore any modules that use blocks should use this. For example contextual links should "just work". (This I think rules out panes as only panels can use panes).
- Not a block alternative - Similar to the first point, but once we have these blocks we should never need to use core drupal blocks at all.
- Should be entities - This means we can use fields and all modules that work with fields. I think this rules out boxes as they currently stand.
- Upgrade path - I should be able to move all my core drupal blocks into this module
- Fitting in with the overall community - This is only temporary. Whatever direction this block stuff goes should eventually fit in with WSSCI
Will start writing up which one of these alternatives to pick.
Comments
Comment #0.0
yautja_cetanu commentedAdded Entity Blocks
Comment #1
rupertj commentedOur system at SubHub works like this:
We have a module that provides all the blocks our users can place, which they do so by dragging them to where they want them. There's no access to the normal blocks admin page. Our module has hooks for other modules to register block types, in a similar way to bean/block_api and can store an array of settings per block. What I've been hoping to do for a while is replace our module with one of these other modules. (They didn't exist back when we started developing our platform, and by now should be better than ours, I'd imagine.) Then, reimplement the JS for draggability on top of whatever we choose. So, my proposal would be:
1) Make a choice on which base block replacement module we prefer.
2) Make another module that builds on that for drag functionality. (I can provide some of our code as a starting point for this.)
3) Hook it all together :)
Comment #1.0
rupertj commentedAdded a discussion
Comment #2
yautja_cetanu commentedLong conversation with the guy who made beans.
Important Summary:
- Beans take an object approach
- Block_api takes a procedure approach
- Beans can appear at different places on different pages with a different ctype.
- Beans are not context sensitive (like panes in panels). May need Panels everywhere.
Comment #2.0
yautja_cetanu commentedAdded bricks
Comment #3
hatuhay commented