blog.robotex.de

Beautiful button group toggles with rails, bootstrap 3 and haml

.btn-group{ role: :group }
  - if item.published?
    %button.btn.btn-secondary.btn-xs.disabled{ type: :button }
      %span.glyphicon.glyphicon-eye-open
    %button.btn.btn-xs.btn-disabled
      %span.glyphicon.glyphicon-ok
    = link_to(toggle_published_item_path(item), class: 'btn btn-xs btn-danger', method: :post, title: t('.unpublish')) do
      %span.glyphicon.glyphicon-eye-close
  - else
    = link_to(toggle_published_item_path(item), class: 'btn btn-xs btn-success', method: :post, title: t('.publish')) do
      %span.glyphicon.glyphicon-eye-open
    %button.btn.btn-xs.btn-disabled
      %span.glyphicon.glyphicon-remove
    %button.btn.btn-secondary.btn-xs.disabled{ type: :button }
      %span.glyphicon.glyphicon-eye-close

Back