Sha256: 4bb290b0b624752454ebdca6986e88fe7f17ec1e59bccbb6faa667acdf68e234

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

<%
  # headmin/card
  #
  # ==== Options
  # * <tt>title</tt> - Title for card
  # * <tt>description</tt> - Description for card
  # * <tt>id</tt> - HTML Id Attribute
  # * <tt>padded</tt> - Set to true if you want to render the block content inside the card-body element
  #
  # ==== Examples
  #   Basic version.
  #   <%= render 'headmin/card' do %#>
  #      Your content
  #   <% end %#>
  #
  #   Title and description
  #   <%= render 'headmin/card', title: 'Title', description: 'Description' do %#>
  #      Your content
  #   <% end %#>

  id = local_assigns.has_key?(:id) ? id : nil
  title = local_assigns.has_key?(:title) ? title : nil
  description = local_assigns.has_key?(:description) ? description : nil
  padded = local_assigns.has_key?(:padded) ? padded : true
%>

<div class="card mb-3 shadow-sm" id="<%= id %>">

  <% if padded || title || description %>
    <div class="card-body">
      <% if title.present? %>
        <h5 class="card-title"><%= title %></h5>
      <% end %>

      <% if description.present? %>
        <p class="card-text text-secondary"><%= description %></p>
      <% end %>

      <!-- Render inside body-->
      <% if padded %>
        <%= yield if block_given? %>
      <% end %>
    </div>
  <% end %>

  <!-- Render outside body-->
  <% unless padded %>
    <%= yield if block_given? %>
  <% end %>
</div>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.2.9 app/views/headmin/_card.html.erb
headmin-0.2.8 app/views/headmin/_card.html.erb