/[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 149 - (hide annotations)
Wed Jul 16 21:23:27 2008 UTC (14 years, 2 months ago) by dpavlin
File size: 1391 byte(s)
partially working label editor in ObjectDesigner -- no save yet! [0.13]
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 dpavlin 149 use Frey::Request;
18 dpavlin 113
19     sub html {
20     my ( $self, $req ) = @_;
21    
22 dpavlin 143 $self->add_css( 'static/form.css' );
23 dpavlin 113
24 dpavlin 143 my $pager;
25 dpavlin 149 my $items = 0;
26 dpavlin 143
27 dpavlin 113 while ( 1 ) {
28 dpavlin 149 $Frey::Request::current = $req;
29 dpavlin 143 my $f = { $req->params };
30     warn "<<< GOT REQUEST ",dump( $f );
31 dpavlin 149
32     $pager ||= Frey::Pager->new(
33 dpavlin 143 fey_class => $self->fey_class,
34     item_constructor => sub {
35 dpavlin 149 $items++;
36     warn "item_constructor $items";
37     return Frey::Web::Design->new( fey_class => $self->fey_class, @_ ) if $items < 4;
38     return Frey::Web::Item->new( fey_class => $self->fey_class, @_ );
39 dpavlin 143 },
40     ) if ! $pager;
41 dpavlin 113
42 dpavlin 149 $pager->pager->entries_per_page( 5 );
43 dpavlin 143 $pager->update_collection;
44 dpavlin 113
45 dpavlin 143 my $form = $pager->items_in_layout( $f );
46 dpavlin 149 # we should use first_item here to get edit fields for labels
47     $form = $pager->first_item->render_table_wrapper( $form );
48 dpavlin 113
49 dpavlin 121 my $html = $self->page(
50     body => '<h1>' . $self->fey_class . '</h1>'
51 dpavlin 149 . $pager->first_item->layout_picker # FIXME
52     . qq|Showing $items items from collection|
53     . qq|<form method="post"><input type="submit" value="Save design">$form</form>|
54 dpavlin 113 );
55    
56 dpavlin 143 warn ">>> ",length( $html ),"\n";
57 dpavlin 113
58     $req->print( $html );
59     $req->next;
60     }
61    
62     warn "NO WAY OUT!";
63     };
64    
65     1;

  ViewVC Help
Powered by ViewVC 1.1.26