summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-05-09 22:22:30 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-05-09 22:22:30 +0000
commit3969145a366d7569a20df7be64bb0f35683ebe8f (patch)
treeac7412f73d4e2fcc6e0de5e1ac8af41cd4bd6088 /core
parente2d03c63fba820687aba658dd6f344c24ac2c6b7 (diff)
Move the thumb_proportion method into Theme_View and set it by default
if the page type is album. Leave a todo if we ever set up a theme default API
Diffstat (limited to 'core')
-rw-r--r--core/controllers/albums.php10
-rw-r--r--core/libraries/Theme_View.php13
2 files changed, 13 insertions, 10 deletions
diff --git a/core/controllers/albums.php b/core/controllers/albums.php
index 50a46c17..adf59c02 100644
--- a/core/controllers/albums.php
+++ b/core/controllers/albums.php
@@ -63,7 +63,6 @@ class Albums_Controller extends Items_Controller {
$template->set_global("children", $album->viewable()->children($page_size, $offset));
$template->set_global("children_count", $children_count);
$template->set_global("parents", $album->parents());
- $template->set_global("thumb_proportion", $this->thumb_proportion());
$template->content = new View("album.html");
$album->view_count++;
@@ -210,13 +209,4 @@ class Albums_Controller extends Items_Controller {
print album::get_edit_form($album);
}
-
- /**
- * Proportion of the current thumb_size's to default
- * @return int
- */
- public function thumb_proportion() {
- return module::get_var("core", "thumb_size", 200) / 200;
- }
-
}
diff --git a/core/libraries/Theme_View.php b/core/libraries/Theme_View.php
index 6c280bf6..132ca1cf 100644
--- a/core/libraries/Theme_View.php
+++ b/core/libraries/Theme_View.php
@@ -47,6 +47,9 @@ class Theme_View_Core extends View {
$this->set_global("theme", $this);
$this->set_global("user", user::active());
$this->set_global("page_type", $page_type);
+ if ($page_type == "album") {
+ $this->set_global("thumb_proportion", $this->thumb_proportion());
+ }
$maintenance_mode = Kohana::config("core.maintenance_mode", false, false);
if ($maintenance_mode) {
@@ -54,6 +57,16 @@ class Theme_View_Core extends View {
}
}
+ /**
+ * Proportion of the current thumb_size's to default
+ * @return int
+ */
+ public function thumb_proportion() {
+ // @TODO change the 200 to a theme supplied value when and if we come up with an
+ // API to allow the theme to set defaults.
+ return module::get_var("core", "thumb_size", 200) / 200;
+ }
+
public function url($path, $absolute_url=false) {
$arg = "themes/{$this->theme_name}/$path";
return $absolute_url ? url::abs_file($arg) : url::file($arg);