Sha256: dde90d7e5d6f4541037bcaa8c1995e80e6e61daeb213a1f481ce9bc52cf0c7ad

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

module Faalis
  module Generators
    module Concerns
      # Using this **concern** module user can specify an array of tab objects
      # which each one has an `id` and `name` attribute. Tabs will be added to
      # **new** view of resource. Also this concern will a `tab` key to field
      # object. All the fields with same `id` as a tab will be grouped in that
      # tab
      module Tabs

        private

        # Process the user provided tabs
        # @return a Hash of tabs like
        def tabs
          if resource_data.include? "tabs"
            tabs = resource_data"tabs"
            result = {}
            tabs.each do |tab|
              name = tab["name"]
              fields_list = fields_with("tab", tab["id"])
              result[name] = fields_list
            end
            return result
          else
            {}
          end
        end

        def any_tabs?
          resource_data.include? "tabs"
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
faalis-0.26.0 lib/faalis/generators/concerns/tabs.rb
faalis-0.25.1 lib/faalis/generators/concerns/tabs.rb
faalis-0.25.0 lib/faalis/generators/concerns/tabs.rb
faalis-0.24.4 lib/faalis/generators/concerns/tabs.rb
faalis-0.24.3 lib/faalis/generators/concerns/tabs.rb