/[SVNBrowser]/branches/filter-action/share/web/templates/list
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /branches/filter-action/share/web/templates/list

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (show annotations)
Sun Dec 10 00:01:33 2006 UTC (17 years, 4 months ago) by dpavlin
Original Path: trunk/share/web/templates/list
File size: 4055 byte(s)
a bunch of improvements:
- moved regex to extract branch from path to config.yml as branch_regex
- added filtering by branch (two new models Branch and RevisionBranch for that)
- added indexes where needed to speed-up filtering
1 <%args>
2 $page => undef;
3 $author => undef;
4 $show_actions => undef;
5 $per_page => undef;
6 $from_date => undef;
7 $to_date => undef;
8 $search => undef;
9 $branch => undef;
10 </%args>
11
12 <%init>
13 my $filter = Jifty->web->new_action(
14 class => 'Filter',
15 moniker => 'filer_list',
16 # arguments => {
17 # author => $author,
18 # show_actions => $show_actions,
19 # },
20 );
21
22 my $revisions = SVNBrowser::Model::RevisionCollection->new();
23
24 $author ||= $filter->argument_value('author');
25 $show_actions ||= $filter->argument_value('show_actions');
26 $page ||= $filter->argument_value('page') || 1;
27 $per_page ||= $filter->argument_value('per_page') || 10;
28 $from_date ||= $filter->argument_value('from_date');
29 $to_date ||= $filter->argument_value('to_date');
30 $search ||= $filter->argument_value('search');
31 $branch ||= $filter->argument_value('branch');
32
33 $revisions->unlimit();
34
35 $revisions->limit( column => 'author', value => $author, entry_aggregator => 'AND' ) if ($author);
36 $revisions->limit( column => 'commit_date', operator => '>=', value => $from_date, entry_aggregator => 'AND' ) if ($from_date);
37 $revisions->limit( column => 'commit_date', operator => '<=', value => $to_date, entry_aggregator => 'AND' ) if ($to_date);
38
39 $revisions->limit( column => 'message', operator => 'LIKE', value => '%' . $search . '%' ) if ($search);
40
41 if ($branch) {
42 my $b = SVNBrowser::Model::Branch->new();
43 $b->load_by_cols( path => $branch );
44
45 my $rev_branches = $revisions->join(
46 alias1 => 'main', column1 => 'revision',
47 table2 => 'revision_branches', column2 => 'revision'
48 );
49 $revisions->limit( alias => $rev_branches, column => 'branch', value => $b->id );
50 }
51
52 $revisions->order_by({ column => 'commit_date', order => 'desc' });
53 $revisions->set_page_info(
54 current_page => $page,
55 per_page => $per_page,
56 );
57
58 warn $revisions->build_select_query;
59
60 $revisions->goto_first_item;
61
62
63 my $actions = SVNBrowser::Model::ActionCollection->new();
64
65 </%init>
66
67 <&| /_elements/wrapper, title => "SVN Reporitory Browser" &>
68
69 <% Jifty->web->form->start %>
70
71 <% $filter->form_field('author', default_value => $author ) %>
72 <% $filter->form_field('branch', default_value => $branch ) %>
73 <% $filter->form_field('search', default_value => $search ) %>
74
75 <div class="inline">
76 <% $filter->form_field('from_date', default_value => $from_date ) %>
77 <% $filter->form_field('to_date', default_value => $to_date ) %>
78 <% $filter->form_field('per_page', default_value => $per_page ) %>
79 <% $filter->form_field('show_actions', default_value => $show_actions ) %>
80 </div>
81
82 <div style="clear: left">
83 <% $filter->button( label => 'Filter commits' ) %>
84
85 <%perl>
86 if (my $nr = $revisions->pager->total_entries) {
87 $m->out("$nr revisions found");
88 } else {
89 $m->out("No revisions found in repository");
90 }
91 </%perl>
92 </div>
93
94 <dl>
95 % while (my $r = $revisions->next) {
96 <dt><% Jifty->web->tangent(
97 url => '/rev/' . $r->revision,
98 label => $r->revision,
99 ) %>
100 <span class="author"><% $r->author %></span>
101 <span class="commit_date"><% $r->commit_date %></span>
102 </dt>
103 <dd>
104 <pre class="commit_message"><% $r->message %></pre>
105 % if ($show_actions) {
106 <ul class="actions">
107 % $actions->unlimit;
108 % $actions->limit( column => 'revision', value => $r->revision );
109 % while (my $a = $actions->next) {
110 % my $full_path = $a->branch . $a->rel_path ;
111 <li><tt class="action-<% $a->type %>"><% $a->type %> <% $full_path %>
112 <% Jifty->web->tangent( url => '/rev/' . $r->revision . $full_path, label => 'diff' ) %>
113 </tt></li>
114 % }
115 </ul>
116 % }
117
118 </dd>
119 % }
120 </dl>
121
122 % if ($revisions->pager->previous_page) {
123 <% $filter->button(
124 label => "&lt;&lt;",
125 escape_label => 0,
126 arguments => {
127 page => $revisions->pager->previous_page,
128 }
129 ) %>
130 % }
131
132 % if ($revisions->pager->last_page > 1) {
133 page <% $page %> of <% $revisions->pager->last_page %>
134 % }
135
136 % if ($revisions->pager->next_page) {
137 <% $filter->button(
138 label => "&gt;&gt;",
139 escape_label => 0,
140 arguments => {
141 page => $revisions->pager->next_page,
142 }
143 ) %>
144 % }
145
146 <% Jifty->web->form->end %>
147
148 </&>

  ViewVC Help
Powered by ViewVC 1.1.26