Sha256: bcca0c13aa3427b8cb9622ce0f81629c0ad1bb7caa8498cdea37b580c7b07c25

Contents?: true

Size: 1.07 KB

Versions: 16

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbFilter
    class Filter
      include Playbook::Props

      partial "pb_filter/filter"

      prop :filters, type: Playbook::Props::HashArray, default: [{name: ''}]
      prop :sort_menu, type: Playbook::Props::HashArray, default: [{}]
      prop :results, type: Playbook::Props::Numeric
      prop :template, type: Playbook::Props::Enum,
                      values: %w[default single filter_only sort_only],
                      default: "default"
      prop :background, type: Playbook::Props::Boolean, default: true
      prop :min_width, default: "auto"

      def classname
        generate_classname("pb_filter_kit")
      end

      def result_text
        case results
        when 1
          "#{results} Result"
        when nil
          nil
        else
          "#{results} Results"
        end
      end

      def sort_icon(direction)
        case direction
        when "asc"
          "sort-amount-up"
        when "desc"
          "sort-amount-down"
        else
          ""
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.16.0.pre.alpha2 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.16.0.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.16.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.15.1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.15.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.14.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.11.1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.11.0 app/pb_kits/playbook/pb_filter/filter.rb