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

Annotation of /trunk/lib/Frey/Web/Design.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 143 - (hide annotations)
Wed Jul 16 14:17:46 2008 UTC (15 years, 9 months ago) by dpavlin
File size: 889 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 129 package Frey::Web::Design;
2     use Moose;
3 dpavlin 143 extends 'Frey::Web::Item';
4 dpavlin 129 with 'Frey::Web::Button';
5    
6     =head1 NAME
7    
8     Frey::Web::Design - field designer for L<Frey::Web::Item>
9    
10     =cut
11    
12     use Data::Dump qw/dump/;
13    
14 dpavlin 143 has 'labels' => (
15     is => 'rw',
16     isa => 'HashRef[Str]',
17     default => sub { {} },
18     );
19    
20     has 'label_count' => (
21     is => 'rw',
22     isa => 'Int',
23     default => 0,
24     );
25    
26     around 'field_label' => sub {
27     my ($next, $self, $name) = @_;
28     my $label = $self->$next($name);
29    
30     $self->labels->{ $name } = $label;
31     $self->label_count( $self->label_count + 1 );
32    
33     $label = '[&larr;]' . $label . '[&rarr;]';
34     return $label;
35     };
36    
37 dpavlin 129 before 'main' => sub {
38     my $self = shift;
39    
40     $self->add_button( 'Finish design' => sub {
41     my $f = shift;
42     my $hash = $self->set_from_hash($f);
43     warn "## Add hash ", $self->uuid, " => ",dump( $hash, $f );
44    
45     $self->render_as( 'view' );
46     $self->remove_button( 'Finish design' );
47     });
48    
49     };
50    
51     1;

  ViewVC Help
Powered by ViewVC 1.1.26