Skip to content

Commit

Permalink
Merge branch 'release/1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
slywalker committed May 10, 2012
2 parents c81d739 + 2b9cc31 commit 475d266
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 31 deletions.
24 changes: 24 additions & 0 deletions Config/html5_tags.php
@@ -0,0 +1,24 @@
<?php
$config = array('tags' => array(
'meta' => '<meta%s>',
'metalink' => '<link href="%s"%s>',
'hidden' => '<input type="hidden" name="%s"%s>',
'checkbox' => '<input type="checkbox" name="%s"%s>',
'checkboxmultiple' => '<input type="checkbox" name="%s[]"%s>',
'radio' => '<input type="radio" name="%s" id="%s"%s>%s',
'password' => '<input type="password" name="%s"%s>',
'file' => '<input type="file" name="%s"%s>',
'file_no_model' => '<input type="file" name="%s"%s>',
'submit' => '<input %s>',
'submitimage' => '<input type="image" src="%s"%s>',
'image' => '<img src="%s"%s>',
'tagselfclosing' => '<%s%s>',
'css' => '<link rel="%s" href="%s"%s>',
'style' => '<style%s>%s</style>',
'charset' => '<meta charset=%s">',
'javascriptblock' => '<script%s>%s</script>',
'javascriptstart' => '<script>',
'javascriptlink' => '<script src="%s"%s></script>',
'javascriptend' => '</script>'
));
?>
66 changes: 35 additions & 31 deletions README.md
@@ -1,47 +1,56 @@
#TwitterBootstrap Plugin for CakePHP2.x

About Bootstrap, from Twitter
The TwitterBootstrap Plugin provides an easy-to-use feature Bootstrap in CakePHP2.x

[Bootstrap, from Twitter](http://twitter.github.com/bootstrap/)

[twitter/bootstrap - GitHub](https://github.com/twitter/bootstrap)

This v1.3.1 supports Bootstrap v2.0.3
This v1.3.2 supports Bootstrap v2.0.3

##Install
Add gitsubmodule
##Installation
###This plugin
Manual

$ git submodule add git://github.com/slywalker/TwitterBootstrap.git app/Plugin/TwitterBootstrap
$ git submodule update --init --recursive
- Download this plugin: [Downloads · slywalker/TwitterBootstrap](https://github.com/slywalker/TwitterBootstrap/downloads)
- Unzip that download.
- Copy the resulting folder to `app/Plugin`
- Rename the folder you just copied to `TwitterBootstrap`

or download this plugin [Downloads · slywalker/TwitterBootstrap](https://github.com/slywalker/TwitterBootstrap/downloads), and move into app/Plugin/
Submodule

###Can you use command "recess" and "uglifyjs" ?

####Yes!
$ cd /your_app_path
$ git submodule add git://github.com/slywalker/TwitterBootstrap.git Plugin/TwitterBootstrap
$ git submodule update --init --recursive

copy files less, js and img into webroot
Clone

$ cd /your/app/path
$ cake twitter_bootstrap.copy
$ cd /your_app_path/Plugin
$ git clone git://github.com/slywalker/TwitterBootstrap.git
$ cd TwitterBootstrap
$ git submodule update --init

make css/bootstrap.min.css, css/bootstrap-responsive.min.css and js/bootstrap.min.js
###Enable plugin
You need to enable the plugin your app/Config/bootstrap.php file:

$ cd /your/app/path
$ cake twitter_bootstrap.make
CakePlugin::load('Upload');

####No...
If you are already using `CakePlugin::loadAll();`, then this is not necessary.

Download files from [Bootstrap, from Twitter](http://twitter.github.com/bootstrap/), and move files to app/Plugin/TwitterBootstrap/webroot/
###bootstrap
Manual

##Configuration
- Download bootstrap: [Bootstrap, from Twitter](http://twitter.github.com/bootstrap/)
- Unzip that download.
- Copy folders(css, img, js) in the resulting folder to `app/webroot`

Add your app/Config/bootstrap.php
Shell Command (need `recess` and `uglifyjs`)

CakePlugin::load('TwitterBootstrap');
(Copy less, js, img files to webroot and make css, js files)

$ cd /your_app
$ Console/cake TwitterBootstrap.copy
$ Console/cake TwitterBootstrap.make

Controller/AppController.php
##Usage
Controller/AppController.php:

<?php
class AppController extends Controller {
Expand All @@ -55,15 +64,10 @@ Controller/AppController.php

}

##Usage

View/Layout/default.ctp
View/Layout/default.ctp:

<?php echo $this->Html->css('bootstrap.min'); ?>
<?php echo $this->Html->css('bootstrap-responsive.min'); ?>

Load JS

<?php echo $this->Html->script('bootstrap.min'); ?>

Output form input as Bootstrap format
Expand Down
9 changes: 9 additions & 0 deletions View/Helper/BootstrapHtmlHelper.php
Expand Up @@ -6,6 +6,15 @@ class BootstrapHtmlHelper extends HtmlHelper {

const ICON_PREFIX = 'icon-';

public function __construct(View $View, $settings = array()) {
parent::__construct($View, $settings);
if (!empty($settings['configFile'])) {
$this->loadConfig($settings['configFile']);
} else {
$this->loadConfig('TwitterBootstrap.html5_tags');
}
}

public function icon($class) {
$class = explode(' ', $class);
foreach ($class as &$_class) {
Expand Down

0 comments on commit 475d266

Please sign in to comment.