|
<%init> |
|
|
|
|
|
my $results = Jifty::Web::PageRegion->new( |
|
|
name => 'results', |
|
|
); |
|
|
|
|
|
if ( my $user_id = Jifty->web->current_user->id ) { |
|
|
|
|
|
warn "adding subscription for user $user_id on this page\n"; |
|
|
|
|
|
Jifty->subs->add( |
|
|
window_id => "results $user_id", |
|
|
class => 'Result', |
|
|
queries => [{ user_id => $user_id }], |
|
|
mode => 'Top', |
|
|
region => 'results', |
|
|
render_with => '/fragments/event/results', |
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
my $search = Jifty->web->new_action( |
|
|
class => 'Search', |
|
|
moniker => 'search', |
|
|
arguments => { %ARGS }, |
|
|
sticky_on_success => 1, |
|
|
); |
|
|
|
|
|
my $q = $search->argument_value('content_contains'); |
|
|
|
|
|
my $feeds = Jifty::Web::PageRegion->new( |
|
|
name => 'feeds', |
|
|
path => '/fragments/feeds', |
|
|
force_arguments => { |
|
|
q => $q, |
|
|
feed => undef, |
|
|
}, |
|
|
); |
|
|
|
|
|
use Data::Dump qw/dump/; |
|
|
|
|
|
</%init> |
|
|
|
|
1 |
<&| '/_elements/wrapper', title => 'Grep - powerful RSS searcher' &> |
<&| '/_elements/wrapper', title => 'Grep - powerful RSS searcher' &> |
2 |
|
|
3 |
<div class="right"> |
This application needs to know which user is using it. So, you need ether to |
4 |
% if ( $q ) { |
<% Jifty->web->link( label => 'signup for your account', url => '/signup' ) %> |
5 |
<% $feeds->render %> |
or |
6 |
<hr/> |
<% Jifty->web->link( label => 'login with existing account', url => '/login' ) %> |
7 |
% } |
to use it. |
|
</div> |
|
|
|
|
|
<div class="left"> |
|
|
<& '/fragments/bookmarklet' &> |
|
|
|
|
|
<% Jifty->web->form->start %> |
|
|
|
|
|
<% $search->form_field('content_contains', label => 'Search for', q => $q ) %> |
|
|
|
|
|
<% $search->button( label => 'Grep' ) %> |
|
|
|
|
|
<% Jifty->web->form->end %> |
|
|
|
|
|
<% $results->render %> |
|
|
|
|
|
% if ( $q ) { |
|
|
<& '/fragments/results', item_fragment => 'long', q => $q &> |
|
|
% } |
|
|
|
|
|
</div> |
|
8 |
|
|
9 |
</&> |
</&> |