Minor internal layout changes

This commit is contained in:
Deon George 2012-01-12 19:53:33 +11:00
parent 14d5f1939e
commit 9e21f60066
3 changed files with 18 additions and 19 deletions

View File

@ -122,19 +122,25 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
$this->meta = new meta; $this->meta = new meta;
View::bind_global('meta',$this->meta); View::bind_global('meta',$this->meta);
// Our default style sheet // Our default style sheet(s)
Style::add(array( foreach (array('file'=>array_reverse(array(
'type'=>'file', 'css/default.css',
'data'=>'css/default.css', ))) as $type => $datas) {
));
// Our default scripts foreach ($datas as $data) {
// This is in a reverse list, since we push them to the beginging of the scripts to render. Style::add(array(
foreach (array('file'=>array( 'type'=>$type,
'js/jquery.cookie.js', 'data'=>$data,
'js/jquery.jstree-1.0rc3.js', ),TRUE);
}
}
// Our default script(s)
foreach (array('file'=>array_reverse(array(
'js/jquery-1.6.4.min.js', 'js/jquery-1.6.4.min.js',
)) as $type => $datas) { 'js/jquery.jstree-1.0rc3.js',
'js/jquery.cookie.js',
))) as $type => $datas) {
foreach ($datas as $data) { foreach ($datas as $data) {
Script::add(array( Script::add(array(

View File

@ -34,18 +34,13 @@ class lnApp_Script extends HTMLRender {
$foutput = $soutput = ''; $foutput = $soutput = '';
$mediapath = Route::get(static::$_media_path); $mediapath = Route::get(static::$_media_path);
$i = $j = 0;
foreach (static::$_data as $value) { foreach (static::$_data as $value) {
switch ($value['type']) { switch ($value['type']) {
case 'file': case 'file':
$foutput .= HTML::script($mediapath->uri(array('file'=>$value['data']))); $foutput .= HTML::script($mediapath->uri(array('file'=>$value['data'])));
if ($i++)
$foutput .= static::$_spacer;
break; break;
case 'stdin': case 'stdin':
$soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']); $soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']);
if ($j++)
$soutput .= static::$_spacer;
break; break;
default: default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));

View File

@ -14,6 +14,7 @@ class lnApp_Style extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = "\n"; protected static $_spacer = "\n";
protected static $_required_keys = array('type','data'); protected static $_required_keys = array('type','data');
protected static $_unique_vals = array('file'=>'type');
/** /**
* Return an instance of this class * Return an instance of this class
@ -33,7 +34,6 @@ class lnApp_Style extends HTMLRender {
$foutput = $soutput = ''; $foutput = $soutput = '';
$mediapath = Route::get(static::$_media_path); $mediapath = Route::get(static::$_media_path);
$i = $j = 0;
foreach (static::$_data as $value) { foreach (static::$_data as $value) {
switch ($value['type']) { switch ($value['type']) {
case 'file': case 'file':
@ -42,8 +42,6 @@ class lnApp_Style extends HTMLRender {
break; break;
case 'stdin': case 'stdin':
$soutput .= sprintf("<style type=\"text/css\">%s</style>",$value['data']); $soutput .= sprintf("<style type=\"text/css\">%s</style>",$value['data']);
if ($j++)
$soutput .= static::$_spacer;
break; break;
default: default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));