Author: sevein
Date: Sat Jul 28 09:48:23 2012
New Revision: 12002
Log:
Use render_treeview_node()
Modified:
trunk/apps/qubit/modules/informationobject/templates/_treeView.php
trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php
Modified: trunk/apps/qubit/modules/informationobject/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_treeView.php Sat Jul
28 09:47:46 2012 (r12001)
+++ trunk/apps/qubit/modules/informationobject/templates/_treeView.php Sat Jul
28 09:48:23 2012 (r12002)
@@ -6,53 +6,53 @@
<?php echo link_to(__('Show all'), array('module' =>
'informationobject', 'action' => 'browse')) ?>
</li>
+ <?php // Ancestors ?>
<?php foreach ($treeview['ancestors'] as $item): ?>
- <li class="ancestor" data-xhr-location="<?php echo
url_for(array('module' => 'informationobject', 'action' => 'treeView', 'slug'
=> $item->slug)) ?>">
- <i></i>
- <?php echo link_to($item->title, array('module' =>
'informationobject', 'slug' => $item->slug)) ?>
- </li>
+ <?php echo render_treeview_node(
+ $item,
+ array('ancestor' => true),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $item->slug)))); ?>
<?php endforeach; ?>
+ <?php // More button ?>
<?php if (isset($treeview['prevSiblings']) && 0 <
count($treeview['prevSiblings'])): ?>
<?php if (1 < $treeview['prevSiblings'][0]->lft - $parent->lft): ?>
- <li class="more" data-xhr-location="<?php echo url_for(array('module'
=> 'informationobject', 'action' => 'treeView', 'slug' =>
$treeview['prevSiblings'][0]->slug)) ?>">
- <a href="#">...</a>
- </li>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array('module' =>
'informationobject', 'action' => 'treeView', 'slug' =>
$treeview['prevSiblings'][0]->slug)))); ?>
<?php endif; ?>
<?php endif; ?>
+ <?php // N prev items ?>
<?php foreach ($treeview['prevSiblings'] as $prev): ?>
- <?php $expand = 1 < $prev->rgt - $prev->lft ?>
- <li class="<?php if ($expand) echo 'expand' ?>" data-xhr-location="<?php
echo url_for(array('module' => 'informationobject', 'action' => 'treeView',
'slug' => $prev->slug)) ?>">
- <?php if ($expand) echo '<i></i>' ?>
- <?php echo link_to($prev->title, array('module' =>
'informationobject', 'slug' => $prev->slug)) ?>
- </li>
+ <?php echo render_treeview_node(
+ $prev,
+ array('expand' => 1 < $prev->rgt - $prev->lft),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $prev->slug)))); ?>
<?php endforeach; ?>
- <?php $classes = array() ?>
- <?php if (1 < $resource->rgt - $resource->lft) $classes[] = 'expand' ?>
- <?php if (QubitInformationObject::ROOT_ID == $resource->parentId)
$classes[] = 'top-level' ?>
- <?php $classes[] = 'active' ?>
- <li
- data-title="<?php echo __('Item') ?>"
- class="<?php echo implode(' ', $classes) ?>" data-xhr-location="<?php
echo url_for(array($resource, 'module' => 'informationobject', 'action' =>
'treeView')) ?>">
- <?php if (false !== array_search('expand', $classes)) echo '<i></i>' ?>
- <?php echo link_to($resource->title, array($resource, 'module' =>
'informationobject')) ?>
- </li>
+ <?php // Current ?>
+ <?php echo render_treeview_node(
+ $resource,
+ array('expand' => $resource->hasChildren(), 'active' => true),
+ array('xhr-location' => url_for(array($resource, 'module' =>
'informationobject', 'action' => 'treeView')))); ?>
+ <?php // N next items ?>
<?php foreach ($treeview['nextSiblings'] as $next): ?>
- <?php $expand = 1 < $next->rgt - $next->lft ?>
- <li class="<?php if ($expand) echo 'expand' ?>" data-xhr-location="<?php
echo url_for(array('module' => 'informationobject', 'action' => 'treeView',
'slug' => $next->slug)) ?>">
- <?php if ($expand) echo '<i></i>' ?>
- <?php echo link_to($next->title, array('module' =>
'informationobject', 'slug' => $next->slug)) ?>
- </li>
+ <?php echo render_treeview_node(
+ $next,
+ array('expand' => 1 < $next->rgt - $next->lft),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $next->slug)))); ?>
<?php endforeach; ?>
+ <?php // More button ?>
<?php $last = isset($next) ? $next : $resource ?>
<?php if ($parent->rgt - $last->rgt > 1): ?>
- <li class="more" data-xhr-location="<?php echo url_for(array('module' =>
'informationobject', 'action' => 'treeView', 'slug' => $last->slug)) ?>">
- <a href="#">...</a>
- </li>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $last->slug)))); ?>
<?php endif; ?>
</ul>
Modified:
trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php
Sat Jul 28 09:47:46 2012 (r12001)
+++ trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php
Sat Jul 28 09:48:23 2012 (r12002)
@@ -1,25 +1,23 @@
<?php if ('prevSiblings' == $sf_request->show && 0 < count($items) && 1 <
($items[0]->lft - $resource->parent->lft)): ?>
- <li class="more" data-xhr-location="<?php echo url_for(array('module' =>
'informationobject', 'action' => 'treeView', 'slug' => $items[0]->slug)) ?>">
- <a href="#">...</a>
- </li>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $items[0]->slug)))); ?>
<?php endif; ?>
-<?php foreach ($items as $item): // This really needs to be refactored with
the help of a QubitHelper function ?>
- <?php $classes = array() ?>
- <?php if (1 < $item->rgt - $item->lft) $classes[] = 'expand' ?>
- <?php if (QubitInformationObject::ROOT_ID == $item->parent_id) $classes[] =
'top-level' ?>
- <?php if ($sf_request->resourceId == $item->id) $classes[] = 'active' ?>
- <li class="<?php echo implode(' ', $classes) ?>" data-xhr-location="<?php
echo url_for(array('module' => 'informationobject', 'action' => 'treeView',
'slug' => $item->slug)) ?>">
- <?php if (false !== array_search('expand', $classes)) echo '<i></i>' ?>
- <?php echo link_to($item->title, array('module' => 'informationobject',
'slug' => $item->slug)) ?>
- </li>
+<?php foreach ($items as $item): ?>
+ <?php echo render_treeview_node(
+ $item,
+ array('expand' => 1 < $item->rgt - $item->lft, 'active' =>
$sf_request->resourceId == $item->id),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $item->slug)))); ?>
<?php endforeach; ?>
<?php if ('prevSiblings' != $sf_request->show): ?>
<?php $parent = 'item' == $sf_request->show ||
QubitInformationObject::ROOT_ID == $resource->id ? $resource :
$resource->parent ?>
<?php if ($parent->rgt - $item->rgt > 1): ?>
- <li class="more" data-xhr-location="<?php echo url_for(array('module' =>
'informationobject', 'action' => 'treeView', 'slug' => $item->slug)) ?>">
- <a href="#">...</a>
- </li>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array('module' => 'informationobject',
'action' => 'treeView', 'slug' => $item->slug)))); ?>
<?php endif; ?>
<?php endif; ?>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.