function it_can_be_made_a_checkbox_with_attributes()
 {
     $buttonLeft = new Button();
     $buttonLeft->danger('Left')->withAttributes(['data-foo' => 'bar']);
     $buttonMiddle = new Button();
     $buttonMiddle->danger('Middle')->withAttributes(['data-foo' => 'bar']);
     $buttonRight = new Button();
     $buttonRight->danger('Right');
     $this->checkbox([$buttonLeft, $buttonMiddle, $buttonRight])->render()->shouldBe("<div class='btn-group' data-toggle='buttons'><label class='btn btn-danger'><input type='checkbox' data-foo='bar'>Left</label><label class='btn btn-danger'><input type='checkbox' data-foo='bar'>Middle</label><label class='btn btn-danger'><input type='checkbox'>Right</label></div>");
 }
 function it_can_be_made_a_radio()
 {
     $buttonLeft = new Button();
     $buttonLeft->danger('Left');
     $buttonMiddle = new Button();
     $buttonMiddle->danger('Middle');
     $buttonRight = new Button();
     $buttonRight->danger('Right');
     $this->radio([$buttonLeft, $buttonMiddle, $buttonRight])->render()->shouldBe("<div class='btn-group' data-toggle='buttons'><label class='btn btn-danger'><input type='radio'>Left</label><label class='btn btn-danger'><input type='radio'>Middle</label><label class='btn btn-danger'><input type='radio'>Right</label></div>");
 }
Exemple #3
0
 public function withButton(Button $button = null)
 {
     if ($button) {
         $this->button = $button;
     } else {
         $button = new Button();
         $this->button = $button->withValue('Open Modal');
     }
     return $this;
 }
Exemple #4
0
 /**
  * Adds the given classes to attributes
  *
  * @param array $classes
  * @return $this 
  * @static 
  */
 public static function addClass($classes)
 {
     //Method inherited from \Bootstrapper\RenderedObject
     return \Bootstrapper\Button::addClass($classes);
 }
Exemple #5
0
 /**
  * Create a HTML button element.
  * Overriding the default button to add the correct class from Laravel\Form
  *
  * @param string $value text value of button
  * @param array $attributes array of attributes for button
  * @param bool $hasDropdown button has dropdown
  *
  * @return string
  */
 public static function button($value = null, $attributes = array(), $hasDropdown = false)
 {
     return Button::normal($value, $attributes, $hasDropdown);
 }
 function it_allows_you_to_activate_several_links()
 {
     $buttonLeft = new Button();
     $buttonLeft->danger('Left')->withAttributes(['data-foo' => 'bar']);
     $buttonMiddle = new Button();
     $buttonMiddle->danger('Middle')->withAttributes(['data-foo' => 'bar']);
     $buttonRight = new Button();
     $buttonRight->danger('Right');
     $this->checkbox([$buttonLeft, $buttonMiddle, $buttonRight])->activate([1, 2])->render()->shouldBe("<div class='btn-group' data-toggle='buttons'><label class='btn btn-danger active'><input type='checkbox' data-foo='bar'>Left</label><label class='btn btn-danger active'><input type='checkbox' data-foo='bar'>Middle</label><label class='btn btn-danger'><input type='checkbox'>Right</label></div>");
 }
 public function testActionBar()
 {
     $html = Form::actions(array(Button::primary_submit('Save changes'), Form::button('Cancel')));
     $matcher = array('tag' => 'div', 'attributes' => array('class' => 'form-actions'), 'child' => array('tag' => 'button', 'attributes' => array('class' => 'btn-primary btn', 'type' => 'submit'), 'content' => 'Save changes'), 'descendant' => array('tag' => 'button', 'attributes' => array('class' => 'btn', 'type' => 'button'), 'content' => 'Cancel'));
     $this->assertTag($matcher, $html);
 }
Exemple #8
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;
 }
Exemple #9
0
    public function testMultipleButtons()
    {
        $buttons = Button::info('foo') . Button::success('foo');
        $matcher = '<button class="btn-info btn" type="button">foo</button><button class="btn-success btn" type="button">foo</button>';

        $this->assertEquals($matcher, $buttons);
    }
Exemple #10
0
 function it_allows_you_to_customise_the_button()
 {
     $button = new Button();
     $this->named('foo')->withButton($button->primary()->withValue('open'))->render()->shouldBe("<button type='button' class='btn btn-primary' data-toggle='modal' data-target='#foo'>open</button><div class='modal' id='foo'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button></div></div></div></div>");
 }