Sha256: 9774874be693d5d69b191843d61e47a349cfa11cbe18cff29f9df920f5de7819

Contents?: true

Size: 765 Bytes

Versions: 13

Compression:

Stored size: 765 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  module Admin
    module ContentTabsHelper
      def content_tab(name, options = {}, &block)
        @content_tabs ||= []
        return unless block_given?

        tab = {
          name: name.to_s.humanize,
          key: options[:key] || name.to_s.underscore.gsub(/\s+/, "_"),
          options: options,
          content: capture(&block)
        }
        @content_tabs << tab
        content_tab_tag(tab[:key], tab[:content])
      end

      private

      def content_tab_tag(key, content)
        tag.div(content,
                class: "content-tab",
                id: "content-tab-#{key}",
                data: { tab: key,
                        "main-target" => "tab" })
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pages_core-3.11.3 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.11.2 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.11.1 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.11.0 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.10.2 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.10.1 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.9.2 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.9.1 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.9.0 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.8.3 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.8.2 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.8.1 app/helpers/pages_core/admin/content_tabs_helper.rb
pages_core-3.8.0 app/helpers/pages_core/admin/content_tabs_helper.rb