See also: http://twitter.github.com/bootstrap/
Author: Patrick Talmadge - (ptalmadge@gmail.com)
Author: Maxime Fabre - (ehtnam6@gmail.com)
Author: Patrick Rose - (pjr0911025@googlemail.com)
Author: Marvin Schröder - (marvinschroeder85@gmail.com)
Inheritance: extends Illuminate\Support\Facades\Facade
 function it_can_be_given_contents_as_an_array(Form $form)
 {
     $form->label('first', 'First')->willReturn('label1');
     $form->checkbox('first', 'First')->willReturn('checkbox1');
     $form->label('second', 'Second')->willReturn('label2');
     $form->checkbox('second', 'Second')->willReturn('checkbox2');
     $this->withContents([['label' => ['first', 'First'], 'input' => ['type' => 'checkbox', 'first', 'First']], ['label' => ['second', 'Second'], 'input' => ['type' => 'checkbox', 'second', 'Second']]])->render()->shouldBe("<div class='form-group'>label1 checkbox1<br />label2 checkbox2<br /></div>");
 }
 /**
  * Creates a DropdownButton.
  *
  * @param  string  $type
  * @param  string  $value
  * @param  array   $list
  * @param  array   $attributes
  * @param  bool    $right
  * @param  bool    $dropup
  * @param  bool    $autoroute
  * @return string
  */
 protected static function show($type, $value, $list, $attributes = array(), $right = false, $dropup = false, $autoroute = true)
 {
     $attributes = Helpers::add_class($attributes, 'btn-group');
     $list_attr = array();
     if ($right) {
         $list_attr['class'] = 'pull-right';
     }
     if ($dropup) {
         $attributes['class'] .= ' dropup';
     }
     $html = '<div' . HTML::attributes($attributes) . '>';
     $html .= Form::button($value, array('class' => $type), true);
     $html .= Navigation::dropdown($list, $list_attr, $autoroute);
     $html .= '</div>';
     return $html;
 }
Beispiel #3
0
 /**
  * Checks if macro is registered.
  *
  * @param string $name
  * @return bool 
  * @static 
  */
 public static function hasMacro($name)
 {
     //Method inherited from \Illuminate\Html\FormBuilder
     return \Bootstrapper\Form::hasMacro($name);
 }
 /**
  * Outputs the current Dropdown in instance
  *
  * @return string A Dropdown menu
  */
 public function __toString()
 {
     // Base class
     $this->attributes = Helpers::add_class($this->attributes, 'btn-group');
     // Pull right
     $listAttributes = $this->pullRight ? array('class' => 'pull-right') : array();
     // Dropup
     if ($this->dropup) {
         $this->attributes['class'] .= ' dropup';
     }
     $html = '<div' . HTML::attributes($this->attributes) . '>';
     //If split is false make this button dropdown
     $html .= Form::button($this->label, array('class' => $this->type), !$this->split);
     //Add split button if needed
     if ($this->split) {
         $html .= Form::button('', array('class' => $this->type), true);
     }
     $html .= Navigation::dropdown($this->links, $listAttributes, $this->autoroute);
     $html .= '</div>';
     return $html;
 }
 /**
  * Registers the FormBuilder class into the IoC
  */
 private function registerFormBuilder()
 {
     $this->app->bind('bootstrapper::form', function ($app) {
         $form = new Form($app->make('html'), $app->make('url'), $app['session.store']->getToken());
         return $form->setSessionStore($app['session.store']);
     }, true);
 }
 public function testMacro()
 {
     Form::macro('foo', function () {
         return '<article type="bar">';
     });
     $html = Form::foo();
     $expected = '<article type="bar">';
     $this->assertEquals($expected, $html);
 }
Beispiel #7
0
 /**
  *
  */
 public function crudControls($target = null, $id = null, $extras = array())
 {
     // Edit Button
     $html = Button::sm_primary_link("{$target}/edit/{$id}", '<span class="icon-pencil icon-white">', array('class' => 'ui-tooltip', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Alterar')) . "&nbsp;" . Form::open(array('url' => "{$target}/remove/{$id}", 'method' => 'delete', 'style' => 'display: inline')) . Button::sm_danger_submit('<span class="icon-remove icon-white">', array('class' => 'ui-tooltip', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Excluir')) . Form::close();
     return $html;
 }
Beispiel #8
0
    public function testCreateFullControlGroupWithOffsets()
    {
        $matcher = array(
            'tag' => 'div',
            'attributes' => array('class' => 'col-sm-2'),
            'child' => array(
                'tag' => 'label',
                'attributes' => array('for' => 'inputfoo'),
                'content' => 'foo',
            ),
            'parent' => array(
                'tag' => 'div',
                'attributes' => array('class' => 'form-group'),
                'child' => array(
                    'tag' => 'div',
                    'attributes' => array('class' => 'col-sm-10'),
                    'child' => array(
                        'tag' => 'input',
                        'attributes' => array(
                            'type' => 'text',
                            'name' => 'inputfoo',
                            'id' => 'inputfoo',
                            'class' => 'form-control'
                        ),
                    ),
                    'descendant' => array(
                        'tag' => 'span',
                        'attributes' => array(
                            'class' => 'help-block'
                        ),
                        'content' => 'You foobared that!',
                    ),
                ),
            ),
        );

        $html = Form::control_group(
            Form::label('inputfoo', 'foo'),
            Form::text('inputfoo'),
            null,
            Form::block_help('You foobared that!'),
            2
        );

        $this->assertHTML($matcher, $html);
    }
 public function registerFormBuilder()
 {
     $this->app->bindShared('bootstrapper::form', function ($app) {
         $form = new Form($app['html'], $app['url'], $app['session.store']->getToken());
         return $form->setSessionStore($app['session.store']);
     });
 }
Beispiel #10
0
 public static function navTree()
 {
     $data = Header::navigationdata();
     $view = '';
     foreach ($data as $key => $content) {
         $view .= '<li ><ul class="nav nav-list">';
         $view .= '<li class="nav-header" style="height:30px"><i class="icon-hdd"></i>&nbsp;' . Str::upper($content['header']);
         $view .= '<div class="form-inline pull-right" >';
         $view .= '<a href="#" onclick="deleteModule(' . $content['moduleid'] . ')" style="margin-bottom:10px;margin-left:5px;"><i class="icon-remove alert-error"></i></a>';
         //<em><small>Remove Module</small></em>
         $view .= '</div>';
         $view .= Form::hidden('module[]', $content['moduleid']);
         $view .= '</li>';
         if (!empty($content['parent']) || isset($content['parent'])) {
             $view .= '<li ><ul id="sortparent" class="nav nav-list connectedparent" style="padding-right:0px">';
             foreach ($content['parent'] as $parentkey => $parentcontent) {
                 $view .= '<li style="height:30px" ><i class="icon-arrow-right"></i>&nbsp;' . Str::title($parentcontent['alias']);
                 $view .= '<div class="form-inline pull-right">';
                 $view .= '<a href="#" onclick="addchildpages(' . $parentcontent['pageid'] . ')" data-toggle="modal" style="margin-bottom:10px;margin-left:5px;"><i class="icon-plus"></i></a>';
                 //<em><small>Add Sub Page</small></em>
                 $view .= '<a href="#" onclick="deletePage(' . $parentcontent['pageid'] . ')" style="margin-bottom:10px;margin-left:5px;"><i class="icon-remove alert-error"></i></a>';
                 //<em><small>Remove Page</small></em>
                 $view .= '</div>';
                 $view .= Form::hidden('parent[]', $parentcontent['pageid']);
                 $view .= '</li>';
                 if (!empty($parentcontent['child'])) {
                     $view .= '<li ><ul id="sortchild" class="nav nav-list connectedchild" style="padding-right:0px">';
                     foreach ($parentcontent['child'] as $childkey => $childvalue) {
                         $view .= '<li style="height:30px" ><i class="icon-arrow-right"></i>&nbsp;' . Str::title($childvalue['alias']);
                         $view .= '<div class="form-inline pull-right">';
                         $view .= '<a href="#" onclick="deletePage(' . $childvalue['childid'] . ')" style="margin-bottom:10px;margin-left:5px;"><i class="icon-remove alert-error"></i></a>';
                         //<em><small>Remove Sub Page</small></em>
                         $view .= '</div>';
                         $view .= '</li>';
                     }
                     $view .= '</ul></li>';
                 }
             }
             $view .= '</ul></li>';
         }
         $view .= '</ul></li>';
     }
     return $view;
 }