Sha256: f8f63ed54abebc976ca3db5398b7590127f49aa0d5406d5bc42df206077b5a19

Contents?: true

Size: 1.7 KB

Versions: 32

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

module Satis
  module Tab
    class Component < Satis::ApplicationComponent
      attr_reader :name, :icon, :badge, :id, :tab_menu, :menu,
                  :selected, :dirty, :padding, :title, :responsive, :options, :selected_tab_index

      def initialize(name = nil,
                     icon: nil,
                     badge: nil,
                     id: nil,
                     tab_menu: nil,
                     menu: nil,
                     padding: false,
                     dirty: false,
                     title: nil,
                     responsive: false,
                     options: nil,
                     selected_tab_index: nil,
                     selected: false,
                     &block)
        super

        @name = name
        @icon = icon
        @id = id || name.to_s.underscore
        @badge = badge
        @padding = padding
        @dirty = dirty
        @title = title
        @responsive = responsive
        @selected = selected

        @menu = menu
        # FIXME: Obsolete these
        if tab_menu.present?
          @menu ||= tab_menu
          ActiveSupport::Deprecation.warn('Calling tab with the tab_menu parameter, use menu instead')
        end

        if selected_tab_index.present?
          @selected_tab_index = selected_tab_index # use selected
          ActiveSupport::Deprecation.warn('Calling tab with the selected_tab_index parameter, use selected instead')
        end

        @block = block
      end

      def responsive?
        responsive == true
      end

      def selected?
        selected == true
      end

      def dirty?
        dirty == true
      end

      def call
        content
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
satis-2.1.39 app/components/satis/tab/component.rb
satis-2.1.38 app/components/satis/tab/component.rb
satis-2.1.37 app/components/satis/tab/component.rb
satis-2.1.36 app/components/satis/tab/component.rb
satis-2.1.35 app/components/satis/tab/component.rb
satis-2.1.33 app/components/satis/tab/component.rb
satis-2.1.31 app/components/satis/tab/component.rb
satis-2.1.30 app/components/satis/tab/component.rb
satis-2.1.29 app/components/satis/tab/component.rb
satis-2.1.28 app/components/satis/tab/component.rb
satis-2.1.27 app/components/satis/tab/component.rb
satis-2.1.26 app/components/satis/tab/component.rb
satis-2.1.24 app/components/satis/tab/component.rb
satis-2.1.23 app/components/satis/tab/component.rb
satis-2.1.22 app/components/satis/tab/component.rb
satis-2.1.21 app/components/satis/tab/component.rb
satis-2.1.20 app/components/satis/tab/component.rb
satis-2.1.19 app/components/satis/tab/component.rb
satis-2.1.18 app/components/satis/tab/component.rb
satis-2.1.11 app/components/satis/tab/component.rb