Sha256: 605c6983ecefe79434889c0275a28446e33a85dc5ee01677d3899b1fcb342e7b

Contents?: true

Size: 942 Bytes

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.5.1 app/views/headmin/_popup.html.erb
headmin-0.5.0 app/views/headmin/_popup.html.erb