Sha256: e3804edb9b3fecbc0bbb3ccc483ce4638c70aaefd3caf95c70ef609a02e9288b

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 KB

Contents

<%
  helper = Scrapbook::HelperForView.new(self)
  listing = Scrapbook::FolderListingViewModel.new(self, scrapbook, pathname)
  pathname_without_handler_exts = helper.remove_handler_exts_from(pathname)
  indentation_depth = (local_assigns[:nav_depth] || listing.depth) + 1
  selection_classes = "active:bg-sky-200 hover:bg-sky-50 [&:has([aria-current=page])]:bg-sky-100"
%>
<% unless listing.root? %><%= link_to "‹ #{listing.parent_display_name}", helper.short_path_to(listing.pathname.parent, scrapbook), class: 'back-to-parent block w-100' %><% end %>
<header aria-label="Which folder's contents" class="text-2xl !px-0 children:px-4 <%= selection_classes %>">
  <%= helper.nav_link_for(scrapbook: scrapbook, pathname: listing.pathname, is_current: pathname == listing.pathname) %>
</header>
<turbo-frame id="path_<%= pathname.hash %>">
  <ul aria-label="Sub-folders">
  <% listing.folders.each do |folder| %>
    <li>
      <details>
        <summary class="flex <%= selection_classes %>" style="padding-left: <%= indentation_depth %>rem;">
          <%= helper.nav_link_for(scrapbook: scrapbook, pathname: folder, class: 'grow') %>
        </summary>
        <turbo-frame id="path_<%= folder.hash %>" src="<%= helper.short_path_to(folder, scrapbook) %>" loading="lazy"></turbo-frame>
      </details>
    </li>
  <% end %>
  </ul>
  <ul aria-label="Sub-files">
  <% listing.files.each do |file| %><% next if listing.folders.include?(file) %>
    <li class="<%= selection_classes %>"><%= helper.nav_link_for(scrapbook: scrapbook, pathname: file, is_current: file == pathname_without_handler_exts, depth: indentation_depth) %></li>
  <% end %>
  </ul>
</turbo-frame>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scrapbook-0.3.2 app/views/layouts/scrapbook/_folder_listing.html.erb
scrapbook-0.3.1 app/views/layouts/scrapbook/_folder_listing.html.erb
scrapbook-0.3.0 app/views/layouts/scrapbook/_folder_listing.html.erb