/[Frey]/trunk/lib/Frey/ObjectDesigner.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

Annotation of /trunk/lib/Frey/ObjectDesigner.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 143 - (hide annotations)
Wed Jul 16 14:17:46 2008 UTC (14 years, 2 months ago) by dpavlin
File size: 986 byte(s)
huge refactor of code into more distinct classes

- Frey::Collection is now generally reusable from browser and designer
- Frey::Web::Item is now (bare) class instead of role
- Frey::Web::Layout now encapsulates different layouts for items
1 dpavlin 113 package Frey::ObjectDesigner;
2     use Moose;
3    
4     extends 'Frey';
5     with 'Frey::Web';
6    
7     has 'fey_class' => (
8     is => 'rw',
9     isa => 'Str',
10     required => 1,
11     );
12    
13     use Data::Dump qw/dump/;
14    
15 dpavlin 129 use Frey::Web::Design;
16 dpavlin 113 use Frey::Web::Links;
17    
18     sub html {
19     my ( $self, $req ) = @_;
20    
21 dpavlin 143 $self->add_css( 'static/form.css' );
22 dpavlin 113
23 dpavlin 143 my $pager;
24    
25 dpavlin 113 while ( 1 ) {
26 dpavlin 143 my $f = { $req->params };
27     warn "<<< GOT REQUEST ",dump( $f );
28 dpavlin 113
29 dpavlin 143 $pager = Frey::Pager->new(
30     fey_class => $self->fey_class,
31     item_constructor => sub {
32     Frey::Web::Design->new( fey_class => $self->fey_class, @_ );
33     },
34     ) if ! $pager;
35 dpavlin 113
36 dpavlin 143 $pager->update_collection;
37 dpavlin 113
38 dpavlin 143 my $form = $pager->items_in_layout( $f );
39     $form = $pager->last_item->render_table_wrapper( $form );
40 dpavlin 113
41 dpavlin 121 my $html = $self->page(
42     body => '<h1>' . $self->fey_class . '</h1>'
43 dpavlin 143 . $pager->last_item->layout_picker # FIXME
44 dpavlin 121 . qq|<form method="post">$form</form>|
45 dpavlin 113 );
46    
47 dpavlin 143 warn ">>> ",length( $html ),"\n";
48 dpavlin 113
49     $req->print( $html );
50     $req->next;
51     }
52    
53     warn "NO WAY OUT!";
54     };
55    
56     1;

  ViewVC Help
Powered by ViewVC 1.1.26