Sha256: 17e352bc402b63834a0df4fc8d90b66d69d5b749c5f877e082b87151e7deeb50

Contents?: true

Size: 855 Bytes

Versions: 12

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Admin
    module LinkDialog
      class Tabs < ViewComponent::Base
        erb_template <<~ERB
          <sl-tab-group id="overlay_tabs">
            <% tabs.each do |tab| %>
              <%= render tab.new(@url, is_selected: is_selected?(tab), link_title: @link_title, link_target: @link_target) %>
            <% end %>
          </sl-tab-group>
        ERB

        def initialize(**options)
          options.symbolize_keys!
          @url = options[:url]
          @selected_tab = options[:selected_tab]
          @link_title = options[:link_title]
          @link_target = options[:link_target]
        end

        def is_selected?(tab)
          @selected_tab&.to_sym == tab.panel_name
        end

        def tabs
          Alchemy.link_dialog_tabs
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
alchemy_cms-7.3.4 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.3.3 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.3.2 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.7 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.3.1 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.3.0 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.6 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.5 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.4 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.3 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.2 app/components/alchemy/admin/link_dialog/tabs.rb
alchemy_cms-7.2.1 app/components/alchemy/admin/link_dialog/tabs.rb