/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations)
Wed Jul 16 23:21:19 2008 UTC (14 years, 2 months ago) by dpavlin
File size: 1392 byte(s)
label editor which save to yaml on disk and use it
1 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 use Frey::Web::Design;
16 use Frey::Web::Links;
17 use Frey::Request;
18
19 sub html {
20 my ( $self, $req ) = @_;
21
22 $self->add_css( 'static/form.css' );
23
24 my $pager;
25 my $items = 0;
26
27 while ( 1 ) {
28 $Frey::Request::current = $req;
29 my $f = { $req->params };
30 warn "<<< GOT REQUEST ",dump( $f );
31
32 $pager ||= Frey::Pager->new(
33 fey_class => $self->fey_class,
34 item_constructor => sub {
35 $items++;
36 warn "item_constructor $items";
37 return Frey::Web::Design->new( fey_class => $self->fey_class, @_ ) if $items == 1;
38 return Frey::Web::Item->new( fey_class => $self->fey_class, @_ );
39 },
40 ) if ! $pager;
41
42 $pager->pager->entries_per_page( 5 );
43 $pager->update_collection;
44
45 my $form = $pager->items_in_layout( $f );
46 # we should use first_item here to get edit fields for labels
47 $form = $pager->first_item->render_table_wrapper( $form );
48
49 my $html = $self->page(
50 body => '<h1>' . $self->fey_class . '</h1>'
51 . $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 );
55
56 warn ">>> ",length( $html ),"\n";
57
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