Author: sevein
Date: Thu Jun 28 15:44:02 2012
New Revision: 11828

Log:
Treeview cleanups, add top-level class if parentId is the root object

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  Thu Jun 
28 15:43:17 2012        (r11827)
+++ trunk/apps/qubit/modules/informationobject/templates/_treeView.php  Thu Jun 
28 15:44:02 2012        (r11828)
@@ -10,7 +10,6 @@
       <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)) ?>
-        <strong>LOD</strong>
       </li>
     <?php endforeach; ?>
 
@@ -27,15 +26,18 @@
       <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)) ?>
-        <strong>LOD</strong>
       </li>
     <?php endforeach; ?>
 
-    <?php $expand = 1 < $resource->rgt - $resource->lft ?>
-    <li class="<?php if ($expand) echo 'expand' ?> active" 
data-xhr-location="<?php echo url_for(array($resource, 'module' => 
'informationobject', 'action' => 'treeView')) ?>">
-      <?php if ($expand) echo '<i></i>' ?>
+    <?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')) ?>
-      <strong>LOD</strong>
     </li>
 
     <?php foreach ($treeview['nextSiblings'] as $next): ?>
@@ -43,7 +45,6 @@
       <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)) ?>
-        <strong>LOD</strong>
       </li>
     <?php endforeach; ?>
 

Modified: 
trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php    
Thu Jun 28 15:43:17 2012        (r11827)
+++ trunk/apps/qubit/modules/informationobject/templates/treeViewSuccess.php    
Thu Jun 28 15:44:02 2012        (r11828)
@@ -4,11 +4,14 @@
   </li>
 <?php endif; ?>
 
-<?php foreach ($items as $item): ?>
-  <?php $expand = 1 < $item->rgt - $item->lft ?>
-  <li class="<?php if ($expand) echo 'expand' ?><?php if 
($sf_request->resourceId == $item->id) echo ' active' ?>" 
data-xhr-location="<?php echo url_for(array('module' => 'informationobject', 
'action' => 'treeView', 'slug' => $item->slug)) ?>">
-    <?php if ($expand) echo '<i></i>' ?>
-    <?php echo link_to($item->title, array('module' => 'informationobject', 
'slug' => $item->slug)) ?> <strong>LOD</strong>
+<?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 endforeach; ?>
 

-- 
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.

Reply via email to