Project:SpreadFirefox
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:paddy_deburca
Status:closed (fixed)

Issue Summary

The attached patch updates SpreadFirefox to be compatible with Drupal 5 beta 1.

The list of changes are

  • page.tpl.php
    1. Replace the theme('stylesheet_import') method with a more verbose - but working - method
    2. Replace module_exist with module_exists
    3. Use the theme('links') method to print the primary and secondary links
  • style.css
    1. Add a definition for .main-content .node .info .taxonomy to display in-line (see node.tpl.php)
    2. Update the .form-item label definitions to have a hidden bottom border by default - this removes the flicker when a label is hovered over
  • node.tpl.php
    1. Replace the span class="taxonomy" with div class="taxonomy". Having a UL inside a SPAN is not allowed, while having a UL inside a DIV is!
  • nav.css
    1. Update various line-heights from 0.1 to 0.1em
    2. Append spacing after an expanded menu item -- by default the background of the sub-menu over writes part of the icon to the left. The addition of the spacing stops this. A better solution would be to have a transparent background

More work needs to be done on the administration pages to remove superfluous borders -- nothing serious.

Paddy.

AttachmentSize
sfx_drupal5.patch3.93 KB

Comments

#1

I am not too happy with the new theme('links') method of returning the primary and secondary menus. The 'active' class is only added to the hyperlink and not the list item. This means that we can only customise the hyperlink when that part of the web site is being viewed.

The solution is to use preg_replace to replace all occurances of 'menu-1-2-3-active' with 'menu-1-2-3 active'.

The new code in template.php could be

<?php
function spreadfirefox_links() {
  global
$theme, $theme_engine;
 
$args = func_get_args();
 
$function = 'links';

  if ((
$theme != '') && isset($theme_engine) && function_exists($theme_engine .'_'. $function)) {
   
// call engine function
   
$user_function = $theme_engine .'_'. $function;
  }
  elseif (
function_exists('theme_'. $function)){
   
// call Drupal function
   
$user_function = 'theme_'. $function;
  }
 
  return
preg_replace("/(menu-\d+-\d+-\d+)-active/", "$1 active", call_user_func_array($user_function, $args));
}
?>

The new css could be

html>body #header ul li.active {
  background: transparent url(images/header_tab.png) 100% 0px no-repeat;
}
html>body #header ul li a.active {
  background: transparent url(images/header_tab.png) 0% 0px no-repeat;
  color: #515358;
}

This highlights the active menu item for all those compliant browsers.

Any thoughts?

Paddy.

#2


   <?php if ($primary_links) : ?>
-     <ul id="primary">
-      <?php foreach (array_reverse($primary_links) as $link): ?>
-       <li><?php print $link; ?></li>
-      <?php endforeach; ?>
-     </ul>
-
+      <?php print theme('links', $primary_links, array('class' => 'primary-links')) ?>
     <?php elseif ($secondary_links) : ?>
-     <ul id="secondary">
-      <?php foreach (array_reverse($secondary_links) as $link): ?>
-       <li><?php print $link; ?></li>
-      <?php endforeach; ?>
-     </ul>
+      <?php print theme('links', array_reverse($secondary_links), array('class' => 'secondary-links')) ?>

is not exactly right: it has to be

<?php if ($primary_links) : ?>
     <?php print theme('links', array_reverse($primary_links), array('class' =>'links', 'id' => 'primary')); ?>
    <?php elseif ($secondary_links) : ?>
     <?php print theme('links', $primary_links, array('class' =>'links', 'id' => 'secondary')); ?>
    <?php endif; ?>

then the layout will stay the same

#3

the cvs is updated to 5.0. as far as i can see there are no changes in the layout. please test and comment.

#4

Status:active» fixed

#5

Status:fixed» closed (fixed)