Show
Ignore:
Timestamp:
09/03/2007 08:49:02 PM (15 months ago)
Author:
Shadowhand
Message:

A few small changes:

  • Added html::script() and html::stylesheet()
  • Updated Kohana::lang() to use foo.bar syntax, like Event and Config
  • Fixed the View class' output callback handling
  • Removed AJAX spinner
  • Updated User Guide effects to use an easing for animations, and call prettyPrint() only when there are elements to be highlighted
  • Updated User Guide layout to remove AJAX-related styles
  • Updated User Guide template to be i18n compatible, the same template can be used for every language
  • Removed User Guide menu template, in favor of building the menu in the template
  • Added i18n directory for the User Guide, for localized strings (title, copyright, menu)
Location:
trunk/modules/user_guide
Files:
3 added
1 removed
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/user_guide/controllers/user_guide.php

    r485 r486  
    4141                $content  = rtrim('user_guide/'.$locale.'content/'.$category.'/'.$section, '/'); 
    4242 
    43                 $template          = $this->load->view('user_guide/'.$locale.'template'); 
    44                 $template->menu    = $this->load->view('user_guide/'.$locale.'menu', array('active_category' => $category, 'active_section' => $section)); 
    45                 $template->content = $this->load->view($content)->render(FALSE, array($this, '_tags')); 
    46  
    4743                // Display output 
    48                 $template->render(TRUE); 
     44                $this->load->view('user_guide/'.$locale.'template', array 
     45                ( 
     46                        'active_category' => $category, 
     47                        'active_section'  => $section, 
     48                        'content'         => $this->load->view($content)->render(FALSE, array($this, '_tags')) 
     49                ))->render(TRUE); 
    4950        } 
    5051 
  • trunk/modules/user_guide/views/user_guide/css/layout.css

    r475 r486  
    4343#body li { padding: 0.1em 0; } 
    4444#footer { padding: 0 1em; background: #fff; line-height: 2em; } 
    45 #loading { position: absolute; top: 0; right: 0; z-index: 9999; width: 32px; height: 32px; background: transparent url(spinner.gif) center center no-repeat; } 
    4645/* 
    4746Content Styles 
  • trunk/modules/user_guide/views/user_guide/en/template.php

    r479 r486  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//<?php echo strtoupper(Config::item('core.locale')) ?>" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo Config::item('core.locale') ?>" lang="<?php echo Config::item('core.locale') ?>"> 
    33<head> 
    44<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    55 
    6 <title>Kohana User Guide</title> 
     6<title><?php echo Kohana::lang('user_guide.title') ?></title> 
    77 
    8 <link type="text/css" rel="stylesheet" href="<?php echo url::base(TRUE) ?>user_guide/css/layout.css" /> 
    9 <link type="text/css" rel="stylesheet" href="<?php echo url::base(TRUE) ?>user_guide/css/prettify.css" /> 
     8<?php 
    109 
    11 <script type="text/javascript" src="<?php echo url::base(TRUE) ?>user_guide/js/jquery.js"></script> 
    12 <script type="text/javascript" src="<?php echo url::base(TRUE) ?>user_guide/js/plugins.js"></script> 
    13 <script type="text/javascript" src="<?php echo url::base(TRUE) ?>user_guide/js/prettify.js"></script> 
    14 <script type="text/javascript" src="<?php echo url::base(TRUE) ?>user_guide/js/effects.js"></script> 
     10echo html::stylesheet(array 
     11( 
     12        'user_guide/css/layout', 
     13        'user_guide/css/prettify' 
     14), TRUE) 
     15 
     16?> 
     17 
     18<?php 
     19 
     20echo html::script(array 
     21( 
     22        'user_guide/js/jquery', 
     23        'user_guide/js/plugins', 
     24        'user_guide/js/prettify', 
     25        'user_guide/js/effects' 
     26), TRUE) 
     27 
     28?> 
    1529 
    1630</head> 
     
    1832<div id="container"> 
    1933 
     34<!-- @start Menu --> 
    2035<div id="menu"> 
    21 <?php echo $menu ?> 
     36<ul> 
     37<?php 
     38 
     39foreach(Kohana::lang('user_guide.menu') as $category => $menu): 
     40 
     41        $active = (strtolower($category) == $active_category) ? ' active' : ''; 
     42 
     43?> 
     44<li class="first<?php echo $active ?>"><span><?php echo $category ?></span><ul> 
     45<?php 
     46 
     47        foreach($menu as $section): 
     48 
     49                $active = (strtolower($section) == $active_section) ? 'lite' : ''; 
     50 
     51?> 
     52<li class="<?php echo $active ?>"><?php echo html::anchor(strtolower('user_guide/'.$category.'/'.$section), $section) ?></li> 
     53<?php 
     54 
     55        endforeach; 
     56 
     57?> 
     58</ul></li> 
     59<?php 
     60 
     61endforeach; 
     62 
     63?> 
     64</ul> 
    2265</div> 
    23  
     66<!-- @end Menu --> 
    2467<!-- @start Body --> 
    2568<div id="body"> 
     
    2770</div> 
    2871<!-- @end Body --> 
    29  
    3072<!-- @start Footer --> 
    31 <div id="footer"> 
    32 <p id="copyright">copyright (c) <?php echo date('Y') ?> Kohana Team :: All rights reserved :: Rendered in {execution_time} seconds using {memory_usage}MB of memory</p> 
    33 </div> 
     73<div id="footer"><p id="copyright"><?php echo sprintf(Kohana::lang('user_guide.copyright'), date('Y')) ?></p></div> 
    3474<!-- @end Footer --> 
    3575 
  • trunk/modules/user_guide/views/user_guide/js/effects.js

    r485 r486  
    11// $Id$ 
    22$(document).ready(function(){ 
    3         // Menu opacity hover effect, much fancy pants! 
    4         $('#menu').css('opacity', 0.7).hover(function(){ 
    5                 $(this).fadeTo(100, 1); 
    6         }, function(){ 
    7                 $(this).fadeTo(300, 0.7) 
    8         }); 
     3        // Opacity animations in an element with an opacity of 1.0 cause Firefox bugs 
     4        $('#menu').css('opacity', 0.9999); 
    95        // Apply menu sliding effect 
    106        $('#menu li.first').click(function(){ 
    11                 // Define the current menu and the clicked menu 
    12                 var curr = $('#menu li.active'); 
    13                 var self = $(this); 
    147                // Clicks to the same menu will do nothing 
    15                 if (self.is('.active') == false) 
    16                 { 
    17                         // Hide the current elements 
    18                         curr.removeClass('active') 
     8                if ($(this).is('.active') == false){ 
     9                        // Hide the current submenu 
     10                        $('#menu li.active').removeClass('active') 
    1911                        .find('ul') 
    20                         .slideUp(250); 
    21                         // Show the new elements 
    22                         self.addClass('active') 
     12                        .animate({height: 'hide', opacity: 'hide'}, 200, 'easeout'); 
     13                        // Show the clicked submenu 
     14                        $(this).addClass('active') 
    2315                        .find('ul') 
    24                         .slideDown(250); 
     16                        .slideDown({height: 'show', opacity: 'show'}, 200, 'easein'); 
    2517                } 
    2618        }) 
     
    2820        .not('.active').find('ul').hide(); 
    2921        // For syntax highlighting 
    30         prettyPrint(); 
     22        if ($('.prettyprint').length) prettyPrint(); 
    3123});