croogo/croogo — pull request #132 by rchavik (2013-02-11 05:43:27+00:00)
Title: Popup for selecting Nodes/Blocks/Users

This pull request adds a feature to allow opening a popup (using thickbox) similar to the current popup used when selecting a node when creating/updating links.

Eg:

```javascript
// activate for 3 form fields: #NodeUrl, #BlockId and #BlockTitle
// `type` is simply the model, while attr denotes the value to use in the main form
$('.chooser').itemChooser({
fields: [
{ type: 'Node', target: '#NodeUrl', attr: 'rel' },
{ type: 'Block', target: '#BlockId', attr: 'data-chooser_id' },
{ type: 'Block', target: '#BlockTitle', attr: 'data-chooser_title' }
]
});
```

In the popup's iframe, you can click items to 'select' them and returns the selected value to the originating window. The returned value can then be used to populate form fields, or simply for display.

This feature is desired because it will provides functionality for external plugins to 'select' existing records from any model. For example: a gallery/photo plugin might want to associate a node for one of its picture.

A sample form has been added in the Example plugin to demonstrate this functionality.