Sha256: 38925ba600534bf10474a2b04c2c10c8ebf92304961c4fe8a9941b83315711bf

Contents?: true

Size: 855 Bytes

Versions: 4

Compression:

Stored size: 855 Bytes

Contents

<%=
  link_to(
    path.presence || '#',
    method: path.present? && method != :get ? method : nil,
    data: { confirm_action: confirm }.merge(tooltip ? {
      'bs-trigger': 'hover',
      'bs-toggle': 'popover',
      'bs-content': title,
    } : {}),
    class: "btn #{button_class} #{float_class} #{kwargs_class}",
    **kwargs
  ) do %>
  <% if block_given %>
    <%= raw content %>
  <% else %>
    <span class="text-nowrap">
      <% if icon.present? %>
        <i class="fa-solid fa-<%= icon %>"></i>
      <% elsif type == :show %>
        <i class="fa-solid fa-magnifying-glass"></i>
      <% elsif type == :edit %>
        <i class="fa-solid fa-pen"></i>
      <% elsif type == :destroy %>
        <i class="fa-solid fa-square-xmark"></i>
      <% end %>
      <span class="button-title"><%= title %></span>
    </span>
  <% end %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_element-0.0.18 app/views/active_element/components/button.html.erb
active_element-0.0.17 app/views/active_element/components/button.html.erb
active_element-0.0.16 app/views/active_element/components/button.html.erb
active_element-0.0.15 app/views/active_element/components/button.html.erb