Skip to content

Commit

Permalink
Add vagrant support and upgrade to yiistrap 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
crisu83 committed Oct 24, 2013
1 parent 28f33cc commit d3588d5
Show file tree
Hide file tree
Showing 90 changed files with 30,512 additions and 27,293 deletions.
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# composer
composer.phar
composer.lock
/vendor
/vendor/*

# project files
/.buildpath
/.idea
/.project
/.settings
/nbproject
/.buildpath/*
/.idea/*
/.project/*
/.settings/*
/nbproject/*

# cache directories
Thumbs.db
Expand All @@ -20,11 +19,11 @@ switch
index

# runtime and cache directories
/app/runtime
/web/assets
/app/runtime/*
/web/assets/*

# vagrant
.vagrant
.vagrant/*

# node modules
node_modules/*
20 changes: 20 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

# Default
config.vm.box = "precise64_vmware"
config.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
config.vm.network :public_network

# VirtualBox
config.vm.provider :virtualbox do |v, override|
override.vm.box = "precise32"
override.vm.box_url = "http://files.vagrantup.com/precise32.box"
end

# Enable the bootstrap-script
config.vm.provision :shell, :path => "bootstrap/bootstrap.sh"

end
14 changes: 8 additions & 6 deletions app/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// application configuration
return array(
// application base path
'basePath' => realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'),
'basePath' => dirname(__DIR__),
// application name
'name' => 'Yiistrap',
// application language
Expand All @@ -11,15 +11,17 @@
'preload' => array('log'),
// path aliases
'aliases' => array(
'app' => 'application',
'vendor' => realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '../vendor'),
'root' => dirname(dirname(__DIR__)),
'app' => 'root.app',
'vendor' => 'root.vendor',
'bootstrap' => 'vendor.crisu83.yiistrap',
),
// paths to import
'import' => array(
'application.models.*',
'application.components.*',
'bootstrap.helpers.*',
'app.models.*',
'app.components.*',
'bootstrap.form.*',
'bootstrap.helpers.*',
),
// application components
'components' => array(
Expand Down
65 changes: 34 additions & 31 deletions app/helpers/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
function app()
{
return Yii::app();
return Yii::app();
}

/**
Expand All @@ -25,7 +25,7 @@ function app()
*/
function param($name)
{
return isset(Yii::app()->params[$name]) ? Yii::app()->params[$name] : null;
return isset(Yii::app()->params[$name]) ? Yii::app()->params[$name] : null;
}

/**
Expand All @@ -34,7 +34,7 @@ function param($name)
*/
function cs()
{
return Yii::app()->getClientScript();
return Yii::app()->getClientScript();
}

/**
Expand All @@ -43,7 +43,7 @@ function cs()
*/
function db()
{
return Yii::app()->getDb();
return Yii::app()->getDb();
}

/**
Expand All @@ -52,7 +52,7 @@ function db()
*/
function format()
{
return Yii::app()->getFormat();
return Yii::app()->getFormat();
}

/**
Expand All @@ -61,7 +61,7 @@ function format()
*/
function request()
{
return Yii::app()->getRequest();
return Yii::app()->getRequest();
}

/**
Expand All @@ -70,7 +70,7 @@ function request()
*/
function session()
{
return Yii::app()->getSession();
return Yii::app()->getSession();
}

/**
Expand All @@ -79,7 +79,7 @@ function session()
*/
function user()
{
return Yii::app()->getUser();
return Yii::app()->getUser();
}

/**
Expand All @@ -93,7 +93,7 @@ function user()
*/
function t($category, $message, $params = array(), $source = null, $language = null)
{
return Yii::t($category, $message, $params, $source, $language);
return Yii::t($category, $message, $params, $source, $language);
}

/**
Expand All @@ -103,10 +103,11 @@ function t($category, $message, $params = array(), $source = null, $language = n
*/
function baseUrl($url = '')
{
static $baseUrl;
if (!isset($baseUrl))
$baseUrl = Yii::app()->request->baseUrl;
return $baseUrl . '/' . ltrim($url, '/');
static $baseUrl;
if (!isset($baseUrl)) {
$baseUrl = Yii::app()->request->baseUrl;
}
return $baseUrl . '/' . ltrim($url, '/');
}

/**
Expand All @@ -116,7 +117,7 @@ function baseUrl($url = '')
*/
function css($url, $media = '')
{
Yii::app()->clientScript->registerCssFile(baseUrl($url), $media);
Yii::app()->clientScript->registerCssFile(baseUrl($url), $media);
}

/**
Expand All @@ -126,7 +127,7 @@ function css($url, $media = '')
*/
function js($url, $position = null)
{
Yii::app()->clientScript->registerScriptFile(baseUrl($url), $position);
Yii::app()->clientScript->registerScriptFile(baseUrl($url), $position);
}

/**
Expand All @@ -136,7 +137,7 @@ function js($url, $position = null)
*/
function e($text)
{
return CHtml::encode($text);
return CHtml::encode($text);
}

/**
Expand All @@ -148,7 +149,7 @@ function e($text)
*/
function v($model, $attribute, $defaultValue = null)
{
return CHtml::encode(CHtml::value($model, $attribute, $defaultValue));
return CHtml::encode(CHtml::value($model, $attribute, $defaultValue));
}

/**
Expand All @@ -158,10 +159,11 @@ function v($model, $attribute, $defaultValue = null)
*/
function purify($text)
{
static $purifier;
if (!isset($purifier))
$purifier = new CHtmlPurifier;
return $purifier->purify($text);
static $purifier;
if (!isset($purifier)) {
$purifier = new CHtmlPurifier;
}
return $purifier->purify($text);
}

/**
Expand All @@ -171,10 +173,11 @@ function purify($text)
*/
function markdown($text)
{
static $parser;
if (!isset($parser))
$parser = new MarkdownParser;
return $parser->safeTransform($text);
static $parser;
if (!isset($parser)) {
$parser = new MarkdownParser;
}
return $parser->safeTransform($text);
}

/**
Expand All @@ -186,7 +189,7 @@ function markdown($text)
*/
function img($src, $alt = '', $htmlOptions = array())
{
return CHtml::image(baseUrl($src), $alt, $htmlOptions);
return CHtml::image(baseUrl($src), $alt, $htmlOptions);
}

/**
Expand All @@ -198,7 +201,7 @@ function img($src, $alt = '', $htmlOptions = array())
*/
function l($text, $url = '#', $htmlOptions = array())
{
return CHtml::link($text, $url, $htmlOptions);
return CHtml::link($text, $url, $htmlOptions);
}

/**
Expand All @@ -210,7 +213,7 @@ function l($text, $url = '#', $htmlOptions = array())
*/
function url($route, $params = array(), $ampersand = '&')
{
return Yii::app()->urlManager->createUrl($route, $params, $ampersand);
return Yii::app()->urlManager->createUrl($route, $params, $ampersand);
}

/**
Expand All @@ -221,7 +224,7 @@ function url($route, $params = array(), $ampersand = '&')
*/
function je($value, $options = 0)
{
return json_encode($value, $options);
return json_encode($value, $options);
}

/**
Expand All @@ -234,7 +237,7 @@ function je($value, $options = 0)
*/
function jd($string, $assoc = true, $depth = 512, $options = 0)
{
return json_decode($string, $assoc, $depth, $options);
return json_decode($string, $assoc, $depth, $options);
}

/**
Expand All @@ -245,5 +248,5 @@ function jd($string, $assoc = true, $depth = 512, $options = 0)
*/
function dump($var, $depth = 10, $highlight = true)
{
echo CVarDumper::dumpAsString($var, $depth, $highlight);
echo CVarDumper::dumpAsString($var, $depth, $highlight);
}
Empty file added app/runtime/.gitkeep
Empty file.
10 changes: 5 additions & 5 deletions app/views/layouts/main.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /* @var $this Controller */ ?>
<?php Yii::app()->bootstrap->registerYiistrapCss(); ?>
<?php Yii::app()->bootstrap->registerAllScripts(); ?>
<?php app()->bootstrap->registerYiistrapCss(); ?>
<?php app()->bootstrap->registerAllScripts(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
Expand All @@ -11,8 +11,8 @@
<?php css('css/responsive.css'); ?>
<?php css('css/styles.css'); ?>
<?php css('css/prettify.css'); ?>
<?php js('js/prettify.js'); ?>
<?php js('js/holder.js'); ?>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/holder/2.0/holder.js"></script>
<?php js('js/app.js', CClientScript::POS_END); ?>
<title><?php echo e($this->pageTitle); ?></title>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
Expand All @@ -33,7 +33,7 @@
<body class="layout-main" data-spy="scroll" data-target=".bs-docs-sidebar">
<!-- Navbar -->
<?php $this->widget('bootstrap.widgets.TbNavbar', array(
'brandLabel' => img('images/logo-navbar.png') . ' ' . e(Yii::app()->name) . ' <small>RC1</small>',
'brandLabel' => img('images/logo-navbar.png') . ' ' . e(Yii::app()->name) . ' <small>1.2.0</small>',
'brandUrl' => baseUrl('site/index'),
'collapse' => true,
'items' => array(
Expand Down
8 changes: 4 additions & 4 deletions app/views/site/components.php
Original file line number Diff line number Diff line change
Expand Up @@ -1144,15 +1144,15 @@
<h2>Default example</h2>

<div class="bs-docs-example">
<?php echo TbHtml::mediaObjects(array(
<?php echo TbHtml::mediaList(array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.'),
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.', 'items' => array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.'),
)),
)); ?>
</div>
<pre class="prettyprint linenums">
&lt;?php echo TbHtml::mediaObjects(array(
&lt;?php echo TbHtml::mediaList(array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => '...'),
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => '...', 'items' => array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => '...'),
Expand All @@ -1164,7 +1164,7 @@
<h2>Media list</h2>

<div class="bs-docs-example">
<?php echo TbHtml::mediaObjects(array(
<?php echo TbHtml::mediaList(array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.', 'items' => array(
array('image' => 'holder.js/64x64', 'heading' => 'Nested media heading', 'content' => 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.', 'items' => array(
array('image' => 'holder.js/64x64', 'heading' => 'Nested media heading', 'content' => 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.'),
Expand All @@ -1175,7 +1175,7 @@
)); ?>
</div>
<pre class="prettyprint linenums">
&lt;?php echo TbHtml::mediaObjects(array(
&lt;?php echo TbHtml::mediaList(array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => '...', 'items' => array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => '...', 'items' => array(
array('image' => 'holder.js/64x64', 'heading' => 'Media heading', 'content' => '...'),
Expand Down
Loading

0 comments on commit d3588d5

Please sign in to comment.