Archive for the ‘web development’ Category

How to close a jQuery dialog box by clicking outside of it

Monday, November 30th, 2009

JQuery gives you a very simple way to create dialog overlays with the dialog() event. So, by clicking an HTML element you can activate a “stay-on-the-page” overlay dialog box.

Traditionally one might use dialog boxes to ask the user a question to which she must respond (e.g. with an “Ok” or “Cancel”) but their use can extend beyond this. For instance I’ve used a dialog to show a mega drop-down menu; i.e. clicking a link opens a dialog box with a list of categorised links.

JQuery’s default behaviour for closing dialog boxes is not unreasonable: the user must click on the “Close” button (e.g. in the form of text or an “x”) or hit the escape key. However it’s possible you may want to provide more options for your users to close a box by simply clicking outside it.

I puzzled over this and didn’t get very far with Googling but came up with the following solution which seems to work.

When your dialog is created, a div with the class “ui-widget-overlay” is also created which “greys out” the background allowing the user to fully focus on the dialog. You can use this as a hook to add your dialog closing code, e.g.


$(".ui-widget-overlay").live("click", function() {  $("#quick-links-modal").dialog("close"); } );

In this case my dialog has the ID “quick-links-modal”. NB you need to use the “live” event (rather than “click” etc.)  in order to bind the event to your dialog before the dialog has been initiated.

Review of Plone 3 Theming by Veda Williams

Sunday, September 27th, 2009

Plone 3 theming

Veda Williams‘ Plone 3 Theming (Packt, 2009) [Amazon UK | Amazon US | Packt] is a useful reference for anyone involved in customising the look and feel of their Plone-based website. Used alongside the various online resources on the plone.org website, particularly the Plone Theme Reference,  it should ease  most of the pain that Plone themers experience. Unfortunately (and this is not a criticism of the author), the book is let down by some poor copy-editing. It also contains a number of errata, which the author is gathering on the plone.org website.

The book is broken down into fifteen chapters, the most useful of which I found were chapters seven to twelve which deal with the day-to-day business of Plone theming.  These chapters cover customising viewlets and portlets, an overview of the Zope templating language ( ZPT), the creation and installation of a Plone theme, template changes, custom page views and theming tips. Although I’ve done a fair amount of Plone theming, I still find it quite esoteric and complex so it’s certainly very useful to have these chapters to refer back to.

Chapter fifteen, written by Alex Limi, gives an overview of the future of Plone theming using products such as collective.xdv and Deliverance. These seem an ultimately saner way to proceed and should allow non-Plone specialists to theme a site without getting too bogged down in Plone specifics. This article is also freely available on the Plone website where it will be updated as the project develops.

I did wonder if the second chapter was really necessary — this provides an overview of the main graphic design, browser and text editing tools. I imagine that most web designers and developers already know about these and the complete beginner would be encouraged to to stay away from Plone until they are a little more experienced.

That aside, the only real complaint I have about the book is the quality of the copy-editing. I think the text would in places benefit from a little slimming down or rephrasing. I occasionally struggled with some of the explanations , although it must be borne in mind that Plone 3 theming is complex so is by its very nature difficult to explain in simple terms. Some other examples: it’s probably not necessary to have sentences like, “now what, you ask?” in a tutorial book and I’m not sure why there is a lengthy code sample from Plone 2 on pages 129-30 which is really only produced to show how things were done the “old way”.

Anyone who has been involved in Plone theming will know how hard Veda Williams has worked on it: in addition to this book, she coordinated the Out of the Box Plone Themes project. For her work I’m sure she has the gratitude of every Plone themer. Hopefully subsequent editions of the book will address the editorial issues and errata.

Review of Designing Web Interfaces on DRB

Tuesday, July 21st, 2009

My review of Designing Web Interfaces by Bill Scott and Theresa Neil (O’Reilly, 2009) is now up on the Designers’ Review of Books website.

Posted via email from What’s this for?