Sha256: 13bd14cfb360279c3a0b8f12d0cd6ff2dc83f7fb01e120f9b821fb77ef270efa
Contents?: true
Size: 896 Bytes
Versions: 3
Compression:
Stored size: 896 Bytes
Contents
# frozen_string_literal: true module PagesCore module Admin module ContentTabsHelper def content_tabs @content_tabs ||= [] end def content_tabs? content_tabs.any? end def content_tab(name, options = {}, &block) 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.push(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}", role: "tabpanel", data: { tab: key, "main-target" => "tab" }) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems