Sha256: 605439ea319fcfd4f25391cc9cb1952f49e128bc9701c2c792ad28ec98ede41b

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

<% if view_templates.many? %>

  <%= render Spina::UserInterface::DropdownComponent.new do |dropdown| %>
    <% dropdown.button(classes: "btn btn-primary w-full") do %>
      <%= helpers.heroicon("document-plus", style: :solid, class: "w-5 h-5 -ml-1 mr-1") %>
      <%=t 'spina.pages.new' %>
    <% end %>
    
    <% dropdown.menu do %>
      <% view_templates.each do |template| %>
        <%= link_to helpers.spina.new_admin_page_path(view_template: template.name, resource_id: @resource&.id), class: "block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900", data: {turbo_frame: "modal", action: "reveal#hide"} do %>
          <div class="font-medium text-gray-700">
            <%= template.title %>
            
            <% if template.recommended %>
              <span class="text-emerald-500 text-xs"><%=t 'spina.pages.recommended' %></span>
            <% end %>
          </div>
          <div class="text-gray-400"><%= template.description %></div>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
  
<% else %>

  <%= link_to helpers.spina.new_admin_page_path(view_template: view_template.name, resource_id: resource&.id), class: "btn btn-primary w-full", data: {turbo_frame: "modal"} do %>
    <%= helpers.heroicon("document-plus", style: :solid, class: "w-5 h-5 -ml-1 mr-1") %>
    <%=t 'spina.pages.new' %>
  <% end %>
  
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spina-2.14.0 app/components/spina/pages/new_page_button_component.html.erb
spina-2.13.1 app/components/spina/pages/new_page_button_component.html.erb
spina-2.13.0 app/components/spina/pages/new_page_button_component.html.erb
spina-2.12.0 app/components/spina/pages/new_page_button_component.html.erb