Author: sevein
Date: Mon Aug 27 10:49:35 2012
New Revision: 12211

Log:
Introduce 'Show all' button in the treeview, remove header link, put the 
taxonomy title in the title bar of the treeview

Modified:
   trunk/apps/qubit/modules/term/actions/treeViewAction.class.php
   trunk/apps/qubit/modules/term/templates/_contextMenu.php
   trunk/apps/qubit/modules/term/templates/_treeView.php
   trunk/css/graphic.css
   trunk/js/treeView.js

Modified: trunk/apps/qubit/modules/term/actions/treeViewAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/treeViewAction.class.php      Mon Aug 
27 10:48:46 2012        (r12210)
+++ trunk/apps/qubit/modules/term/actions/treeViewAction.class.php      Mon Aug 
27 10:49:35 2012        (r12211)
@@ -21,11 +21,36 @@
 {
   public function execute($request)
   {
-    $this->resource = $this->getRoute()->resource;
-
     // Number of siblings that we are showing above and below the current node
     $numberOfPreviousOrNextSiblings = 4;
 
+    if ('all' == $request->show)
+    {
+      $taxonomyId = QubitTerm::getById($request->resourceId)->taxonomyId;
+
+      // Get first child
+      $criteria = new Criteria;
+      $criteria->add(QubitTerm::PARENT_ID, QubitTerm::ROOT_ID);
+      $criteria->add(QubitTerm::TAXONOMY_ID, $taxonomyId);
+      $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
'QubitTerm');
+      $criteria->addAscendingOrderByColumn('name');
+      $criteria->addAscendingOrderByColumn('lft');
+      $criteria->setLimit(1);
+
+      $first = QubitTerm::getOne($criteria);
+
+      // Create array
+      $this->items = array();
+      $this->items[] = $first;
+
+      // Merge following siblings to the array
+      $this->items = array_merge($this->items, 
$first->getTreeViewSiblings(array('limit' => $numberOfPreviousOrNextSiblings + 
1, 'position' => 'next')));
+
+      return;
+    }
+
+    $this->resource = $this->getRoute()->resource;
+
     switch ($request->show)
     {
       case 'prevSiblings':

Modified: trunk/apps/qubit/modules/term/templates/_contextMenu.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/_contextMenu.php    Mon Aug 27 
10:48:46 2012        (r12210)
+++ trunk/apps/qubit/modules/term/templates/_contextMenu.php    Mon Aug 27 
10:49:35 2012        (r12211)
@@ -1,5 +1,7 @@
 <div>
-  <h3><?php echo __('Taxonomy hierarchy') ?></h3>
+  <h3>
+    <?php echo __('Taxonomy hierarchy') ?> &raquo; <?php echo 
render_title($resource->taxonomy) ?>
+  </h3>
   <div>
     <?php echo get_component('term', 'treeView') ?>
   </div>

Modified: trunk/apps/qubit/modules/term/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/_treeView.php       Mon Aug 27 
10:48:46 2012        (r12210)
+++ trunk/apps/qubit/modules/term/templates/_treeView.php       Mon Aug 27 
10:49:35 2012        (r12211)
@@ -2,8 +2,9 @@
 
   <ul class="unstyled">
 
-    <li class="header">
-      <?php echo link_to(render_title($resource->taxonomy), 
array($resource->taxonomy, 'module' => 'taxonomy')) ?>
+    <li class="back" style="<?php echo QubitTerm::ROOT_ID == 
$resource->parentId ? 'display: none;' : '' ?>" data-xhr-location="<?php echo 
url_for(array('module' => 'term', 'action' => 'treeView')) ?>">
+      <i></i>
+      <?php echo link_to(__('Show all'), array('module' => 'term', 'action' => 
'browse')) ?>
     </li>
 
     <?php // Ancestors ?>

Modified: trunk/css/graphic.css
==============================================================================
--- trunk/css/graphic.css       Mon Aug 27 10:48:46 2012        (r12210)
+++ trunk/css/graphic.css       Mon Aug 27 10:49:35 2012        (r12211)
@@ -278,18 +278,11 @@
 }
 
 #treeview .ancestor,
-#treeview .back,
-#treeview .header
+#treeview .back
 {
   background-color: #f5f5f5;
 }
 
-#treeview .header a
-{
-  color: Black;
-  font-weight: bold;
-}
-
 #treeview .back
 {
   cursor: pointer;

Modified: trunk/js/treeView.js
==============================================================================
--- trunk/js/treeView.js        Mon Aug 27 10:48:46 2012        (r12210)
+++ trunk/js/treeView.js        Mon Aug 27 10:49:35 2012        (r12211)
@@ -79,7 +79,7 @@
       this.setLoading(false);
 
       // Regular nodes selector
-      this.nodesSelector = 'li:not(.back, .ancestor, .more, .header)';
+      this.nodesSelector = 'li:not(.back, .ancestor, .more)';
 
       // Store the current resource id to highlight it
       // during the treeview browsing

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