Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup, remove bg, js encapsulate #8

Open
wants to merge 2 commits into
base: docs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions classes/controller/userguide.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public function index()
{
$this->template->title = "Userguide";
$this->template->breadcrumb = array('User Guide');
$this->template->content = View::factory('userguide/index',array('modules'=>Kohana::config('userguide.modules')));
$this->template->menu = View::factory('userguide/menu',array('modules'=>Kohana::config('userguide.modules')));
$this->template->content = View::factory('userguide/index', array('modules' => Kohana::config('userguide.modules')));
$this->template->menu = View::factory('userguide/menu', array('modules' => Kohana::config('userguide.modules')));
}

// Display an error if a page isn't found
public function error($message)
{
$this->request->status = 404;
$this->template->title = "Userguide - Error";
$this->template->content = View::factory('userguide/error',array('message'=>$message));
$this->template->content = View::factory('userguide/error', array('message' => $message));

// If we are in a module and that module has a menu, show that, otherwise use the index page menu
if ($module = $this->request->param('module') AND $menu = $this->file($module.'/menu'))
Expand All @@ -76,13 +76,14 @@ public function error($message)
$this->template->menu = Markdown(file_get_contents($menu));
$this->template->breadcrumb = array(
$this->guide->uri() => 'User Guide',
$this->guide->uri(array('module'=>$module)) => Kohana::config("userguide.modules.$module.name"),
'Error');
$this->guide->uri(array('module' => $module)) => Kohana::config('userguide.modules.'.$module.'.name'),
'Error'
);
}
else
{
$this->template->menu = View::factory('userguide/menu',array('modules'=>Kohana::config('userguide.modules')));
$this->template->breadcrumb = array($this->guide->uri() => 'User Guide','Error');
$this->template->menu = View::factory('userguide/menu', array('modules' => Kohana::config('userguide.modules')));
$this->template->breadcrumb = array($this->guide->uri() => 'User Guide', 'Error');
}
}

Expand All @@ -92,7 +93,7 @@ public function action_docs()
$page = $this->request->param('page');

// Trim trailing slash
$page = rtrim($page,'/');
$page = rtrim($page, '/');

// If no module specified, show the user guide index page, which lists the modules.
if ( ! $module)
Expand Down Expand Up @@ -126,7 +127,7 @@ public function action_docs()
Kodoc_Markdown::$image_url = URL::site($this->media->uri()).'/'.$module.'/';

// Set the page title
$this->template->title = $page == 'index' ? Kohana::config("userguide.modules.$module.name") : $this->title($page);
$this->template->title = $page == 'index' ? Kohana::config('userguide.modules.'.$module.'.name') : $this->title($page);

// Parse the page contents into the template
$this->template->content = Markdown(file_get_contents($file));
Expand All @@ -138,12 +139,12 @@ public function action_docs()
$this->template->bind('breadcrumb', $breadcrumb);

// Bind the copyright
$this->template->copyright = Kohana::config("userguide.modules.$module.copyright");
$this->template->copyright = Kohana::config('userguide.modules.'.$module.'.copyright');

// Add the breadcrumb trail
$breadcrumb = array();
$breadcrumb[$this->guide->uri()] = __('User Guide');
$breadcrumb[$this->guide->uri(array('module'=>$module))] = Kohana::config("userguide.modules.$module.name");
$breadcrumb[$this->guide->uri(array('module' => $module))] = Kohana::config('userguide.modules.'.$module.'.name');
$breadcrumb[] = $this->template->title;
}

Expand All @@ -160,7 +161,7 @@ public function action_api()
try
{
$_class = Kodoc_Class::factory($class);

if ( ! Kodoc::show_class($_class))
throw new Exception(__('That class is hidden'));
}
Expand Down Expand Up @@ -265,7 +266,7 @@ public function after()

public function file($page)
{
return Kohana::find_file('guide',$page,'md');
return Kohana::find_file('guide', $page, 'md');
}

public function section($page)
Expand Down
11 changes: 4 additions & 7 deletions classes/kohana/kodoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static function parse($comment)
}
break;
case 'throws':
if (preg_match('/^(\w+)\W(.*)$/',$text,$matches))
if (preg_match('/^(\w+)\W(.*)$/', $text, $matches))
{
$text = HTML::anchor(Route::get('docs/api')->uri(array('class' => $matches[1])), $matches[1]).' '.$matches[2];
}
Expand Down Expand Up @@ -276,10 +276,7 @@ public static function parse($comment)
*/
public static function source($file, $start, $end)
{
if ( ! $file)
{
return FALSE;
}
if ( ! $file) return FALSE;

$file = file($file, FILE_IGNORE_NEW_LINES);

Expand Down Expand Up @@ -313,15 +310,15 @@ public static function show_class(Kodoc_Class $class)
return TRUE;

// Get the package tags for this class (as an array)
$packages = Arr::get($class->tags,'package',Array('None'));
$packages = Arr::get($class->tags, 'package', array('None'));

$show_this = FALSE;

// Loop through each package tag
foreach ($packages as $package)
{
// If this package is in the allowed packages, set show this to true
if (in_array($package,explode(',',$api_packages)))
if (in_array($package, explode(',', $api_packages)))
$show_this = TRUE;
}

Expand Down
16 changes: 8 additions & 8 deletions classes/kohana/kodoc/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function methods()
{
$methods = $this->class->getMethods();

usort($methods, array($this,'_method_sort'));
usort($methods, array($this, '_method_sort'));

foreach ($methods as $key => $method)
{
Expand All @@ -121,21 +121,21 @@ public function methods()
return $methods;
}

protected function _method_sort($a,$b)
protected function _method_sort($a, $b)
{
/*
echo kohana::debug('a is '.$a->class.'::'.$a->name,'b is '.$b->class.'::'.$b->name,
'are the classes the same?',$a->class == $b->class,'if they are, the result is:',strcmp($a->name,$b->name),
'is a this class?',$a->name == $this->class->name,-1,
'is b this class?',$b->name == $this->class->name,1,
'otherwise, the result is:',strcmp($a->class,$b->class)
echo kohana::debug('a is '.$a->class.'::'.$a->name, 'b is '.$b->class.'::'.$b->name,
'are the classes the same?', $a->class == $b->class, 'if they are, the result is:', strcmp($a->name, $b->name),
'is a this class?', $a->name == $this->class->name, -1,
'is b this class?', $b->name == $this->class->name, 1,
'otherwise, the result is:', strcmp($a->class, $b->class)
);
*/


// If both methods are defined in the same class, just compare the method names
if ($a->class == $b->class)
return strcmp($a->name,$b->name);
return strcmp($a->name, $b->name);

// If one of them was declared by this class, it needs to be on top
if ($a->name == $this->class->name)
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/kodoc/markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function _convert_api_link($matches)
list($class, $method) = explode('::', $link, 2);

// Trim the optional parenthesis for methods
$method = rtrim($method,'()');
$method = rtrim($method, '()');

// If the first char is a $ its a property, e.g. Kohana::$base_url
if ($method[0] === '$')
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/kodoc/method.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct($class, $method)

foreach ($this->method->getParameters() as $i => $param)
{
$param = new Kodoc_Method_Param(array($this->method->class,$this->method->name),$i);
$param = new Kodoc_Method_Param(array($this->method->class, $this->method->name), $i);

if (isset($tags['param'][$i]))
{
Expand Down
2 changes: 1 addition & 1 deletion guide/about.upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ For example, in 2.x these regexes:

Would map the uri `controller/id/method` to `controller/method/id`. In 3.0 you'd use:

Route::set('reversed','(<controller>(/<id>(/<action>)))')
Route::set('reversed', '(<controller>(/<id>(/<action>)))')
->defaults(array('controller' => 'posts', 'action' => 'index'));

[!!] Each uri should have be given a unique name (in this case it's `reversed`), the reasoning behind this is explained in [the url tutorial](tutorials.urls).
Expand Down
101 changes: 64 additions & 37 deletions media/guide/css/kodoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ p, ul {
}

.note {
background:#eee url('../img/lightbulb_48.png') no-repeat 1em center;
background:#eee url(../img/lightbulb_48.png) no-repeat 1em center;
padding:1.5em 1.5em 1.5em 4.5em;
border-radius:10px;
border-radius: 10px;
}

ul, ol {
Expand Down Expand Up @@ -131,17 +131,19 @@ h6:hover a.permalink {
/* layout stuff */

#header {
background:#85da4c url('../img/header.png') bottom left repeat-x scroll;
background:#77C244 url(../img/header.png) center top repeat-x;
padding:20px 20px 0;
}

#nav {
background:url('../img/breadcrumbs.png') top left repeat-x scroll;
padding:10px 20px;
/* background:url(../img/breadcrumbs.png) top left repeat-x scroll;*/
padding: 10px 20px;
}

#nav .container {
margin:0 auto;
margin: 0 auto;
padding-bottom: 7px;
/* border-bottom: 1px solid #eee;*/
}

#nav ul {
Expand All @@ -153,55 +155,76 @@ h6:hover a.permalink {
display:inline-block;
margin-right:.6em;
float:left;
font-size: 0.75em;
text-transform: uppercase;
}

#nav a {
font-weight:bold;
color: #999;
}

#nav li:not(:first-child):before {
content:'» ';
content:' ';
padding-right:.3em;
font-size: 1.25em;
position: relative;
top: 0.05em;
line-height: 0em;
font-family: verdana;
color: #ccc;
font-weight: normal;
}

#footer {
margin:0 auto;
padding:0 20px;
width:1060px;
margin-bottom:20px;
margin: 0 auto;
padding: 0 20px;
width: 960px;
margin-bottom: 20px;
}

#footer p {
margin:0;
padding:1.5em 30px;
background:#eee;
border-radius:10px;
margin: 2em 0;
padding: 1em 0;
text-align:right;
border-top: 1px solid #eee;
font-size: 0.75em;
color: #999;
text-transform: uppercase;
}

#body {
padding:0 20px;
padding: 0;
margin: 0 auto;
}

.container {
width:1060px;
margin:20px auto;
width: 960px;
margin: 20px auto;
}

#main {
float:left;
width:800px;
width: 700px;
}

#menu {
border-left:2px solid #eee;
float:right;
margin:0 0 0 20px;
padding:0 20px;
width:198px;
padding: 10px 20px 40px;
width: 185px;
min-height: 200px;
border-left: 1px solid #eee;
margin: 0 0 40px;
}

#menu h2 {
margin: 1em 12px 0.5em;
font-weight: normal;
}
#menu a {
/* color: #8d8a44;*/
}
#menu ul , #menu ol{ list-style-type:none; margin: 0; padding: 0;}
#menu ul li, #menu ol li { margin:0; padding: 0; background:url('../img/arrows.png') -80px -1px no-repeat scroll; padding-left:12px; position:relative; }
#menu ul li, #menu ol li { margin:0; padding: 0; background:url(../img/arrows.png) -80px -1px no-repeat scroll; padding-left:12px; position:relative; }
#menu ul li.toggle-close, #menu ol li.toggle-close{ background-position: -22px -22px; }
#menu ul li.toggle-open, #menu ol li.toggle-open { background-position: -2px -42px; }
#menu ul li a.menu-toggle, #menu ol li a.menu-toggle { width:14px; height:18px; position:absolute; left:0px; text-decoration:none; cursor:pointer;}
Expand All @@ -210,7 +233,7 @@ h6:hover a.permalink {
#header .container {
margin:0 auto 0;
position:relative;
padding:0 0 20px 0;
padding: 5px 0 10px 0;
}

#mode {
Expand All @@ -220,28 +243,32 @@ h6:hover a.permalink {
}

#mode a {
background:#f3b812 url('../img/orange-tab.png') bottom left repeat-x scroll;
border:2px solid #fff;
background:#113C32;
border: 1px solid #144539;
border-bottom:none;
color:#fff;
padding:2px 15px;
border-top-left-radius:10px;
-moz-border-radius-topleft:10px;
border-top-right-radius:10px;
-moz-border-radius-topright:10px;
color:#EFEFEF;
padding: 5px 15px 2px;
border-top-left-radius:5px;
-moz-border-radius-topleft:5px;
-webkit-border-top-left-radius: 5px;
border-top-right-radius:5px;
-moz-border-radius-topright:5px;
-webkit-border-top-right-radius: 5px;
display:block;
float:left;
margin-right:10px;
margin-right: 5px;
}

#mode a:hover {
background:#f3b812 url('../img/orange-tab.png') 10px left repeat-x scroll;
background:#164e41;
text-decoration: none;
}

#mode a.current {
background:#fff;
color: #555555;
color: #555555;
font-weight:bold;
border-color: #fff;
}


Expand Down
Binary file modified media/guide/img/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading