Sha256: a31b74eb9c3a065046465ccf0560de43e3104799afdd17b2caca9825ad9d4992

Contents?: true

Size: 942 Bytes

Versions: 8

Compression:

Stored size: 942 Bytes

Contents

<%
  # headmin/popup
  #
  # ==== Options
  # * +id</tt> - Identifier for this popup
  #
  # ==== Examples
  #   To trigger this popup create an element with a data attribute like this
  #
  #   <button data-popup-id="popupId">open Popup</button>
  #   <%= render 'headmin/popup', id: 'popupId' do %#>
  #     popup Content
  #   <% end %#>
  #
  #   If you want to pass a click event to an element inside the popup without opening the popup you can use the
  #   "data-popup-pass-thru" attribute.
  #
  #   <button data-popup-id="popupId" data-popup-pass-thru="#link">open Popup</button>
  #   <%= render 'headmin/popup', id: 'popupId' do %#>
  #     <a href="https://example.com" id="link">
  #   <% end %#>
  data = local_assigns.has_key?(:data) ? data : {}

  options = {
    class: ['h-popup', 'closed'],
    data: data.merge('popup-target': 'popup', 'popup-id': id)
  }
%>

<%= content_tag(:div, options) do %>
  <%= yield %>
<% end %>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
headmin-0.5.2 app/views/headmin/_popup.html.erb
headmin-0.4.2 app/views/headmin/_popup.html.erb
headmin-0.4.1 app/views/headmin/_popup.html.erb
headmin-0.4.0 app/views/headmin/_popup.html.erb
headmin-0.3.4 app/views/headmin/_popup.html.erb
headmin-0.3.3 app/views/headmin/_popup.html.erb
headmin-0.3.2 app/views/headmin/_popup.html.erb
headmin-0.3.1 app/views/headmin/_popup.html.erb