aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/View.pm
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-09-29 20:40:12 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-09-29 20:40:12 +0000
commit6ab43711ccd779eedce107001b300043e2056a0c (patch)
treeedb162ef7eaaf0aeda8a3e8fac49e4d07a637df8 /lib/Reaction/UI/View.pm
parentff460bc0b2bc0dc060f45cc8ac9e85d275fabcd0 (diff)
downloadreaction-6ab43711ccd779eedce107001b300043e2056a0c.tar.gz
reaction-6ab43711ccd779eedce107001b300043e2056a0c.zip
It is starting to look like this may actually work after all. Listview is the only one left i think, although the bar tests are still giving me trouble. TODO: add to the collection actions a truncate action. should be useful
Diffstat (limited to 'lib/Reaction/UI/View.pm')
-rw-r--r--lib/Reaction/UI/View.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Reaction/UI/View.pm b/lib/Reaction/UI/View.pm
index aa30878..987909c 100644
--- a/lib/Reaction/UI/View.pm
+++ b/lib/Reaction/UI/View.pm
@@ -59,19 +59,23 @@ class View which {
my $base = $self->blessed;
my $tail = $layout_set->widget_type;
my $class = join('::', $base, 'Widget', $tail);
- Class::MOP::load_class($class);
+ eval { Class::MOP::load_class($class) };
+ confess "Couldn't load widget '$class': $@" if $@;
return $class;
};
implements 'layout_set_for' => as {
my ($self, $vp) = @_;
+ print STDERR "Getting layoutset for VP ".(ref($vp) || "SC:".$vp)."\n";
my $lset_name = eval { $vp->layout };
confess "Couldn't call layout method on \$vp arg ${vp}: $@" if $@;
unless (length($lset_name)) {
- my $last = (split('::', ref($vp)))[-1];
- #previously: join("_", map { lc($_) } split(/(?=[A-Z])/, $last))
- $last =~ s/([a-z0-9])([A-Z])/${1}_${2}/g
- $lset_name = lc($last);
+ my $vp_class = ref($vp) || $vp;
+ my ($last) = ($vp_class =~ /.*(?:::ViewPort::)(.+?)$/);
+ my @fragments = split('::', $last);
+ $_ = join("_", split(/(?=[A-Z])/, $_)) for @fragments;
+ $lset_name = lc(join('/', @fragments));
+ print STDERR "--- $vp_class is rendered as $lset_name\n";
}
my $cache = $self->_layout_set_cache;
return $cache->{$lset_name} ||= $self->create_layout_set($lset_name);
@@ -86,7 +90,7 @@ class View which {
implements 'find_related_class' => as {
my ($self, $rel) = @_;
- my $own_class = ref($self)||$self;
+ my $own_class = ref($self) || $self;
confess View." is abstract, you must subclass it" if $own_class eq View;
foreach my $super ($own_class->meta->class_precedence_list) {
next if $super eq View;