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-7.4.0.pre.alpha5 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0.pre.test4 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0.pre.test3 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0.pre.test2 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0.pre.alpha4 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0.pre.alpha2 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.4.0.pre.alpha1 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha12 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha11 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha10 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha9 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha8 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha7 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha6 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha5 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha4 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha3 app/pb_kits/playbook/pb_filter/filter.rb
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_filter/filter.rb