Skip to content

Commit 8ae20aa

Browse files
committed
Refactored Documentation
1 parent 51ad091 commit 8ae20aa

18 files changed

+575
-431
lines changed

README.md

+26-353
Large diffs are not rendered by default.

Resources/doc/1-installation.md

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
Installation
2+
============
3+
4+
Prerequisites
5+
-------------
6+
7+
### Less (recommended)
8+
9+
Less is not required, but is extremely helpful when using bootstrap2 variables, or mixins,
10+
If you want to have a easier life, have a look into:
11+
If you do not have less installed, currently you have several option, but please do NOT ask for help.
12+
13+
[Less Documentation](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/doc/less-installation.md)
14+
15+
Installation
16+
------------
17+
18+
1. Add this bundle to your project in composer.json:
19+
20+
1.2. Plain BootstrapBundle
21+
symfony 2.1 uses composer (http://www.getcomposer.org) to organize dependencies:
22+
23+
```json
24+
{
25+
"require": {
26+
"mopa/bootstrap-bundle": "dev-master",
27+
}
28+
}
29+
```
30+
1.2. BootstrapBundle and twitters bootstrap
31+
32+
To have composer managing twitters bootstrap too, you can either run it with
33+
--install-suggests or add the following to your composer.json:
34+
35+
```json
36+
{
37+
"require": {
38+
"mopa/bootstrap-bundle": "dev-master",
39+
"twitter/bootstrap": "master"
40+
},
41+
"repositories": [
42+
{
43+
"type": "package",
44+
"package": {
45+
"version": "master", /* whatever version you want */
46+
"name": "twitter/bootstrap",
47+
"source": {
48+
"url": "https://github.com/twitter/bootstrap.git",
49+
"type": "git",
50+
"reference": "master"
51+
},
52+
"dist": {
53+
"url": "https://github.com/twitter/bootstrap/zipball/master",
54+
"type": "zip"
55+
}
56+
}
57+
}
58+
]
59+
}
60+
```
61+
62+
1.3. BootstrapBundle, twitters bootstrap and further suggests
63+
64+
```json
65+
{
66+
"require": {
67+
"mopa/bootstrap-bundle": "dev-master",
68+
"twitter/bootstrap": "master",
69+
"knplabs/knp-paginator-bundle": "dev-master",
70+
"knplabs/knp-menu-bundle": "dev-master",
71+
"craue/formflow-bundle": "dev-master"
72+
},
73+
"repositories": [
74+
{
75+
"type": "package",
76+
"package": {
77+
"version": "master", /* whatever version you want */
78+
"name": "twitter/bootstrap",
79+
"source": {
80+
"url": "https://github.com/twitter/bootstrap.git",
81+
"type": "git",
82+
"reference": "master"
83+
},
84+
"dist": {
85+
"url": "https://github.com/twitter/bootstrap/zipball/master",
86+
"type": "zip"
87+
}
88+
}
89+
}
90+
]
91+
}
92+
```
93+
94+
1.4. BootstrapBundle, twitters bootstrap and automatic symlinking
95+
96+
If you decided to let composer install twitters bootstrap, you might want to activate auto symlinking and checking, after composer update/install.
97+
So add this to your existing scripts section in your composer json:
98+
(recommended!)
99+
100+
```json
101+
{
102+
"scripts": {
103+
"post-install-cmd": [
104+
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
105+
],
106+
"post-update-cmd": [
107+
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
108+
]
109+
}
110+
}
111+
```
112+
113+
There is also a console command to check and / or install this symlink:
114+
115+
```bash
116+
php app/console mopa:bootstrap:install
117+
```
118+
119+
With these steps taken, bootstrap should be install into vendor/twitter/bootstrap/ and a symlink
120+
been created into vendor/mopa/bootstrap-bundle/Mopa/BootstrapBundle/Resources/bootstrap.
121+
122+
1.5. Include bootstrap manually or in another way:
123+
124+
For including bootstrap there are different solutions, why using this one?
125+
have a look into [Including Bootstrap](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/doc/including-bootstrap.md)
126+
127+
2. Add this bundle to your app/AppKernel.php:
128+
129+
``` php
130+
// application/ApplicationKernel.php
131+
public function registerBundles()
132+
{
133+
return array(
134+
// ...
135+
new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
136+
// ...
137+
);
138+
}
139+
```
140+
141+
2.1. If you decided to add knp-menu-bundle, knp-paginator-bundle, or craue-formflow-bundle add them too:
142+
143+
``` php
144+
// application/ApplicationKernel.php
145+
public function registerBundles()
146+
{
147+
return array(
148+
// ...
149+
new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
150+
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
151+
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
152+
new Craue\FormFlowBundle\CraueFormFlowBundle(),
153+
// ...
154+
);
155+
}
156+
```
157+
158+
3. If you like configure your config.yml (not mandatory)
159+
160+
``` yaml
161+
mopa_bootstrap:
162+
form:
163+
show_legend: false # default is true
164+
show_child_legend: false # default is true
165+
error_type: block # or inline which is default
166+
```
167+

Resources/doc/2-base-templates.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Using bootstrap in the layout
2+
=============================
3+
4+
Prerequisites
5+
-------------
6+
7+
### Less (recommended)
8+
9+
Less is not required, but is extremely helpful when using bootstrap2 variables, or mixins,
10+
If you want to have a easier life, have a look into:
11+
12+
[Less Documentation](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/doc/less-installation.md)
13+
14+
Templates
15+
---------
16+
17+
Have a look at the provided [base.html.twig](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/views/layout.html.twig) its a fully working bootstrap layout and might explain howto use it by itself.
18+
19+
There is also a [base_lessjs.html.twig](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/views/base_lessjs.html.twig) with clientside less.js. This is currently not recommended, because you need to setup bootstrap and the less files to use it yourself.
20+
21+
There is also a [base_css.html.twig](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/views/base_css.html.twig) for usage without less.
22+
Have a look into https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/doc/css-vs-less.md
23+
24+
25+
Usage
26+
-----
27+
28+
To make use of the supplied base.html.twig template just use it, or
29+
defining a new template:
30+
31+
app/Resources/MopaBootstrapBundle/views/layout.html.twig
32+
33+
```jinja
34+
{% extends 'MopaBootstrapBundle::base.html.twig' %}
35+
36+
{% block title %}Yourapp{% endblock %}
37+
38+
{# and define more blocks ... #}
39+
40+
```
41+
42+
You are free to overwrite any defined blocks.
43+
Have a look into the sandbox too:
44+
45+
* http://bootstrap.mohrenweiserpartner.de/mopa/bootstrap/layout
46+
* https://github.com/phiamo/symfony-bootstrap-sandbox/blob/master/app/Resources/MopaBootstrapBundle/views/layout.html.twig
47+
48+
If you are using less just include the mopabootstrap.less as described in layout.html.twig
49+
50+
``` jinja
51+
{% stylesheets filter='less,cssrewrite,?yui_css'
52+
'@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less'
53+
'@YourNiceBundle/Resources/public/less/*'
54+
%}
55+
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
56+
{% endstylesheets %}
57+
```
58+
59+
If you would like to use the css try this:
60+
61+
```bash
62+
cd vendor/mopa/bootstrap-bundle/Mopa/BootstrapBundle/Resources/bootstrap
63+
make
64+
```
65+
if it doesnt work, why not use the less way?
66+
67+
``` jinja
68+
{% block head_style %}
69+
{% stylesheets filter='cssrewrite,?yui_css'
70+
'@MopaBootstrapBundle/Resources/bootstrap/bootstrap.css'
71+
'@YourNiceBundle/Resources/public/css/*'
72+
%}
73+
<link href="{{ asset_url }}" type="text/css" rel="stylesheet"
74+
media="screen" />
75+
{% endstylesheets %}

0 commit comments

Comments
 (0)