Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
Yii Bootstrap 3
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Common
Yii Bootstrap 3
Commits
e1a97fc3
Commit
e1a97fc3
authored
Jul 29, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tabular form example to the demo
parent
50918f73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
4 deletions
+107
-4
SiteController.php
demo/protected/controllers/SiteController.php
+22
-0
_tabular.php
demo/protected/views/site/_tabular.php
+14
-0
index.php
demo/protected/views/site/index.php
+71
-4
No files found.
demo/protected/controllers/SiteController.php
View file @
e1a97fc3
...
...
@@ -145,4 +145,26 @@ class SiteController extends Controller
$this
->
render
(
'error'
,
$error
);
}
}
public
function
getTabularFormTabs
(
$form
,
$model
)
{
$tabs
=
array
();
$count
=
0
;
foreach
(
array
(
'en'
=>
'English'
,
'fi'
=>
'Finnish'
,
'sv'
=>
'Swedish'
)
as
$locale
=>
$language
)
{
$tabs
[]
=
array
(
'active'
=>
$count
++
===
0
,
'label'
=>
$language
,
'content'
=>
$this
->
renderPartial
(
'_tabular'
,
array
(
'form'
=>
$form
,
'model'
=>
$model
,
'locale'
=>
$locale
,
'language'
=>
$language
,
),
true
),
);
}
return
$tabs
;
}
}
demo/protected/views/site/_tabular.php
0 → 100644
View file @
e1a97fc3
<fieldset>
<legend>
<?php
echo
CHtml
::
encode
(
$language
);
?>
translation
</legend>
<?php
echo
$form
->
textFieldRow
(
$model
,
"[
{
$locale
}
]textField"
);
?>
<?php
echo
$form
->
textAreaRow
(
$model
,
"[
{
$locale
}
]textarea"
,
array
(
'class'
=>
'span8'
,
'rows'
=>
8
));
?>
<?php
echo
$form
->
checkBoxListRow
(
$model
,
"[
{
$locale
}
]checkboxes"
,
array
(
'Option one is this and that—be sure to include why it\'s great'
,
'Option two can also be checked and included in form results'
,
'Option three can—yes, you guessed it—also be checked and included in form results'
,
),
array
(
'hint'
=>
'<strong>Note:</strong> Labels surround all the options for much larger click areas.'
));
?>
</fieldset>
\ No newline at end of file
demo/protected/views/site/index.php
View file @
e1a97fc3
...
...
@@ -762,8 +762,8 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</fieldset>
<div
class=
"form-actions"
>
<?php
$this
->
widget
(
'bootstrap.widgets.TbButton'
,
array
(
'buttonType'
=>
'submit'
,
'type'
=>
'primary'
,
'
icon'
=>
'ok white'
,
'
label'
=>
'Submit'
));
?>
<?php
$this
->
widget
(
'bootstrap.widgets.TbButton'
,
array
(
'buttonType'
=>
'reset'
,
'
icon'
=>
'remove'
,
'
label'
=>
'Reset'
));
?>
<?php
$this
->
widget
(
'bootstrap.widgets.TbButton'
,
array
(
'buttonType'
=>
'submit'
,
'type'
=>
'primary'
,
'label'
=>
'Submit'
));
?>
<?php
$this
->
widget
(
'bootstrap.widgets.TbButton'
,
array
(
'buttonType'
=>
'reset'
,
'label'
=>
'Reset'
));
?>
</div>
<?php
$this
->
endWidget
();
?>
...
...
@@ -805,14 +805,81 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</fieldset>
<div class=
\"
form-actions
\"
>
<?php
\$
this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', '
icon'=>'ok white', '
label'=>'Submit')); ?>
<?php
\$
this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', '
icon'=>'remove', '
label'=>'Reset')); ?>
<?php
\$
this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Submit')); ?>
<?php
\$
this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Reset')); ?>
</div>
<?php
\$
this->endWidget(); ?>"
);
?>
<a
class=
"top"
href=
"#top"
>
Back to top
↑
</a>
<h3>
Tabular
</h3>
<?php
/** @var TbActiveForm $form */
$form
=
$this
->
beginWidget
(
'bootstrap.widgets.TbActiveForm'
,
array
(
'id'
=>
'horizontalForm'
,
'type'
=>
'horizontal'
,
));
?>
<?php
$this
->
widget
(
'bootstrap.widgets.TbTabbable'
,
array
(
'tabs'
=>
$this
->
getTabularFormTabs
(
$form
,
$model
),
));
?>
<div
class=
"form-actions"
>
<?php
$this
->
widget
(
'bootstrap.widgets.TbButton'
,
array
(
'buttonType'
=>
'submit'
,
'type'
=>
'primary'
,
'label'
=>
'Submit'
));
?>
<?php
$this
->
widget
(
'bootstrap.widgets.TbButton'
,
array
(
'buttonType'
=>
'reset'
,
'label'
=>
'Reset'
));
?>
</div>
<?php
$this
->
endWidget
();
?>
<h4>
Source code
</h4>
<?php
echo
$phpLighter
->
highlight
(
"<?php /** @var TbActiveForm
\$
form */
\$
form =
\$
this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'horizontalForm',
'type'=>'horizontal',
)); ?>
<?php
\$
this->widget('bootstrap.widgets.TbTabbable', array(
'tabs'=>
\$
this->getTabularFormTabs(
\$
form,
\$
model),
)); ?>
<div class=
\"
form-actions
\"
>
<?php
\$
this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Submit')); ?>
<?php
\$
this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Reset')); ?>
</div>
<?php
\$
this->endWidget(); ?>"
);
?>
<?php
echo
$phpLighter
->
highlight
(
"public function getTabularFormTabs(
\$
form,
\$
model)
{
\$
tabs = array();
\$
count = 0;
foreach (array('en'=>'English', 'fi'=>'Finnish', 'sv'=>'Swedish') as
\$
locale =>
\$
language)
{
\$
tabs[] = array(
'active'=>
\$
count++ === 0,
'label'=>
\$
language,
'content'=>
\$
this->renderPartial('_tabular', array('form'=>
\$
form, 'model'=>
\$
model, 'locale'=>
\$
locale, 'language'=>
\$
language), true),
);
}
return
\$
tabs;
}"
);
?>
<?php
echo
$phpLighter
->
highlight
(
"<fieldset>
<legend><?php echo CHtml::encode(
\$
language); ?> translation</legend>
<?php echo
\$
form->textFieldRow(
\$
model,
\"
[
{
\$locale
}
]textField
\"
); ?>
<?php echo
\$
form->textAreaRow(
\$
model,
\"
[
{
\$locale
}
]textarea
\"
, array('class'=>'span8', 'rows'=>8)); ?>
<?php echo
\$
form->checkBoxListRow(
\$
model,
\"
[
{
\$locale
}
]checkboxes
\"
, array(
'Option one is this and that—be sure to include why it\'s great',
'Option two can also be checked and included in form results',
'Option three can—yes, you guessed it—also be checked and included in form results',
), array('hint'=>'<strong>Note:</strong> Labels surround all the options for much larger click areas.')); ?>
</fieldset>"
);
?>
</section>
<section
id=
"tbButton"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment