1 |
<%init> |
<%init> |
2 |
|
|
3 |
my $region = Jifty::Web::PageRegion->new( |
my $results = Jifty::Web::PageRegion->new( |
4 |
name => 'results', |
name => 'results', |
5 |
); |
); |
6 |
|
|
7 |
Jifty->subs->add( |
Jifty->subs->add( |
8 |
class => 'Result', |
class => 'Result', |
9 |
mode => 'Bottom', |
mode => 'Top', |
10 |
region => 'results', |
region => 'results', |
11 |
render_with => '/fragments/result', |
render_with => '/fragments/event/results', |
12 |
); |
); |
13 |
|
|
14 |
my $fetch = Jifty->web->new_action( |
my $search = Jifty->web->new_action( |
15 |
class => 'Fetch', |
class => 'Search', |
16 |
moniker => 'fetch', |
moniker => 'search', |
17 |
arguments => { %ARGS }, |
arguments => { %ARGS }, |
18 |
sticky_on_success => 1, |
sticky_on_success => 1, |
19 |
); |
); |
20 |
|
|
21 |
|
my $q = $search->argument_value('content_contains'); |
22 |
|
|
23 |
|
my $feeds = Jifty::Web::PageRegion->new( |
24 |
|
name => 'feeds', |
25 |
|
path => '/fragments/feeds', |
26 |
|
force_arguments => { |
27 |
|
q => $q, |
28 |
|
run => 0, |
29 |
|
}, |
30 |
|
); |
31 |
|
|
32 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
33 |
|
|
34 |
</%init> |
</%init> |
35 |
|
|
36 |
<&| /_elements/wrapper, title => 'Grep - powerful RSS searcher' &> |
<&| '/_elements/wrapper', title => 'Grep - powerful RSS searcher' &> |
37 |
|
|
38 |
<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> |
<div class="right"> |
39 |
|
% if ( $q ) { |
40 |
|
<% $feeds->render %> |
41 |
|
<hr/> |
42 |
|
% } |
43 |
|
</div> |
44 |
|
|
45 |
|
<div class="left"> |
46 |
|
<& '/fragments/bookmarklet' &> |
47 |
|
|
48 |
<% Jifty->web->form->start %> |
<% Jifty->web->form->start %> |
49 |
|
|
50 |
<% $fetch->form_field('q') %> |
<% $search->form_field('content_contains', label => 'Search for', q => $q ) %> |
|
<% $fetch->form_field('feed') %> |
|
51 |
|
|
52 |
<% $fetch->button( label => 'Grep' ) %> |
<% $search->button( label => 'Grep' ) %> |
53 |
|
|
54 |
<% Jifty->web->form->end %> |
<% Jifty->web->form->end %> |
55 |
|
|
56 |
% if ( my $result = Jifty->web->response->result('fetch') ) { |
<% $results->render %> |
|
% if ( my $items = $result->content('items') ) { |
|
|
% foreach my $i ( @$items ) { |
|
|
|
|
|
<& /fragments/result, item => $i &> |
|
57 |
|
|
58 |
% } |
% if ( $q ) { |
59 |
% } |
<& '/fragments/results', item_fragment => 'long', q => $q &> |
60 |
% } |
% } |
61 |
|
|
62 |
Results: <% $region->render %> |
</div> |
63 |
|
|
64 |
</&> |
</&> |