1 |
use strict; |
2 |
use warnings; |
3 |
|
4 |
=head1 NAME |
5 |
|
6 |
SVNBrowser::Action::Filter |
7 |
|
8 |
=cut |
9 |
|
10 |
package SVNBrowser::Action::Filter; |
11 |
use base qw/SVNBrowser::Action Jifty::Action/; |
12 |
|
13 |
use Data::Dump qw/dump/; |
14 |
|
15 |
use Jifty::Param::Schema; |
16 |
use Jifty::Action schema { |
17 |
param author => |
18 |
label is 'Developer login', |
19 |
render as 'combobox', |
20 |
available are defer { |
21 |
my $authors = SVNBrowser::Model::RevisionCollection->new; |
22 |
$authors->column( |
23 |
column => 'author', |
24 |
function => 'distinct', |
25 |
); |
26 |
$authors->unlimit; |
27 |
[{ |
28 |
display_from => 'author', |
29 |
value_from => 'author', |
30 |
collection => $authors, |
31 |
}]; |
32 |
}; |
33 |
|
34 |
param branch => |
35 |
label is 'In branch', |
36 |
render as 'combobox', |
37 |
available are defer { |
38 |
my $branches = SVNBrowser::Model::BranchCollection->new; |
39 |
$branches->column( |
40 |
column => 'path', |
41 |
function => 'distinct', |
42 |
); |
43 |
$branches->unlimit; |
44 |
[{ |
45 |
display_from => 'path', |
46 |
value_from => 'path', |
47 |
collection => $branches, |
48 |
}]; |
49 |
}; |
50 |
|
51 |
param show_actions => |
52 |
label is 'Show file actions', |
53 |
render as 'checkbox'; |
54 |
|
55 |
param page => |
56 |
label is 'Current page'; |
57 |
|
58 |
param per_page => |
59 |
label is 'Commits on page', |
60 |
render as 'Select', |
61 |
available are qw( 10 20 30 50 100 ); |
62 |
|
63 |
param from_date => |
64 |
label is 'From date', |
65 |
render as 'Date'; |
66 |
|
67 |
param to_date => |
68 |
label is 'To date', |
69 |
render as 'Date'; |
70 |
|
71 |
param search => |
72 |
label is 'Search in messages'; |
73 |
|
74 |
}; |
75 |
|
76 |
sub sticky_on_success { 1; } |
77 |
|
78 |
=head2 take_action |
79 |
|
80 |
=cut |
81 |
|
82 |
sub take_action { |
83 |
my $self = shift; |
84 |
|
85 |
my $author = $self->argument_value('author'); |
86 |
my $msg = ''; |
87 |
$msg .= "Showing only commits for $author" if ($author); |
88 |
$msg .= ( $msg ? ' and file actions' : 'Showing file actions for each commit' ) if ( $self->argument_value('show_actions') ); |
89 |
$self->result->message($msg) if ($msg); |
90 |
|
91 |
return 1; |
92 |
} |
93 |
|
94 |
|
95 |
1; |
96 |
|