| 1 | package QBit::WebInterface::Controller::Form::Field::button; | ||
| 2 | $QBit::WebInterface::Controller::Form::Field::button::VERSION = '0.033'; | ||
| 3 | use qbit; | ||
| 4 | |||
| 5 | use base qw(QBit::WebInterface::Controller::Form::Field); | ||
| 6 | |||
| 7 | sub control_html { | ||
| 8 | my ($self) = @_; | ||
| 9 | |||
| 10 | my $html = '<button class="btn'; | ||
| 11 | $html .= ' btn-' . $self->{'info_type'} if defined($self->{'info_type'}); | ||
| 12 | $html .= ' btn-' . $self->{'size'} if defined($self->{'size'}); | ||
| 13 | $html .= ' disabled' if $self->{'disabled'}; | ||
| 14 | $html .= ' ' . $self->{'class'} if defined($self->{'class'}); | ||
| 15 | $html .= '"'; | ||
| 16 | |||
| 17 | $html .= ' type="' . (defined($self->{'type'}) ? $self->{'type'} : 'button') . '"'; | ||
| 18 | |||
| 19 | $html .= '>' . html_encode(ref($self->value) eq "CODE" ? $self->value->() : $self->value) . '</button>'; | ||
| 20 | |||
| 21 | return $html; | ||
| 22 | } | ||
| 23 | |||
| 24 | TRUE; |