Sha256: f190c6b65bfba983a8373682b62e59a6f6152eda4e365cb54a6263f7b8fccf26

Contents?: true

Size: 904 Bytes

Versions: 1038

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module Order
    def self.included(base)
      base.prop :order
    end

    # rubocop:disable Style/IfInsideElse
    def order_props
      selected_props = order_options.keys.select { |sk| try(sk) }
      return nil unless selected_props.present?

      selected_props.map do |k|
        order_value = send(k)
        if order_value.is_a?(Hash)
          order_value.map do |media_size, order_size_value|
            "flex_order_#{media_size}_#{order_size_value}" if order_values.include? order_size_value.to_s
          end
        else
          "flex_order_#{order_value}" if order_values.include? order_value.to_s
        end
      end.compact.join(" ")
    end
    # rubocop:enable Style/IfInsideElse

    def order_options
      {
        order: "order",
      }
    end

    def order_values
      %w[1 2 3 4 5 6 7 8 9 10 11 12]
    end
  end
end

Version data entries

1,038 entries across 1,038 versions & 1 rubygems

Version Path
playbook_ui-14.10.0.pre.rc.23 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.22 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.21 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment5060 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.20 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.19 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.18 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.PLAY1660reactdropzone5020 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.17 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.16 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.play17004992 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment4991 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.15 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.PLAY16264952 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4927 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4926 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4925 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.14 lib/playbook/order.rb
playbook_ui-14.10.0.pre.rc.13 lib/playbook/order.rb
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4903 lib/playbook/order.rb