Revision 5162c8cc
Von Sven Schöling vor fast 8 Jahren hinzugefügt
SL/Presenter/Part.pm | ||
---|---|---|
220 | 220 |
selectors though, they are not selectable once overridden. |
221 | 221 |
|
222 | 222 |
C<part_picker> will register it's javascript for inclusion in the next header |
223 |
rendering. If you write a standard controller that only call C<render> once, it |
|
224 |
will just work. In case the header is generated in a different render call
|
|
223 |
rendering. If you write a standard controller that only calls C<render> once, it
|
|
224 |
will just work. In case the header is generated in a different render call |
|
225 | 225 |
(multiple blocks, ajax, old C<bin/mozilla> style controllers) you need to |
226 | 226 |
include C<kivi.Part.js> yourself. |
227 | 227 |
|
228 |
On pressing <enter> the picker will try to commit the current selection, |
|
229 |
resulting in one of the following events, whose corresponding callbacks can be |
|
230 |
set in C<params.actions>: |
|
231 |
|
|
232 |
=over 4 |
|
233 |
|
|
234 |
=item * C<commit_one> |
|
235 |
|
|
236 |
If exactly one element matches the input, the internal id will set to this id, |
|
237 |
the internal state will be set to C<PICKED> and the C<change> even on the |
|
238 |
picker will be fired. Additionally, if C<params> contain C<fat_set_item> |
|
239 |
a special event C<set_item:PartPicker> will be fired which is guaranteed to |
|
240 |
contain a complete JSON representation of the part. |
|
241 |
|
|
242 |
After that the action C<commit_one> will be executed, which defaults to |
|
243 |
clicking a button with id C<update_button> for backward compatibility reasons. |
|
244 |
|
|
245 |
=item * C<commit_many> |
|
246 |
|
|
247 |
If more than one element matches the input, the internal state will be set to |
|
248 |
undefined. |
|
249 |
|
|
250 |
After that the action C<commit_one> will be executed, which defaults to |
|
251 |
opening a popup dialog for graphical interaction. If C<params> contain |
|
252 |
C<multiple> an alternative popup will be opened, allowing multiple items to be |
|
253 |
selected. Note however that this requires an additional callback |
|
254 |
C<set_multi_items> to work. |
|
255 |
|
|
256 |
=item * C<commit_none> |
|
257 |
|
|
258 |
If no element matches the input, the internal state will be set to undefined. |
|
259 |
|
|
260 |
If an action for C<commit_none> exists, it will be called with the picker |
|
261 |
object and current term. The caller can then implement creation of new parts. |
|
262 |
|
|
263 |
=back |
|
264 |
|
|
228 | 265 |
=back |
229 | 266 |
|
230 | 267 |
=head1 PART PICKER SPECIFICATION |
... | ... | |
268 | 305 |
|
269 | 306 |
Should not be constrained to exact matches |
270 | 307 |
|
308 |
=item * |
|
309 |
|
|
310 |
Must be atomic |
|
311 |
|
|
312 |
=item * |
|
313 |
|
|
314 |
Action should be overridable |
|
315 |
|
|
271 | 316 |
=back |
272 | 317 |
|
273 | 318 |
The implementation consists of the following parts which will be referenced later: |
Auch abrufbar als: Unified diff
Part: doku update