1 |
dpavlin |
9 |
<%init> |
2 |
|
|
|
3 |
|
|
my $region = Jifty::Web::PageRegion->new( |
4 |
|
|
name => 'results', |
5 |
|
|
); |
6 |
|
|
|
7 |
|
|
Jifty->subs->add( |
8 |
|
|
class => 'Result', |
9 |
|
|
mode => 'Bottom', |
10 |
|
|
region => 'results', |
11 |
|
|
render_with => '/fragments/result', |
12 |
|
|
); |
13 |
|
|
|
14 |
|
|
my $fetch = Jifty->web->new_action( |
15 |
|
|
class => 'Fetch', |
16 |
|
|
moniker => 'fetch', |
17 |
|
|
arguments => { %ARGS }, |
18 |
|
|
sticky_on_success => 1, |
19 |
|
|
); |
20 |
|
|
|
21 |
|
|
use Data::Dump qw/dump/; |
22 |
|
|
|
23 |
|
|
</%init> |
24 |
|
|
|
25 |
dpavlin |
18 |
<&| /_elements/wrapper, title => 'Grep - powerful RSS searcher' &> |
26 |
dpavlin |
9 |
|
27 |
dpavlin |
21 |
<a class="bookmarklet" href="javascript:location.href='<% Jifty->web->url( path => '/add' ) %>?uri='+encodeURIComponent(location.href).replace(new RegExp('%(26|3b)','gi'),'{x!$1}')+'&title='+encodeURIComponent(document.title)+'&cookie='+encodeURIComponent(document.cookie).replace(new RegExp('%(26|3b)','gi'),'{x!$1}')" title="drag and drop to bookmark toolbar to quickly add feed to grep">+grep</a> |
28 |
dpavlin |
10 |
|
29 |
|
|
|
30 |
dpavlin |
9 |
<% Jifty->web->form->start %> |
31 |
|
|
|
32 |
|
|
<% $fetch->form_field('q') %> |
33 |
|
|
<% $fetch->form_field('feed') %> |
34 |
|
|
|
35 |
|
|
<% $fetch->button( label => 'Grep' ) %> |
36 |
|
|
|
37 |
|
|
<% Jifty->web->form->end %> |
38 |
|
|
|
39 |
|
|
% if ( my $result = Jifty->web->response->result('fetch') ) { |
40 |
|
|
% if ( my $items = $result->content('items') ) { |
41 |
|
|
% foreach my $i ( @$items ) { |
42 |
|
|
|
43 |
|
|
<& /fragments/result, item => $i &> |
44 |
|
|
|
45 |
|
|
% } |
46 |
|
|
% } |
47 |
|
|
% } |
48 |
|
|
|
49 |
|
|
Results: <% $region->render %> |
50 |
|
|
|
51 |
|
|
</&> |