added more vars to GalleryAlbum and GalleryFile. fixed some tests
This commit is contained in:
parent
5b16fcca51
commit
4ebed16c69
10 changed files with 148 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
|||
- fixed: the export system was largely incomprehensible. rewritten.
|
||||
- the new export system now needs Path::Class
|
||||
- add: GalleryAlbum now shows link to add Photo
|
||||
- add: More vars to GalleryAlbum and GalleryFile
|
||||
|
||||
7.5.10
|
||||
- fix: Syntax error in GetCsMail
|
||||
|
|
|
|||
|
|
@ -389,6 +389,17 @@ sub getTemplateVars {
|
|||
$var->{ $key } = $galleryVar->{ $key };
|
||||
}
|
||||
|
||||
# More things from Gallery, but with different names
|
||||
for my $key ( qw{ title menuTitle url } ) {
|
||||
$var->{ "gallery_" . $key } = $galleryVar->{ $key };
|
||||
}
|
||||
|
||||
# Add some things from Album
|
||||
my $albumVar = $self->getParent->getTemplateVars;
|
||||
for my $key ( qw{ title menuTitle url thumbnailUrl } ) {
|
||||
$var->{ "album_" . $key } = $albumVar->{ $key };
|
||||
}
|
||||
|
||||
# Add the search form
|
||||
$self->getGallery->appendTemplateVarsSearchForm( $var );
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ sub updateExifDataFromFile {
|
|||
}
|
||||
|
||||
# Remove other, pointless keys
|
||||
for my $key ( qw( directory ) ) {
|
||||
for my $key ( qw( Directory ) ) {
|
||||
delete $info->{ $key };
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -408,6 +408,12 @@ sub getTemplateVars {
|
|||
$var->{ url_listFilesForCurrentUser } = $gallery->getUrl('func=listFilesForUser');
|
||||
$var->{ url_search } = $gallery->getUrl('func=search');
|
||||
|
||||
# Add some specific vars from the Gallery
|
||||
my $galleryVar = $gallery->getTemplateVars;
|
||||
for my $key ( qw{ title menuTitle url } ) {
|
||||
$var->{ "gallery_" . $key } = $galleryVar->{ $key };
|
||||
}
|
||||
|
||||
# Friendly URLs
|
||||
$var->{ url } = $self->getUrl;
|
||||
$var->{ url_addArchive } = $self->getUrl('func=addArchive');
|
||||
|
|
|
|||
|
|
@ -84,6 +84,18 @@ our $HELP = {
|
|||
name => 'thumbnailUrl',
|
||||
description => 'helpvar thumbnailUrl',
|
||||
},
|
||||
{
|
||||
name => 'gallery_title',
|
||||
description => 'helpvar gallery_title',
|
||||
},
|
||||
{
|
||||
name => 'gallery_menuTitle',
|
||||
description => 'helpvar gallery_menuTitle',
|
||||
},
|
||||
{
|
||||
name => 'gallery_url',
|
||||
description => 'helpvar gallery_url',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,34 @@ our $HELP = {
|
|||
name => 'url_slideshow',
|
||||
description => 'helpvar url_slideshow',
|
||||
},
|
||||
{
|
||||
name => 'gallery_title',
|
||||
description => 'helpvar gallery_title',
|
||||
},
|
||||
{
|
||||
name => 'gallery_menuTitle',
|
||||
description => 'helpvar gallery_menuTitle',
|
||||
},
|
||||
{
|
||||
name => 'gallery_url',
|
||||
description => 'helpvar gallery_url',
|
||||
},
|
||||
{
|
||||
name => 'album_title',
|
||||
description => 'helpvar album_title',
|
||||
},
|
||||
{
|
||||
name => 'album_menuTitle',
|
||||
description => 'helpvar album_menuTitle',
|
||||
},
|
||||
{
|
||||
name => 'album_thumbnailUrl',
|
||||
description => 'helpvar album_thumbnailUrl',
|
||||
},
|
||||
{
|
||||
name => 'album_url',
|
||||
description => 'helpvar album_url',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -465,6 +465,25 @@ our $I18N = {
|
|||
lastUpdated => 0,
|
||||
context => 'Title for the list of actions a user can take after saving a Gallery Album',
|
||||
},
|
||||
|
||||
'helpvar gallery_title' => {
|
||||
message => q{The title of the Gallery containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar gallery_menuTitle' => {
|
||||
message => q{The menu title of the Gallery containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar gallery_url' => {
|
||||
message => q{The URL of the Gallery containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -589,6 +589,48 @@ our $I18N = {
|
|||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar gallery_title' => {
|
||||
message => q{The title of the Gallery containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar gallery_menuTitle' => {
|
||||
message => q{The menu title of the Gallery containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar gallery_url' => {
|
||||
message => q{The URL of the Gallery containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar album_title' => {
|
||||
message => q{The title of the album containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar album_menuTitle' => {
|
||||
message => q{The menu title of the album containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar album_url' => {
|
||||
message => q{The URL of the album containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
'helpvar album_thumbnailUrl' => {
|
||||
message => q{The URL for the thumbnail of the album containing this File},
|
||||
lastUpdated => 0,
|
||||
context => q{Description of template variable},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ for my $key ( keys %$exif ) {
|
|||
delete $exif->{$key};
|
||||
}
|
||||
}
|
||||
# Also remove things that Photo explicitly removed
|
||||
for my $key ( qw{ Directory } ) {
|
||||
delete $exif->{ $key };
|
||||
}
|
||||
|
||||
$photo->setFile( WebGUI::Test->getTestCollateralPath("lamp.jpg") );
|
||||
|
||||
|
|
|
|||
|
|
@ -88,18 +88,41 @@ my $testTemplateVars = {
|
|||
numberOfComments => scalar @{ $photo->getCommentIds },
|
||||
resolutions_loop => ignore(), # Tested elsewhere
|
||||
exifLoop => ignore(), # Tested elsewhere
|
||||
|
||||
# Gallery stuff
|
||||
url_search => $gallery->getUrl('func=search'),
|
||||
url_listFilesForCurrentUser => $gallery->getUrl('func=listFilesForUser'),
|
||||
gallery_title => $gallery->get('title'),
|
||||
gallery_menuTitle => $gallery->get('menuTitle'),
|
||||
gallery_url => $gallery->getUrl,
|
||||
|
||||
# Album stuff
|
||||
album_title => $album->get('title'),
|
||||
album_menuTitle => $album->get('menuTitle'),
|
||||
album_url => $album->getUrl,
|
||||
album_thumbnailUrl => $album->getThumbnailUrl,
|
||||
};
|
||||
# Ignore all EXIF tags
|
||||
|
||||
# Ignore all EXIF tags, they're tested in exif.t
|
||||
for my $tag ( keys %{ $photo->getExifData } ) {
|
||||
$testTemplateVars->{ 'exif_' . $tag } = ignore();
|
||||
}
|
||||
# Add search vars
|
||||
$gallery->appendTemplateVarsSearchForm( $testTemplateVars );
|
||||
|
||||
# Fix vars that are time-sensitive
|
||||
$testTemplateVars->{ searchForm_creationDate_before }
|
||||
= all(
|
||||
re( qr/<input/ ),
|
||||
re( qr/name="creationDate_before"/ ),
|
||||
);
|
||||
|
||||
$testTemplateVars->{ searchForm_creationDate_after }
|
||||
= all(
|
||||
re( qr/<input/ ),
|
||||
re( qr/name="creationDate_after"/ ),
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
$photo->getTemplateVars,
|
||||
$testTemplateVars,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue