Merge branch 'eval-code'
[MojoFacets.git] / templates / actions / changes.html.ep
1 % layout 'ui';
2
3
4 % my $dump = param('dump');
5 % my $apply_on_path = param('apply_on_path');
6
7 <form method=post>
8 <input type=submit value="Apply"> on
9 <select name=apply_on_path>
10 % foreach my $p ( @$loaded ) {
11 <option<%= $p eq $apply_on_path ? ' selected' : '' %>><%= $p %></option>
12 % }
13 </select>
14
15 <span class=count><%= $#{ $changes } + 1 %></span>
16
17 <label><input type=checkbox name=dump <%= $dump ? 'checked' : '' %>>dump</label>
18
19 % if ( $apply_on_path ) {
20 <ul id=status>
21 %  foreach my $status ( keys %$stats ) {
22 <li><label>
23 <input name=show type=checkbox value="<%= $status %>" checked>
24 <%= $status %>
25 <span class=count><%= $stats->{$status} %></span>
26 </label>
27 %  }
28 </ul>
29
30 %  if ( ! param('commit') ) {
31 <input type=submit name=commit value="Commit changes">
32 %  } else {
33 <b>
34 Changes commited to <a href="<%= url_for( controller => 'data', action => 'load' )->query( path => $apply_on_path ) %>"><%= $apply_on_path %></a>
35 </b>
36 %  }
37
38 % }
39
40 </form>
41
42 <table>
43 <tr><th></th><th>old</th><th>new</th></tr>
44
45 % foreach my $e ( @$changes ) {
46 <tr class="change <%= $e->{_status} || 'unknown' %>">
47 <td>
48 <%= $e->{time} %>
49 <tt><%= $e->{column} %></tt>
50 %  if ( my $status = $e->{_status} ) {
51 %    my ( $pk, $id ) = %{ $e->{unique} };
52 <a href="<%= url_for( controller => 'data', action => 'filter' )->query( filter_name => $pk, filter_vals => $id ) %>"><%= $id %></a>
53 <%= $status %>
54 %  } else {
55 <a href="<%= url_for( action => 'remove' )->query( time => $e->{time} ) %>">remove</a>
56 %  }
57
58 </td><td><%== defined $e->{old} && join('<span class=d>&para;</span>', @{$e->{old}}) %>
59 </td><td><%== defined $e->{new} && join('<span class=d>&para;</span>', @{$e->{new}}) %>
60
61 %  if ( $dump ) {
62 </td><td><pre class=debug><%= dumper $e %></pre>
63 %  }
64 </tr>
65 % }
66
67 </table>
68
69 <pre class=debug>
70 <%= dumper( $stats ) %>
71 </pre>
72
73 <script type="text/javascript">
74
75 $(document).ready( function(){
76         console.debug('ready');
77         $('ul#status > li input[type=checkbox]').click( function(){
78                 var toggle = this.value;
79                 console.debug('click',this,toggle);
80                 $('tr.'+toggle).toggleClass('hidden');
81         });
82 });
83
84 </script>