rework skin path handling
[catagits/Reaction.git] / lib / Reaction / UI / View.pm
index 1b492b8..358fcf1 100644 (file)
@@ -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,30 +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;
-
-      foreach my $class (@haystack) {
-        #if the class is already loaded skip the call to Installed etc.
-        return $class if Class::MOP::is_class_loaded($class);
-        next unless Class::Inspector->installed($class);
-
-        my $ok = eval { Class::MOP::load_class($class) };
-        confess("Failed to load widget '${class}': $@") if $@;
-        return $class;
-      }
-      confess "Couldn't locate widget '${widget_type}' for layout "
-        ."'${\$layout_set->name}': tried: ".join(", ", @haystack);
-    };
-  };
-
   implements 'layout_set_for' => as {
     my ($self, $vp) = @_;
     #print STDERR "Getting layoutset for VP ".(ref($vp) || "SC:".$vp)."\n";