Fix the default URL for an Asset. It should be based on the parent, if available, and the menutitle.

This commit is contained in:
Colin Kuskie 2010-06-04 13:27:40 -07:00
parent 193223c678
commit dd716fa796
2 changed files with 15 additions and 2 deletions

View file

@ -80,7 +80,7 @@ property url => (
builder => '_default_url',
);
sub _default_url {
return $_[0]->assetId;
return $_[0]->fixUrl;
}
around url => sub {
@ -701,7 +701,9 @@ sub fixUrl {
# build a URL from the parent
unless ($url) {
$url = $self->getParent->url;
if (my $parent = $self->getParent) {
$url = $parent->url;
}
$url =~ s/(.*)\..*/$1/;
$url .= '/'.$self->menuTitle;
}