| Jifty documentation | Contained in the Jifty distribution. |
Jifty::Action::Autocomplete - An action for making autocompletion suggestions
A built-in Jifty::Action which returns suggested autocompletions
for a given argument of an action. Generally this is called by Jifty's
internals through /__jifty/autocomplete.xml.
This action gets its data to /__jifty/autocomplete.xml by filling in the
completions of the content in Jifty::Result.
The arguments for Autocomplete are:
The moniker (moniker in Jifty::Manual::Glossary) of an action we want to pull a field to autocomplete from.
The fully qualified name of the argument (argument in Jifty::Manual::Glossary)
to action that we want to complete.
Find the submitted action in the Jifty::Request named by the
action above, and ask it for autocompletion possibilities for the
argument in question.
Jifty is Copyright 2005-2010 Best Practical Solutions, LLC. Jifty is distributed under the same terms as Perl itself.
| Jifty documentation | Contained in the Jifty distribution. |
use warnings; use strict;
package Jifty::Action::Autocomplete; use base qw/Jifty::Action/;
sub arguments { { moniker => {}, argument => {} } }
sub take_action { my $self = shift; # Load the arguments my $moniker = $self->argument_value('moniker'); my $argument = $self->argument_value('argument'); # Load the action associated with the moniker my $request_action = Jifty->web->request->action($moniker); my $action = Jifty->web->new_action_from_request($request_action); # Call the autocompleter for that action and argument and set the result my @completions = $action->_autocomplete_argument($argument); $self->result->content->{completions} = \@completions; return 1; }
1;