Sha256: e461ea63be27d0854a2cc6686684e83f1046ed88a9c55dd97bb815f5794fa0b4

Contents?: true

Size: 1.03 KB

Versions: 156

Compression:

Stored size: 1.03 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

      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

156 entries across 156 versions & 1 rubygems

Version Path
playbook_ui-5.1.0.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-5.0.1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-5.0.1.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.18.1.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.18.1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.18.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.17.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.16.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.15.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.14.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.13.1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.13.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.12.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-4.11.0 app/pb_kits/playbook/pb_filter/filter.rb