mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-31 20:20:36 -04:00
Add support for a per-item "slug" which will be the user-visible url
component for that given item. Album hierarchies are represented by nested slugs. By default, we convert the filename to a slug when you create an album, photo or movie.
This commit is contained in:
@@ -69,7 +69,7 @@ class Photo_Helper_Test extends Unit_Test_Case {
|
||||
$rand = rand();
|
||||
$root = ORM::factory("item", 1);
|
||||
$photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "$rand.jpg", $rand, $rand);
|
||||
$this->assert_equal("http://./var/thumbs/{$rand}.jpg?m={$photo->updated}", $photo->thumb_url());
|
||||
$this->assert_equal("http://./var/thumbs/{$rand}?m={$photo->updated}", $photo->thumb_url());
|
||||
}
|
||||
|
||||
public function resize_url_test() {
|
||||
@@ -78,7 +78,17 @@ class Photo_Helper_Test extends Unit_Test_Case {
|
||||
$album = album::create($root, $rand, $rand, $rand);
|
||||
$photo = photo::create($album, MODPATH . "gallery/tests/test.jpg", "$rand.jpg", $rand, $rand);
|
||||
|
||||
$this->assert_equal("http://./var/resizes/{$rand}/{$rand}.jpg", $photo->resize_url());
|
||||
$this->assert_equal("http://./var/resizes/{$rand}/{$rand}", $photo->resize_url());
|
||||
}
|
||||
|
||||
public function create_photo_creates_reasonable_slug_test() {
|
||||
$rand = rand();
|
||||
$root = ORM::factory("item", 1);
|
||||
$album = album::create($root, $rand, $rand, $rand);
|
||||
$photo = photo::create(
|
||||
$album, MODPATH . "gallery/tests/test.jpg", "This (is) my file%name.jpg", $rand, $rand);
|
||||
|
||||
$this->assert_equal("This-is-my-file-name", $photo->slug);
|
||||
}
|
||||
|
||||
public function create_photo_shouldnt_allow_names_with_slash_test() {
|
||||
|
||||
Reference in New Issue
Block a user