X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FReaction%2FUI%2FView.pm;h=358fcf12251bc238805c72594a186549c6034182;hb=d9a3266fb7015bb1211171c1c113df3b1b7cd700;hp=7a1ebc5040ef97a47341c7939b498ca8a131c3c5;hpb=8a293e2eee23938229a7dbfb617faee579914dfc;p=catagits%2FReaction.git diff --git a/lib/Reaction/UI/View.pm b/lib/Reaction/UI/View.pm index 7a1ebc5..358fcf1 100644 --- a/lib/Reaction/UI/View.pm +++ b/lib/Reaction/UI/View.pm @@ -10,7 +10,6 @@ use aliased 'Path::Class::Dir'; class View which { - has '_widget_class_cache' => (is => 'ro', default => sub { {} }); has '_widget_cache' => (is => 'ro', default => sub { {} }); has '_layout_set_cache' => (is => 'ro', default => sub { {} }); @@ -42,8 +41,8 @@ class View which { my ($self) = @_; Skin->new( name => $self->skin_name, view => $self, - skin_base_path => # returns a File, not a Dir. Thanks, Catalyst. - Dir->new($self->app->path_to('share', 'skin', $self->skin_name)), + # path_to returns a File, not a Dir. Thanks, Catalyst. + skin_base_dir => Dir->new($self->app->path_to('share', 'skin')), ); }; @@ -77,38 +76,6 @@ class View which { ); }; - implements 'widget_class_for' => as { - my ($self, $layout_set) = @_; - my $base = $self->blessed; - my $widget_type = $layout_set->widget_type; - my $app_name = ref $self->app || $self->app; - return $self->_widget_class_cache->{$widget_type} ||= do { - - my @search_path = ($base, $app_name, 'Reaction::UI'); - my @haystack = map { join('::', $_, 'Widget', $widget_type) } - @search_path; - my $found; - foreach my $class (@haystack) { - #here we should throw if exits and error instead of eating the error - #only next when !exists - eval { Class::MOP::load_class($class) }; - #$@ ? next : return $class; - #warn "Loaded ${class}" unless $@; - #warn "Boom loading ${class}: $@" if $@; - unless ($@) { - $found = $class; - last; - } - } - unless ($found) { - confess "Couldn't load widget '${widget_type}'" - ." for layout '${\$layout_set->name}':" - ." tried: ".join(", ", @haystack); - } - $found; - }; - }; - implements 'layout_set_for' => as { my ($self, $vp) = @_; #print STDERR "Getting layoutset for VP ".(ref($vp) || "SC:".$vp)."\n"; @@ -126,6 +93,10 @@ class View which { return $cache->{$lset_name} ||= $self->create_layout_set($lset_name); }; + implements 'layout_set_file_extension' => as { + confess View." is abstract, you must subclass it"; + }; + implements 'find_related_class' => as { my ($self, $rel) = @_; my $own_class = ref($self) || $self;