Posted by Scott Laird
Sun, 17 Jul 2005 05:37:23 GMT
I was looking over yesterday’s sidebar work and noticed two shortcomings:
- While it’s really easy to add new sidebar plugins (just drop the files into place and it’ll pick them up and make them available for use), that only works if sidebar items don’t need any configuration options. If the sidebar needs to ask the user for configuration, then you need to patch
app/models/configuration.rb and app/views/admin/general/index.rhtml, which can be kind of non-trivial.
- This whole model limits users to only displaying each sidebar type once. Take a look at poocs.net and notice that he has two Tada lists. That’s not really possible with my new sidebar model, short of cloning the
tada plugin to create a tada2 plugin, which is ugly.
So, I’m reworking things. I’m allowing users to add individual sidebar items multiple times, and I’m moving the sidebar config data into the sidebar itself, out of Typo’s main configuration system. I’m currently able to create multiple Flickr entries in the database using the new admin UI, but there’s still quite a bit of work left to do.
When this is all done, we should have a really deeply cool drag-and-drop sidebar configuration system that is better then the current system in every way, except perhaps for a bit of complexity. Hopefully it’ll be acceptable to the Typo maintainers.
Update: A screenshot is available.
Posted in Typo | Tags sidebars, typo | 8 comments
Posted by Scott Laird
Fri, 15 Jul 2005 15:45:53 GMT
I spent half the night working on a monster patch for Typo that totally reworks the way Typo’s sidebar works. Before, all of the items that you see on the right side of this blog were statically coded into the app/views/layout/article.rhtml file. To change the URL for your Flickr images, you had to edit the source by hand. Adding new items involved editing three or four files.
That’s all gone now.
I moved all of the sidebar items into a new component/sidebars/plugins directory, and added a sidebar controller that drives them. It automatically loads all of the sidebars in the plugin directory, so you can install new sidebars by simply dropping the files into place. No more editing source files and then fighting to keep the changes merged. I moved all of the configuration data for each plugin into Typo’s configuration database, so you can edit everything via the admin interface.
Finally, I added another admin block to control the sidebar layout. You can use Rail’s nifty Javascript drag-and-drop support to enable and disable individual sidebar items and to change the order in which they appear. It’s kind of ugly right now, but a bit of CSS will fix that eventually.
I posted my patch to Typo’s bug-tracking database, but it’s really young code, mostly written in the middle of the night, so I wouldn’t recommend using it quite yet. Once I’ve had a chance to clean it up a bit I’ll give it a bit of testing here and then submit a newer patch to trac and hopefully it’ll get merged.
Posted in Typo, Blog stuff | Tags sidebars, typo | 7 comments