/[Frey]/trunk/lib/Frey/DBIC/Designer.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/DBIC/Designer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1025 by dpavlin, Mon Jan 26 23:37:34 2009 UTC revision 1026 by dpavlin, Wed Jan 28 19:54:40 2009 UTC
# Line 5  extends 'Frey'; Line 5  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web';
6  with 'Frey::Config';  with 'Frey::Config';
7  with 'Frey::Storage';  with 'Frey::Storage';
8    with 'Frey::jQuery';
9    
10  has dbic_class => (  has dbic_class => (
11          is => 'rw',          is => 'rw',
# Line 80  sub as_markup { Line 81  sub as_markup {
81                  @columns = @$c if $c;                  @columns = @$c if $c;
82          }          }
83          warn "# load $path columns ", $self->dump( @columns );          warn "# load $path columns ", $self->dump( @columns );
84          @columns = $rs->first->columns unless @columns;          my @all_columns = $rs->first->columns;
85            @columns = @all_columns unless @columns;
86    
87          @columns = grep { $_ ne $self->remove_column } @columns if $self->remove_column;          @columns = grep { $_ ne $self->remove_column } @columns if $self->remove_column;
88    
# Line 103  sub as_markup { Line 105  sub as_markup {
105                  $rows .= qq|<tr>$row</tr>\n|;                  $rows .= qq|<tr>$row</tr>\n|;
106          }          }
107    
108            $self->add_css(qq|
109                    #column-editor {
110                            border: 1px solid #888;
111                            background: #ffc;
112                            position: absolute;
113                            top: 1em;
114                            right: 1em;
115                    }
116            |);
117    
118            my @hidden_cols;
119            {
120                    my $col;
121                    $col->{$_}++ foreach @columns;
122                    @hidden_cols = grep { ! $col->{$_} } @all_columns;
123            }
124    
125            my $column_editor = qq|
126                    <table id="column-editor">
127                    <tr class="nodrag nodrop"><th>Visible</th></tr>
128            | . join("\n", map { qq|
129                    <tr id="$_"><td>$_</td></tr>
130            | } @columns )
131            . qq|
132                    <tr class="nodrag nodrop"><th>Hidden</th></tr>
133            | . join("\n", map { qq|
134                    <tr id="$_"><td>$_</td></tr>
135            | } @hidden_cols )
136            . qq|
137                    </table>
138            |
139            ;
140    
141            $self->add_js( 'static/Frey/jQuery/jquery.tablednd_0_5.js' );
142            $self->add_js(q|
143                    $(document).ready(function() {
144                            // Initialise the table
145                            $("#column-editor").tableDnD();
146                    });
147            |);
148    
149          my $total = $rs->pager->total_entries;          my $total = $rs->pager->total_entries;
150    
151          sub form {          sub form {
# Line 119  sub as_markup { Line 162  sub as_markup {
162    
163          my $html = qq|          my $html = qq|
164                  Rows: <b>$total</b>                  Rows: <b>$total</b>
165                    $column_editor
166                  <table>                  <table>
167                  $header                  $header
168                  $rows                  $rows

Legend:
Removed from v.1025  
changed lines
  Added in v.1026

  ViewVC Help
Powered by ViewVC 1.1.26