Sha256: cacb645f5ec9b811ff00a41c847c0ba4d90cb44e0131abf2be2abec3e46bf436

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module RailsDevtools
  class ImageAssets::Index < ApplicationView
    def initialize(form:, images_by_folder: {})
      @images_by_folder = images_by_folder
      @form = form
    end

    def view_template
      render Components::PageContent.new do |page|
        page.page_title { "Image assets" }
        page.search_form(form: @form, path: helpers.image_assets_path)
        page.results { results }
      end
    end

    private

    def results
      if @images_by_folder.empty?
        div(class: "text-neutral") { "No results found" }
      else
        div(class: "flex flex-col gap-12") do
          @images_by_folder.each do |folder, images|
            div do
              h3(class: "text-lg font-bold mb-4 truncate") { folder }
              div(class: "flex gap-4 flex-wrap w-full items-start") do
                images.each do |image_info|
                  render ImageAssets::ImageCard.new(image_info: image_info)
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_devtools-0.1.3 app/views/rails_devtools/image_assets/index.rb
rails_devtools-0.1.2 app/views/rails_devtools/image_assets/index.rb
rails_devtools-0.1.1 app/views/rails_devtools/image_assets/index.rb
rails_devtools-0.1.0 app/views/rails_devtools/image_assets/index.rb