summaryrefslogtreecommitdiff
path: root/modules/gallery/views
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-10-27 13:46:24 -0700
committerBharat Mediratta <bharat@menalto.com>2009-10-27 13:48:41 -0700
commit76c0c7f3a1246319242e8fff7649c1450da0f98e (patch)
treeb34a559996a5bed898bff3e6006fe377c58889a4 /modules/gallery/views
parentab1d21eb34cfca46383ef10b66c49616beb6af15 (diff)
Change our menu building blocks to use PHP templates so that themes
can override them and define their own menu formats. I worry a little bit that this approach may be too heavy since we're now doing a lot more template includes than we were before. Also, I had to change the Menu API to stop using __toString() because you can't throw exceptions from __toString() which would make it an unhappy experience for developers.
Diffstat (limited to 'modules/gallery/views')
-rw-r--r--modules/gallery/views/menu.html.php23
-rw-r--r--modules/gallery/views/menu_ajax_link.html.php10
-rw-r--r--modules/gallery/views/menu_dialog.html.php9
-rw-r--r--modules/gallery/views/menu_link.html.php9
4 files changed, 51 insertions, 0 deletions
diff --git a/modules/gallery/views/menu.html.php b/modules/gallery/views/menu.html.php
new file mode 100644
index 00000000..0731c7b6
--- /dev/null
+++ b/modules/gallery/views/menu.html.php
@@ -0,0 +1,23 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<? if ($menu->is_root): ?>
+
+<ul class="<?= $menu->css_class ?>">
+ <? foreach ($this->elements as $element): ?>
+ <?= $element->render() ?>
+ <? endforeach ?>
+</ul>
+
+<? else: ?>
+
+<li title="<?= $menu->label->for_html_attr() ?>">
+ <a href="#">
+ <?= $menu->label->for_html() ?>
+ </a>
+ <ul>
+ <? foreach ($this->elements as $element): ?>
+ <?= $element->render() ?>
+ <? endforeach ?>
+ </ul>
+</li>
+
+<? endif ?>
diff --git a/modules/gallery/views/menu_ajax_link.html.php b/modules/gallery/views/menu_ajax_link.html.php
new file mode 100644
index 00000000..00a394bc
--- /dev/null
+++ b/modules/gallery/views/menu_ajax_link.html.php
@@ -0,0 +1,10 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<li>
+ <a id="<?= $menu->css_id ?>"
+ class="g-ajax-link <?= $menu->css_class ?>"
+ href="<?= $menu->url ?>"
+ title="<?= $menu->label->for_html_attr() ?>"
+ ajax_handler="<?= $menu->ajax_handler ?>">
+ <?= $menu->label->for_html() ?>
+ </a>
+</li>
diff --git a/modules/gallery/views/menu_dialog.html.php b/modules/gallery/views/menu_dialog.html.php
new file mode 100644
index 00000000..99b1b013
--- /dev/null
+++ b/modules/gallery/views/menu_dialog.html.php
@@ -0,0 +1,9 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<li>
+ <a id="<?= $menu->css_id ?>"
+ class="g-dialog-link <?= $menu->css_class ?>"
+ href="<?= $menu->url ?>"
+ title="<?= $menu->label->for_html_attr() ?>">
+ <?= $menu->label->for_html() ?>
+ </a>
+</li>
diff --git a/modules/gallery/views/menu_link.html.php b/modules/gallery/views/menu_link.html.php
new file mode 100644
index 00000000..8e4cdb95
--- /dev/null
+++ b/modules/gallery/views/menu_link.html.php
@@ -0,0 +1,9 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<li>
+ <a id="<?= $menu->css_id ?>"
+ class="g-menu-link <?= $menu->css_class ?>"
+ href="<?= $menu->url ?>"
+ title="<?= $menu->label->for_html_attr() ?>">
+ <?= $menu->label->for_html() ?>
+ </a>
+</li>