/[Frey]/trunk/lib/Frey/ORM/Design.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/ORM/Design.pm

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

trunk/lib/Frey/Web/Design.pm revision 150 by dpavlin, Wed Jul 16 21:51:23 2008 UTC trunk/lib/Frey/ORM/Design.pm revision 969 by dpavlin, Fri Jan 9 16:02:33 2009 UTC
# Line 1  Line 1 
1  package Frey::Web::Design;  package Frey::ORM::Design;
2  use Moose;  use Moose;
3  extends 'Frey::Web::Item';  extends 'Frey::ORM::Item';
4  with 'Frey::Web::Button';  with 'Frey::ORM::Button';
5    with 'Frey::Storage';
6    
7  =head1 NAME  =head1 NAME
8    
9  Frey::Web::Design - field designer for L<Frey::Web::Item>  Frey::ORM::Design - field designer for L<Frey::ORM::Item>
10    
11  =cut  =cut
12    
# Line 14  use Data::Dump qw/dump/; Line 15  use Data::Dump qw/dump/;
15  has 'labels' => (  has 'labels' => (
16          is => 'rw',          is => 'rw',
17          isa => 'HashRef[Str]',          isa => 'HashRef[Str]',
18          default => sub { {} },          lazy_build => 1,
19  );  );
20    
21    sub _build_labels {
22            my $self = shift;
23            $self->load( 'var/design/' . $self->fey_class . '-labels' ) || {}
24    };
25    
26  has 'label_order' => (  has 'label_order' => (
27          is => 'rw',          is => 'rw',
28          isa => 'HashRef[Int]',          isa => 'HashRef[Int]',
# Line 25  has 'label_order' => ( Line 31  has 'label_order' => (
31    
32  has 'label_editable' => (  has 'label_editable' => (
33          is => 'rw',          is => 'rw',
34          isa => 'HashRef[Frey::Web::Editable]',          isa => 'HashRef[Frey::ORM::Editable]',
35          default => sub { {} },          default => sub { {} },
36  );  );
37    
# Line 35  has 'label_count' => ( Line 41  has 'label_count' => (
41          default => 0,          default => 0,
42  );  );
43    
44  use Frey::Web::Editable;  use Frey::ORM::Editable;
45    
46  around 'field_label' => sub {  around 'field_label' => sub {
47          my ($next, $self, $name) = @_;          my ($next, $self, $name) = @_;
# Line 49  around 'field_label' => sub { Line 55  around 'field_label' => sub {
55                  warn "field_label $count $name -> $label\n";                  warn "field_label $count $name -> $label\n";
56                  $self->label_order->{ $name } = $count++;                  $self->label_order->{ $name } = $count++;
57                  $self->label_count( $count );                  $self->label_count( $count );
58                  $self->label_editable->{ $name } = Frey::Web::Editable->new(                  $self->label_editable->{ $name } = Frey::ORM::Editable->new(
59                          name => $name,                          name => $name,
60                          value => $label,                          value => $label,
61                          render_as => 'edit',                          render_as => 'edit',
# Line 59  around 'field_label' => sub { Line 65  around 'field_label' => sub {
65                                  # XXX we really need this since we are in continutation and have old value!                                  # XXX we really need this since we are in continutation and have old value!
66                                  $caller->value( $val );                                  $caller->value( $val );
67                                  warn "## saved $val new labels = ",dump( $self->labels, $caller->value );                                  warn "## saved $val new labels = ",dump( $self->labels, $caller->value );
68                                    $self->store( 'var/design/' . $self->fey_class . '-labels', $self->labels );
69                          }                          }
70                  );                  );
71          }          }

Legend:
Removed from v.150  
changed lines
  Added in v.969

  ViewVC Help
Powered by ViewVC 1.1.26