diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-19 19:24:46 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-19 19:24:46 -0800 |
commit | 512910962d62a2011d7770da1b6e68bd6bbad983 (patch) | |
tree | 1e263cf6df55642d9842a2d09cb83563bc8e0831 | |
parent | c3ed64fc6c0c1c9001d32191b0f1a5c21ec4b7c5 (diff) |
Change "dirname" to "name" in the edit album form. I'd rather have
consistency between field names than deal with underlying issues with
Forge bitching about the "name" property.
-rw-r--r-- | modules/gallery/controllers/albums.php | 5 | ||||
-rw-r--r-- | modules/gallery/helpers/album.php | 4 | ||||
-rw-r--r-- | modules/gallery/tests/Albums_Controller_Test.php | 6 |
3 files changed, 6 insertions, 9 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 7658a913..a378f3ee 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -141,15 +141,12 @@ class Albums_Controller extends Items_Controller { $album->description = $form->edit_item->description->value; $album->sort_column = $form->edit_item->sort_order->column->value; $album->sort_order = $form->edit_item->sort_order->direction->value; - $album->name = $form->edit_item->dirname->value; + $album->name = $form->edit_item->inputs["name"]->value; $album->slug = $form->edit_item->slug->value; $album->validate(); } catch (ORM_Validation_Exception $e) { // Translate ORM validation errors into form error messages foreach ($e->validation->errors() as $key => $error) { - if ($key == "name") { - $key = "dirname"; - } $form->edit_item->inputs[$key]->add_error($error, 1); } $valid = false; diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index e99770e9..55282252 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -52,7 +52,7 @@ class album_Core { $group->input("title")->label(t("Title"))->value($parent->title); $group->textarea("description")->label(t("Description"))->value($parent->description); if ($parent->id != 1) { - $group->input("dirname")->label(t("Directory Name"))->value($parent->name) + $group->input("name")->label(t("Directory Name"))->value($parent->name) ->rules("required") ->error_messages( "conflict", t("There is already a movie, photo or album with this name")) @@ -65,7 +65,7 @@ class album_Core { "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); } else { - $group->hidden("dirname")->value($parent->name); + $group->hidden("name")->value($parent->name); $group->hidden("slug")->value($parent->slug); } diff --git a/modules/gallery/tests/Albums_Controller_Test.php b/modules/gallery/tests/Albums_Controller_Test.php index 8ba2c7bc..26dc2571 100644 --- a/modules/gallery/tests/Albums_Controller_Test.php +++ b/modules/gallery/tests/Albums_Controller_Test.php @@ -31,9 +31,9 @@ class Albums_Controller_Test extends Unit_Test_Case { $album = test::random_album(); // Randomize to avoid conflicts. - $new_dirname = "new_name_" . rand(); + $new_name = "new_name_" . rand(); - $_POST["dirname"] = $new_dirname; + $_POST["name"] = $new_name; $_POST["title"] = "new title"; $_POST["description"] = "new description"; $_POST["column"] = "weight"; @@ -49,7 +49,7 @@ class Albums_Controller_Test extends Unit_Test_Case { ob_end_clean(); $this->assert_equal(json_encode(array("result" => "success")), $results); - $this->assert_equal($new_dirname, $album->name); + $this->assert_equal($new_name, $album->name); $this->assert_equal("new title", $album->title); $this->assert_equal("new description", $album->description); } |